diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:20:07 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:20:07 +0200 |
commit | 88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170 (patch) | |
tree | c6c5babb49b90293380106b81ae5c446959ac70f /lib/parse_lng.h | |
parent | 5.3 (diff) | |
download | FreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.tar.gz FreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.tar.bz2 FreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.zip |
5.4
Diffstat (limited to 'lib/parse_lng.h')
-rw-r--r-- | lib/parse_lng.h | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/lib/parse_lng.h b/lib/parse_lng.h index 07932c3a..6a0b9dc5 100644 --- a/lib/parse_lng.h +++ b/lib/parse_lng.h @@ -17,7 +17,8 @@ #include <stdexcept> #include <string> #include <vector> -#include <zen/utf8.h> +#include <zen/utf.h> +#include <zen/string_tools.h> namespace lngfile { @@ -311,24 +312,6 @@ private: std::string::const_iterator pos; }; -template <class C, class T> -inline -std::basic_string<C> numberToString(const T& number) //convert number to string the C++ way -{ - std::basic_ostringstream<C> ss; - ss << number; - return ss.str(); -} - -template <class T, class C> -inline -T stringToNumber(const std::basic_string<C>& str) //convert string to number the C++ way -{ - T number = 0; - std::basic_istringstream<C>(str) >> number; - return number; -} - class LngParser { @@ -370,7 +353,7 @@ public: consumeToken(Token::TK_FLAG_FILE_END); consumeToken(Token::TK_PLURAL_COUNT_BEGIN); - header.pluralCount = stringToNumber<int>(tk.text); + header.pluralCount = zen::stringTo<int>(tk.text); consumeToken(Token::TK_TEXT); consumeToken(Token::TK_PLURAL_COUNT_END); @@ -521,7 +504,7 @@ void generateLng(const TranslationList& in, const TransHeader& header, std::stri fileStream += KnownTokens::text(Token::TK_FLAG_FILE_END) + LB; fileStream += TAB + KnownTokens::text(Token::TK_PLURAL_COUNT_BEGIN); - fileStream += numberToString<char>(header.pluralCount); + fileStream += zen::numberTo<std::string>(header.pluralCount); fileStream += KnownTokens::text(Token::TK_PLURAL_COUNT_END) + LB; fileStream += TAB + KnownTokens::text(Token::TK_PLURAL_DEF_BEGIN); |