-
Notifications
You must be signed in to change notification settings - Fork 16
/
adclient.swigcxx
52 lines (44 loc) · 1.27 KB
/
adclient.swigcxx
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
%module adclient
%{
#include "adclient.h"
%}
%include <typemaps.i>
%include "std_string.i"
%include "std_vector.i"
%include "std_map.i"
namespace std {
%template(StringVector) vector<string>;
%template(StringBoolMap) map<string, bool>;
%template(String_VectorString_Map) map<string, vector<string> >;
%extend map<string, bool> {
std::vector<string> keys(void) {
std::vector<string> k = std::vector<string>();
for (std::map<string, bool>::iterator iter = self->begin(); iter != self->end(); iter++) {
k.push_back(iter->first);
}
return k;
}
}
%extend map<string, vector<string> > {
std::vector<string> keys(void) {
std::vector<string> k = std::vector<string>();
for (std::map<string, vector<string> >::iterator iter = self->begin(); iter != self->end(); iter++) {
k.push_back(iter->first);
}
return k;
}
}
}
%exception {
try {
$action;
} catch (ADException &e) {
std::stringstream ss;
ss << e.code << ":" << e.msg;
_swig_gopanic(ss.str().c_str());
} catch (std::exception &e) {
_swig_gopanic(e.what());
}
}
%include "adclient.h"
typedef long time_t;