1 // testusing.hh --- semantic-ia-utest completion engine unit tests
2
3 // Copyright (C) 2008-2023 Free Software Foundation, Inc.
4
5 // Author: Eric M. Ludlam <zappo@gnu.org>
6
7 // This file is part of GNU Emacs.
8
9 // GNU Emacs is free software: you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 3 of the License, or
12 // (at your option) any later version.
13
14 // GNU Emacs is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18
19 // You should have received a copy of the GNU General Public License
20 // along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22 namespace moose {
23
24 class Point;
25
26 class MyClass;
27
28 }
29
30
31 namespace moose {
32
33 class Point;
34
35 class MyClass {
36 public:
37 MyClass() : fVal(0) {
38 }
39
40 ~MyClass() {};
41
42 /**
43 * fVal Accessors
44 * @{
45 */
46 int getVal() const {
47 return fVal;
48 }
49 void setVal(int Val) const {
50 fVal = Val;
51 }
52 /**
53 * @}
54 */
55
56 private:
57 int fVal;
58 };
59
60 }
61
62 namespace togglemoose {
63
64 class MyOtherClass {
65 public:
66 int testToggle1();
67 int testToggle2();
68 int testToggle3();
69 };
70 }
71
72 namespace deer {
73
74 class Pickle;
75
76 };
77
78 // Code from Zhiqiu Kong
79
80 #ifndef BREAD_H
81 #define BREAD_H
82
83 namespace bread_name {
84 class bread
85 {
86 public:
87 void geta();
88 private:
89 int m_a;
90 int m_b;
91 };
92 }
93
94 #endif
95
96 // Code from David Engster
97 // Creating alias types through 'using' trickery
98
99 namespace somestuff {
100 class OneClass {
101 public:
102 void aFunc();
103 int anInt;
104 };
105 struct aStruct {
106 int foo;
107 int bar;
108 };
109 }
110
111 namespace otherstuff {
112 // make otherstuff::OneClass an alias for somestuff::OneClass
113 using somestuff::OneClass;
114 }
115
116 namespace morestuff {
117 // make morestuff an alias namespace for somestuff
118 using namespace somestuff;
119 // but hide aStruct with own type
120 struct aStruct {
121 int anotherFoo;
122 int anotherBar;
123 };
124 }
125
126 // We can also create an alias for an alias
127 namespace evenmorestuff {
128 using otherstuff::OneClass;
129 }
130
131 // Now with nested namespaces
132 namespace outer {
133 namespace inner {
134 struct StructNested {
135 int one;
136 int two;
137 };
138 struct AnotherStruct {
139 int three;
140 int four;
141 };
142 }
143 }
144
145 // Namespace which pulls in one of its own nested namespaces
146 namespace first {
147 class AAA1;
148 namespace second {
149 class AAA2;
150 }
151 // Elevate nested namespace into first one
152 using namespace second;
153 }
154
155 namespace third {
156 using namespace first;
157 class AAA3;
158 }
159
160
161 // Elevate the first struct into 'outer'
162 // so that we can access it via 'outer::StructNested'
163 namespace outer {
164 using outer::inner::StructNested;
165 }
166
167 // Create an alias for a nested namespace
168 namespace outerinner {
169 // equivalent to 'namespace outerinner = outer::inner;'
170 using namespace outer::inner;
171 }
172
173 // Create namespace alias
174 namespace alias_for_somestuff = somestuff;
175 // Same for nested namespace
176 namespace alias_for_outerinner = outer::inner;