summaryrefslogtreecommitdiffstats
path: root/src/uscxml/Convenience.h
diff options
context:
space:
mode:
authorStefan Radomski <sradomski@mintwerk.de>2016-01-10 02:40:12 (GMT)
committerStefan Radomski <sradomski@mintwerk.de>2016-01-10 02:40:12 (GMT)
commit613cf9fb6fe4b24bc7852d5a31953f6ff419e43c (patch)
tree8459365c5a6a00503063b0bf1d516fce5ea4d891 /src/uscxml/Convenience.h
parentc699a4057a65a9a09f78310d8e12588f2dc072cd (diff)
downloaduscxml-613cf9fb6fe4b24bc7852d5a31953f6ff419e43c.zip
uscxml-613cf9fb6fe4b24bc7852d5a31953f6ff419e43c.tar.gz
uscxml-613cf9fb6fe4b24bc7852d5a31953f6ff419e43c.tar.bz2
Beautified code
Diffstat (limited to 'src/uscxml/Convenience.h')
-rw-r--r--src/uscxml/Convenience.h44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/uscxml/Convenience.h b/src/uscxml/Convenience.h
index 88afa8d..d715d3e 100644
--- a/src/uscxml/Convenience.h
+++ b/src/uscxml/Convenience.h
@@ -28,7 +28,7 @@
namespace uscxml {
inline bool isnan(double x);
-
+
// see http://stackoverflow.com/questions/228005/alternative-to-itoa-for-converting-integer-to-string-c
template <typename T> std::string toStr(T tmp) {
std::ostringstream out;
@@ -46,27 +46,27 @@ template <typename T> T strTo(std::string tmp) {
class USCXML_API NumAttr {
public:
- NumAttr(const std::string& str) {
- size_t valueStart = str.find_first_of("0123456789.");
- if (valueStart != std::string::npos) {
- size_t valueEnd = str.find_last_of("0123456789.");
- if (valueEnd != std::string::npos) {
- value = str.substr(valueStart, (valueEnd - valueStart) + 1);
- size_t unitStart = str.find_first_not_of(" \t", valueEnd + 1);
- if (unitStart != std::string::npos) {
- size_t unitEnd = str.find_last_of(" \t");
- if (unitEnd != std::string::npos && unitEnd > unitStart) {
- unit = str.substr(unitStart, unitEnd - unitStart);
- } else {
- unit = str.substr(unitStart, str.length() - unitStart);
- }
- }
- }
- }
- }
-
- std::string value;
- std::string unit;
+ NumAttr(const std::string& str) {
+ size_t valueStart = str.find_first_of("0123456789.");
+ if (valueStart != std::string::npos) {
+ size_t valueEnd = str.find_last_of("0123456789.");
+ if (valueEnd != std::string::npos) {
+ value = str.substr(valueStart, (valueEnd - valueStart) + 1);
+ size_t unitStart = str.find_first_not_of(" \t", valueEnd + 1);
+ if (unitStart != std::string::npos) {
+ size_t unitEnd = str.find_last_of(" \t");
+ if (unitEnd != std::string::npos && unitEnd > unitStart) {
+ unit = str.substr(unitStart, unitEnd - unitStart);
+ } else {
+ unit = str.substr(unitStart, str.length() - unitStart);
+ }
+ }
+ }
+ }
+ }
+
+ std::string value;
+ std::string unit;
};
bool isNumeric(const char* pszInput, int nNumberBase);