Skip to content

Commit b683bb4

Browse files
committed
Fix build on Windows unicode
1 parent c7693c3 commit b683bb4

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/dataParser.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
@@ -22,20 +22,18 @@
2222
#include <sstream>
2323
#include <cstring>
2424

25-
#include "ini/types.h"
26-
2725
class dataParser
2826
{
2927
public:
3028
class parseError {};
3129

3230
private:
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

4644
public:
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

0 commit comments

Comments
 (0)