diff options
author | Paul ProductEngine <pguslisty@productengine.com> | 2011-05-13 18:23:11 +0300 |
---|---|---|
committer | Paul ProductEngine <pguslisty@productengine.com> | 2011-05-13 18:23:11 +0300 |
commit | 2d19b297a98d8be87c487f6b93e098dce9ca908c (patch) | |
tree | fe7741b971bc3e4a8a2c9d1d5d41282cbc0fe00a /indra/llui/lltextvalidate.cpp | |
parent | 5e0fee32074643454ae3c947eae648c6333d7f48 (diff) |
STORM-1202 FIXED Time spin control
Implemented time spin control which is like spin control, but shows and allows to edit time string in "hh:mm PM/AM" format.
Implemented according to the WLRS spec.
Diffstat (limited to 'indra/llui/lltextvalidate.cpp')
-rw-r--r-- | indra/llui/lltextvalidate.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp index 4b9faa0560..234e600ccd 100644 --- a/indra/llui/lltextvalidate.cpp +++ b/indra/llui/lltextvalidate.cpp @@ -188,6 +188,39 @@ namespace LLTextValidate return success; } + bool validateNonNegativeS32NoSpace(const LLWString &str) + { + LLLocale locale(LLLocale::USER_LOCALE); + + LLWString test_str = str; + S32 len = test_str.length(); + bool success = TRUE; + if(0 < len) + { + if('-' == test_str[0]) + { + success = FALSE; + } + S32 i = 0; + while(success && (i < len)) + { + if(!LLStringOps::isDigit(test_str[i]) || LLStringOps::isSpace(test_str[i++])) + { + success = FALSE; + } + } + } + if (success) + { + S32 val = strtol(wstring_to_utf8str(test_str).c_str(), NULL, 10); + if (val < 0) + { + success = FALSE; + } + } + return success; + } + bool validateAlphaNum(const LLWString &str) { LLLocale locale(LLLocale::USER_LOCALE); |