-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobals.cpp
More file actions
52 lines (44 loc) · 1.02 KB
/
globals.cpp
File metadata and controls
52 lines (44 loc) · 1.02 KB
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
#include "globals.h"
// -----------------------------------------------------------------------------
// These functions help get around the problems converting between wxString and
// standard string representations (C and stl).
// -----------------------------------------------------------------------------
// wxString to std::string
std::string ws2s(wxString as)
{
return std::string(as.mb_str(wxConvISO8859_1));
}
// std::string to wxString
wxString s2ws(std::string s)
{
return wxString((s).c_str(),wxConvISO8859_1);
}
// C string to wxString
wxString cs2ws(const char* s)
{
return wxString(s,wxConvISO8859_1);
}
// wxString to int
int ws2i(wxString ws)
{
return wxAtoi(ws);
}
// wxString to double, or zero if invalid
double ws2d(wxString ws)
{
double res;
bool OK = ws.ToDouble(&res);
return (OK ? res : 0);
}
// double to wxString
wxString d2ws(double d)
{
wxString ws;
ws << d;
return ws;
}
// Check if character is parenthesis
bool isparen(char c)
{
return (c == '(' || c == ')');
}