|
a/src/smallut.cpp |
|
b/src/smallut.cpp |
|
... |
|
... |
40 |
#endif
|
40 |
#endif
|
41 |
|
41 |
|
42 |
#include <string>
|
42 |
#include <string>
|
43 |
#include <iostream>
|
43 |
#include <iostream>
|
44 |
#include <list>
|
44 |
#include <list>
|
45 |
#include UNORDERED_MAP_INCLUDE
|
45 |
#include <unordered_map>
|
46 |
#include UNORDERED_SET_INCLUDE
|
46 |
#include <unordered_set>
|
47 |
|
47 |
|
48 |
#include "smallut.h"
|
48 |
#include "smallut.h"
|
49 |
|
49 |
|
50 |
using namespace std;
|
50 |
using namespace std;
|
51 |
|
51 |
|
|
... |
|
... |
321 |
list<string>&, const string&);
|
321 |
list<string>&, const string&);
|
322 |
template bool stringToStrings<vector<string> >(const string&,
|
322 |
template bool stringToStrings<vector<string> >(const string&,
|
323 |
vector<string>&, const string&);
|
323 |
vector<string>&, const string&);
|
324 |
template bool stringToStrings<set<string> >(const string&,
|
324 |
template bool stringToStrings<set<string> >(const string&,
|
325 |
set<string>&, const string&);
|
325 |
set<string>&, const string&);
|
326 |
template bool stringToStrings<STD_UNORDERED_SET<string> >
|
326 |
template bool stringToStrings<std::unordered_set<string> >
|
327 |
(const string&, STD_UNORDERED_SET<string>&, const string&);
|
327 |
(const string&, std::unordered_set<string>&, const string&);
|
328 |
|
328 |
|
329 |
template <class T> void stringsToString(const T& tokens, string& s)
|
329 |
template <class T> void stringsToString(const T& tokens, string& s)
|
330 |
{
|
330 |
{
|
331 |
for (typename T::const_iterator it = tokens.begin();
|
331 |
for (typename T::const_iterator it = tokens.begin();
|
332 |
it != tokens.end(); it++) {
|
332 |
it != tokens.end(); it++) {
|
|
... |
|
... |
1193 |
|
1193 |
|
1194 |
static const string cstr_cp1252("CP1252");
|
1194 |
static const string cstr_cp1252("CP1252");
|
1195 |
|
1195 |
|
1196 |
string langtocode(const string& lang)
|
1196 |
string langtocode(const string& lang)
|
1197 |
{
|
1197 |
{
|
1198 |
static STD_UNORDERED_MAP<string, string> lang_to_code;
|
1198 |
static std::unordered_map<string, string> lang_to_code;
|
1199 |
if (lang_to_code.empty()) {
|
1199 |
if (lang_to_code.empty()) {
|
1200 |
for (unsigned int i = 0;
|
1200 |
for (unsigned int i = 0;
|
1201 |
i < sizeof(vlang_to_code) / sizeof(char *); i += 2) {
|
1201 |
i < sizeof(vlang_to_code) / sizeof(char *); i += 2) {
|
1202 |
lang_to_code[vlang_to_code[i]] = vlang_to_code[i + 1];
|
1202 |
lang_to_code[vlang_to_code[i]] = vlang_to_code[i + 1];
|
1203 |
}
|
1203 |
}
|
1204 |
}
|
1204 |
}
|
1205 |
STD_UNORDERED_MAP<string, string>::const_iterator it =
|
1205 |
std::unordered_map<string, string>::const_iterator it =
|
1206 |
lang_to_code.find(lang);
|
1206 |
lang_to_code.find(lang);
|
1207 |
|
1207 |
|
1208 |
// Use cp1252 by default...
|
1208 |
// Use cp1252 by default...
|
1209 |
if (it == lang_to_code.end()) {
|
1209 |
if (it == lang_to_code.end()) {
|
1210 |
return cstr_cp1252;
|
1210 |
return cstr_cp1252;
|
|
... |
|
... |
1238 |
basic_regex<char>::flag_type(regex_constants::extended |
|
1238 |
basic_regex<char>::flag_type(regex_constants::extended |
|
1239 |
((flags&SRE_ICASE) ? regex_constants::icase : 0) |
|
1239 |
((flags&SRE_ICASE) ? regex_constants::icase : 0) |
|
1240 |
((flags&SRE_NOSUB) ? regex_constants::nosubs : 0)
|
1240 |
((flags&SRE_NOSUB) ? regex_constants::nosubs : 0)
|
1241 |
)), ok(true), nmatch(nm) {
|
1241 |
)), ok(true), nmatch(nm) {
|
1242 |
}
|
1242 |
}
|
1243 |
bool ok;
|
|
|
1244 |
std::regex expr;
|
1243 |
std::regex expr;
|
1245 |
std::smatch res;
|
1244 |
std::smatch res;
|
|
|
1245 |
bool ok;
|
1246 |
int nmatch;
|
1246 |
int nmatch;
|
1247 |
};
|
1247 |
};
|
1248 |
|
1248 |
|
1249 |
bool SimpleRegexp::simpleMatch(const string& val) const
|
1249 |
bool SimpleRegexp::simpleMatch(const string& val) const
|
1250 |
{
|
1250 |
{
|