Index: compiled/String.h |
=================================================================== |
--- a/compiled/String.h |
+++ b/compiled/String.h |
@@ -186,16 +186,34 @@ |
if (currChar >= u'A' && currChar <= u'Z') |
mBuf[i] = currChar + u'a' - u'A'; |
else if (currChar >= 128) |
{ |
mBuf[i] = CharToLower(currChar); |
} |
} |
} |
+ |
+ template<typename T> |
+ T toInt() const |
+ { |
+ size_type count = 0; |
+ T value = 0; |
+ for (size_type i = 0; i < length(); i++) |
+ { |
+ if (mBuf[i] < u'0' || mBuf[i] > u'9' || |
+ count > std::numeric_limits<T>::digits10) |
+ return 0; |
+ |
+ value *= 10; |
+ value += mBuf[i] - u'0'; |
+ count++; |
+ } |
+ return value; |
+ } |
}; |
class DependentString : public String |
{ |
public: |
explicit DependentString() |
: String(nullptr, 0, INVALID) |
{ |