diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-29 13:58:56 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-29 13:58:56 (GMT) |
| commit | f8a6d2ea1f8f6789645279f69471c13c7caa352b (patch) | |
| tree | b72c796018bca6244e39ecf4ca1db8d4770a51b0 /src/Misc.h | |
| parent | 716ac44c29a06e9a0e6267b50e263a65f7aba8ec (diff) | |
| download | powder-f8a6d2ea1f8f6789645279f69471c13c7caa352b.zip powder-f8a6d2ea1f8f6789645279f69471c13c7caa352b.tar.gz | |
Textboxes for decoration, addresses "No text boxes in deco editor to directly edit the values" in issue #23
Diffstat (limited to 'src/Misc.h')
| -rw-r--r-- | src/Misc.h | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -3,6 +3,7 @@ #include <stdio.h> #include <stdlib.h> #include <string> +#include <sstream> #include <vector> #if defined(WIN32) && !defined(__GNUC__) @@ -82,6 +83,20 @@ void RGB_to_HSV(int r,int g,int b,int *h,int *s,int *v); void OpenURI(std::string uri); +template <typename T> std::string NumberToString(T number) +{ + std::stringstream ss; + ss << number; + return ss.str(); +} + +template <typename T> T StringToNumber(const std::string & text) +{ + std::stringstream ss(text); + T number; + return (ss >> number)?number:0; +} + void membwand(void * dest, void * src, size_t destsize, size_t srcsize); // a b // c d |
