-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfxhelper.h
59 lines (48 loc) · 1.5 KB
/
fxhelper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef _CSMAP_FXHELPER_H
#define _CSMAP_FXHELPER_H
#include <vector>
#include <ostream>
#include <fx.h>
extern FXString FXString_Empty;
// array begin() / end() template
// ------------------------------
template <typename T, std::size_t size>
T* begin(T (&array)[size])
{
return array;
}
template <typename T, std::size_t size>
T* end(T (&array)[size])
{
return array + size;
}
// FXString converter: iso8859-1 <-> utf8
// --------------------------------------
FX::FXString utf2iso(const FX::FXString& s);
FX::FXString iso2utf(const FX::FXString& s);
FX::FXString iso2utf(const FXchar* src, FXint nsrc);
int isUTF8(const char* data, size_t size);
// flatten strings: Removed spaces,
// german umlauts to ae,oe,ue,ss and
// all letters to lower case.
// ---------------------------------
std::string flatten(const std::string& str);
FX::FXString flatten(const FX::FXString& str);
// Small error functions
// ---------------------
void showError(const FX::FXString& str);
void showError(const std::string& str);
// FXString operator<<
// -------------------
inline std::ostream& operator<<(std::ostream& out, const FX::FXString& str)
{
return out << str.text();
}
FXString FXStringValEx(FXulong num, unsigned int base = 10);
struct FXParam {
FXString key;
FXString value;
};
void FXParseCommandLine(const std::vector<FXString>& args, std::vector<FXString>& tokens, std::vector<FXString>& switches, std::vector<FXParam>& params);
std::string loadResourceFile(const char * relpath);
#endif //_CSMAP_FXHELPER_H