Debian Codegraph @

pypy/module/_cppyy/test/stltypes.h

raw symbols SCIP
1 #include <list>
2 #include <map>
3 #include <string>
4 #include <utility>
5 #include <vector>
6
7
8 //- basic example class
9 class just_a_class {
10 public:
11 int m_i;
12 };
13
14 // enum for vector of enums setitem tests
15 enum VecTestEnum {
16 EVal1 = 1, EVal2 = 3
17 };
18
19 namespace VecTestEnumNS {
20 enum VecTestEnum { EVal1 = 5, EVal2 = 42 };
21 }
22
23
24 //- class with lots of std::string handling
25 class stringy_class {
26 public:
27 stringy_class(const char* s);
28
29 std::string get_string1();
30 void get_string2(std::string& s);
31
32 void set_string1(const std::string& s);
33 void set_string2(std::string s);
34
35 std::string m_string;
36 };
37
38 //- class that has an STL-like interface
39 class no_dict_available;
40
41 template<class T>
42 class stl_like_class {
43 public:
44 no_dict_available* begin() { return 0; }
45 no_dict_available* end() { return (no_dict_available*)1; }
46 int size() { return 4; }
47 int operator[](int i) { return i; }
48 std::string operator[](double) { return "double"; }
49 std::string operator[](const std::string&) { return "string"; }
50 };
51
52 namespace {
53 stl_like_class<int> stlc_1;
54 }
55
56
57 //- helpers for testing array
58 namespace ArrayTest {
59
60 struct Point {
61 Point() : px(0), py(0) {}
62 Point(int x, int y) : px(x), py(y) {}
63 int px, py;
64 };
65
66 int get_pp_px(Point** p, int idx);
67 int get_pp_py(Point** p, int idx);
68 int get_pa_px(Point* p[], int idx);
69 int get_pa_py(Point* p[], int idx);
70
71 } // namespace ArrayTest
72
73
74 // helpers for string testing
75 extern std::string str_array_1[3];
76 extern std::string str_array_2[];
77 extern std::string str_array_3[3][2];
78 extern std::string str_array_4[4][2][2];