equal
deleted
inserted
replaced
55 } |
55 } |
56 |
56 |
57 //---------------------------------------------- |
57 //---------------------------------------------- |
58 |
58 |
59 inline bool isNumeric(const std::string& s) { |
59 inline bool isNumeric(const std::string& s) { |
60 char *endp; |
60 bool decimalPtSeen = false; |
61 double unused = strtod(s.c_str(), &endp); // declared with warn_unused_result |
61 bool exponentSeen = false; |
62 unused = unused; // quiet compiler |
62 char last = '\0'; |
63 return endp == s.c_str() + s.size(); |
63 |
|
64 for (std::string::const_iterator it = s.begin (); it != s.end (); it++) |
|
65 { |
|
66 if ((*it == '.') && (decimalPtSeen)) |
|
67 return false; |
|
68 else if (*it == '.') |
|
69 decimalPtSeen = true; |
|
70 else if ((*it == 'e') && exponentSeen) |
|
71 return false; |
|
72 else if (*it == 'e') |
|
73 { |
|
74 exponentSeen = true; |
|
75 decimalPtSeen = false; |
|
76 } |
|
77 else if (*it == '-' && it != s.begin () && last != 'e') |
|
78 return false; |
|
79 |
|
80 last = *it; |
|
81 } |
|
82 return true; |
64 } |
83 } |
65 |
84 |
66 void |
85 void |
67 OmnetDataOutput::Output(DataCollector &dc) |
86 OmnetDataOutput::Output(DataCollector &dc) |
68 { |
87 { |