forked from ennorehling/csmapfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fxhelper.h
50 lines (41 loc) · 1.17 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
#ifndef _CSMAP_FXHELPER_H
#define _CSMAP_FXHELPER_H
#include <vector>
#include <ostream>
#include <fx.h>
// 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);
// flatten strings: Removed spaces,
// german umlauts to ae,oe,ue,ss and
// all letters to lower case.
// ---------------------------------
std::string flatten(const std::string& str);
FXString flatten(const FXString& str);
// Small error functions
// ---------------------
void showError(const FXString& str);
void showError(const std::string& str);
// get search path for app config data
// -----------------------------------
std::vector<FXString> getSearchPath();
// FXString operator<<
// -------------------
inline std::ostream& operator<<(std::ostream& out, const FX::FXString& str)
{
return out << utf2iso(str).text();
}
#endif //_CSMAP_FXHELPER_H