Update copyright year to 2014 by running admin/update-copyright.
[emacs.git] / test / cedet / tests / testsubclass.hh
blob7f1bd1e0418939d5dffae20fa87edfdb398f8359
1 // testsubclass.hh --- unit test for analyzer and complex C++ inheritance
3 // Copyright (C) 2007-2014 Free Software Foundation, Inc.
5 // Author: Eric M. Ludlam <eric@siege-engine.com>
7 // This file is part of GNU Emacs.
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.
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.
19 // You should have received a copy of the GNU General Public License
20 // along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 //#include <cmath>
23 // #include <stdio.h>
25 #ifndef TESTSUBCLASS_HH
26 #define TESTSUBCLASS_HH
28 namespace animal {
30 class moose {
31 public:
32 moose() : fFeet(0),
33 fIsValid(false)
34 { }
36 virtual void setFeet(int);
37 int getFeet();
39 void doNothing();
41 enum moose_enum {
42 NAME1, NAME2, NAME3 };
45 protected:
47 bool fIsValid;
48 int fIsProtectedInt;
50 private:
51 int fFeet; // Usually 2 or 4.
52 bool fIsPrivateBool;
54 }; // moose
56 int two_prototypes();
57 int two_prototypes();
59 class quadruped {
60 public:
61 quadruped(int a) : fQuadPrivate(a)
62 { }
64 int fQuadPublic;
66 protected:
67 int fQuadProtected;
69 private:
70 int fQuadPrivate;
77 namespace deer {
79 class moose : public animal::moose {
80 public:
81 moose() : fAntlers(false)
82 { }
84 void setAntlers(bool);
85 bool getAntlers();
87 void doSomething();
89 protected:
91 bool fSomeField;
93 private:
94 bool fAntlers;
98 } // deer
100 // A second namespace of the same name will test the
101 // namespace merging needed to resolve deer::alces
102 namespace deer {
104 class alces : public animal::moose {
105 public:
106 alces(int lat) : fLatin(lat)
109 void setLatin(bool);
110 bool getLatin();
112 void doLatinStuff(moose moosein); // for completion testing
114 moose createMoose(); // for completion testing.
116 protected:
117 bool fAlcesBool;
118 int fAlcesInt;
120 private:
121 bool fLatin;
122 int fGreek;
127 // A third namespace with classes that does protected and private inheritance.
128 namespace sneaky {
130 class antelope : public animal::quadruped {
132 public:
133 antelope(int a) : animal::quadruped(),
134 fAntyProtected(a)
137 int fAntyPublic;
139 bool testAccess();
141 protected:
142 int fAntyProtected;
144 private :
145 int fAntyPrivate;
149 class jackalope : protected animal::quadruped {
151 public:
152 jackalope(int a) : animal::quadruped(),
153 fBunny(a)
156 int fBunnyPublic;
158 bool testAccess();
160 protected:
161 bool fBunnyProtected;
163 private :
164 bool fBunnyPrivate;
168 // Nothing specified means private.
169 class bugalope : /* private*/ animal::quadruped {
171 public:
172 bugalope(int a) : animal::quadruped(),
173 fBug(a)
176 int fBugPublic;
178 bool testAccess();
179 protected:
180 bool fBugProtected;
182 private :
183 bool fBugPrivate;
190 #endif