annotate test/cedet/tests/testtypedefs.cpp @ 109054:7aadb3822de4

w32-fns.el (w32-convert-standard-filename): Doc fix.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 26 Jun 2010 15:11:06 +0300
parents 89eccb374dec
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 // testtypedefs.cpp --- Sample with some fake bits out of std::string
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) 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/>.
89eccb374dec Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents: 105377
diff changeset
21
104494
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 // Thanks Ming-Wei Chang for these examples.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 namespace std {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 template <T>class basic_string {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 public:
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 void resize(int);
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 };
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 typedef std::basic_string<char> mstring;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 using namespace std;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 typedef basic_string<char> bstring;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 int main(){
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 mstring a;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 a.// -1-
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 ;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 // #1# ( "resize" )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 bstring b;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 // It doesn't work here.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 b.// -2-
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 ;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 // #2# ( "resize" )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 return 0;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 // ------------------
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50
107698
89eccb374dec Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents: 105377
diff changeset
51 class Bar
104494
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 public:
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 void someFunc() {}
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 };
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 typedef Bar new_Bar;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 template <class mytype>
107698
89eccb374dec Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents: 105377
diff changeset
60 class TBar
104494
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 public:
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 void otherFunc() {}
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 };
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 typedef TBar<char> new_TBar;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 int main()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 new_Bar nb;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 new_TBar ntb;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 nb.// -3-
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 ;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 // #3# ("someFunc")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 ntb.// -4-
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 ;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 // #4# ("otherFunc")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 return 0;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 }
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 104494
diff changeset
81
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 104494
diff changeset
82 // arch-tag: 5a841384-8685-4344-bf45-15d3db19a87b