Mercurial > emacs
annotate test/cedet/tests/testsubclass.hh @ 111654:1ce970bc77c0
ChangeLog fixes prompted by M-x authors.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 20 Nov 2010 14:25:56 -0800 |
parents | 89eccb374dec |
children | 376148b31b5e |
rev | line source |
---|---|
107698
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
1 // testsubclass.hh --- unit test for analyzer and complex C++ inheritance |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
2 |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
3 // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
4 |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
5 // Author: Eric M. Ludlam <eric@siege-engine.com> |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
6 |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
7 // This file is part of GNU Emacs. |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
8 |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
9 // GNU Emacs is free software: you can redistribute it and/or modify |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
10 // it under the terms of the GNU General Public License as published by |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
11 // the Free Software Foundation, either version 3 of the License, or |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
12 // (at your option) any later version. |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
13 |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
14 // GNU Emacs is distributed in the hope that it will be useful, |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
17 // GNU General Public License for more details. |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
18 |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
19 // You should have received a copy of the GNU General Public License |
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
20 // along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
104494 | 21 |
22 //#include <cmath> | |
23 // #include <stdio.h> | |
24 | |
25 #ifndef TESTSUBCLASS_HH | |
26 #define TESTSUBCLASS_HH | |
27 | |
28 namespace animal { | |
29 | |
30 class moose { | |
31 public: | |
32 moose() : fFeet(0), | |
33 fIsValid(false) | |
34 { } | |
35 | |
36 virtual void setFeet(int); | |
37 int getFeet(); | |
38 | |
39 void doNothing(); | |
40 | |
41 enum moose_enum { | |
42 NAME1, NAME2, NAME3 }; | |
43 | |
44 | |
45 protected: | |
46 | |
47 bool fIsValid; | |
48 int fIsProtectedInt; | |
49 | |
50 private: | |
51 int fFeet; // Usually 2 or 4. | |
52 bool fIsPrivateBool; | |
53 | |
54 }; // moose | |
55 | |
56 int two_prototypes(); | |
57 int two_prototypes(); | |
58 | |
59 class quadruped { | |
60 public: | |
61 quadruped(int a) : fQuadPrivate(a) | |
62 { } | |
63 | |
64 int fQuadPublic; | |
65 | |
66 protected: | |
67 int fQuadProtected; | |
68 | |
69 private: | |
70 int fQuadPrivate; | |
71 | |
72 }; | |
73 | |
74 } | |
75 | |
76 | |
77 namespace deer { | |
78 | |
79 class moose : public animal::moose { | |
80 public: | |
81 moose() : fAntlers(false) | |
82 { } | |
83 | |
84 void setAntlers(bool); | |
85 bool getAntlers(); | |
86 | |
87 void doSomething(); | |
88 | |
89 protected: | |
90 | |
91 bool fSomeField; | |
92 | |
93 private: | |
94 bool fAntlers; | |
95 | |
96 }; | |
97 | |
98 } // deer | |
99 | |
100 // A second namespace of the same name will test the | |
101 // namespace merging needed to resolve deer::alces | |
102 namespace deer { | |
103 | |
104 class alces : public animal::moose { | |
105 public: | |
106 alces(int lat) : fLatin(lat) | |
107 { } | |
108 | |
109 void setLatin(bool); | |
110 bool getLatin(); | |
111 | |
112 void doLatinStuff(moose moosein); // for completion testing | |
113 | |
114 moose createMoose(); // for completion testing. | |
115 | |
116 protected: | |
117 bool fAlcesBool; | |
118 int fAlcesInt; | |
119 | |
120 private: | |
121 bool fLatin; | |
122 int fGreek; | |
123 }; | |
124 | |
125 }; | |
126 | |
127 // A third namespace with classes that does protected and private inheritance. | |
128 namespace sneaky { | |
129 | |
130 class antelope : public animal::quadruped { | |
131 | |
132 public: | |
133 antelope(int a) : animal::quadruped(), | |
134 fAntyProtected(a) | |
135 {} | |
136 | |
137 int fAntyPublic; | |
138 | |
139 bool testAccess(); | |
140 | |
141 protected: | |
142 int fAntyProtected; | |
143 | |
144 private : | |
145 int fAntyPrivate; | |
146 | |
147 }; | |
148 | |
149 class jackalope : protected animal::quadruped { | |
150 | |
151 public: | |
152 jackalope(int a) : animal::quadruped(), | |
153 fBunny(a) | |
154 {} | |
155 | |
156 int fBunnyPublic; | |
157 | |
158 bool testAccess(); | |
159 | |
160 protected: | |
161 bool fBunnyProtected; | |
162 | |
163 private : | |
164 bool fBunnyPrivate; | |
165 | |
166 }; | |
167 | |
168 // Nothing specified means private. | |
169 class bugalope : /* private*/ animal::quadruped { | |
170 | |
171 public: | |
172 bugalope(int a) : animal::quadruped(), | |
173 fBug(a) | |
174 {} | |
175 | |
176 int fBugPublic; | |
177 | |
178 bool testAccess(); | |
179 protected: | |
180 bool fBugProtected; | |
181 | |
182 private : | |
183 bool fBugPrivate; | |
184 | |
185 }; | |
186 | |
187 | |
188 }; | |
189 | |
190 #endif | |
105377 | 191 |
192 // arch-tag: e292a1d5-5434-4b4d-8e0e-808101ad84b6 |