File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (C) 2014 Leandro Nini
2+ * Copyright (C) 2014-2026 Leandro Nini
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
2222#include < sstream>
2323#include < cstring>
2424
25- #include " ini/types.h"
26-
2725class dataParser
2826{
2927public:
3028 class parseError {};
3129
3230private:
33- template <typename T>
34- static T convertString (const TCHAR * data)
31+ template <typename T, typename U >
32+ static T convertString (const U * data)
3533 {
3634 T value;
3735
38- SID_STRINGTREAM stream (data);
36+ std::basic_stringstream<U> stream (data);
3937 stream >> std::boolalpha >> value;
4038 if (stream.fail ()) {
4139 throw parseError ();
@@ -44,9 +42,12 @@ class dataParser
4442 }
4543
4644public:
47- static double parseDouble (const TCHAR* data) { return convertString<double >(data); }
48- static int parseInt (const TCHAR* data) { return convertString<int >(data); }
49- static bool parseBool (const TCHAR* data) { return convertString<bool >(data); }
45+ template <typename U>
46+ static double parseDouble (const U* data) { return convertString<double >(data); }
47+ template <typename U>
48+ static int parseInt (const U* data) { return convertString<int >(data); }
49+ template <typename U>
50+ static bool parseBool (const U* data) { return convertString<bool >(data); }
5051};
5152
5253#endif // DATAPARSER_H
You can’t perform that action at this time.
0 commit comments