root/test/lisp/cedet/semantic-utest-ia-resources/testtemplates.cpp

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main
  2. foo
  3. bar
  4. main2

     1 // testtemplates.cpp --- 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 
    23 // TODO - this probably means can't be part of emacs, as I don't know who this guy is.
    24 // Written by 'Raf'
    25 
    26 template <class T, int U, class V>
    27 class read_ref {
    28 public:
    29   const T* read_ref_member_one( T);
    30   const V* read_ref_member_two();
    31 };
    32 
    33 namespace NS {
    34   template <class T, int U, class V>
    35   class ref {
    36   public:
    37     read_ref<T,10,V> operator->() {
    38       m_// -1-
    39         ;
    40       // #1# ( "m_datas" )
    41     }
    42 
    43   private:
    44     T m_datas[U];
    45   };
    46 
    47 }
    48 
    49 class FooOne {
    50 public:
    51   int fooOneMember();
    52 };
    53 
    54 class FooTwo {
    55 public:
    56   int fooTwoMember();
    57 };
    58 
    59 class FooThree {
    60 public:
    61   int fooThreeMember();
    62 
    63   FooOne * operator->();
    64 };
    65 
    66 typedef ref<FooOne, 10,FooTwo> Test;
    67 
    68 using NS;
    69 
    70 void
    71 main(void) {
    72   ref<FooOne, 10, FooTwo> v;
    73 
    74   v->read_ref_member_one()-> // -2-
    75     ;
    76   // #2# ( "fooOneMember" )
    77 
    78   v->read_ref_member_two()-> // -3-
    79     ;
    80   // #3# ( "fooTwoMember" )
    81 
    82   v-> // -4-
    83     ;
    84   // #4# ( "read_ref_member_one" "read_ref_member_two" )
    85 
    86   Test t;
    87 
    88   t->read_ref_member_two()-> // -5-
    89     ;
    90   // #5# ( "fooTwoMember" )
    91 
    92   ref<FooOne, 10, FooThree> v2;
    93 
    94   v2->read_ref_member_two()-> // -6-
    95     ;
    96   // #6# ( "fooOneMember" )
    97 
    98   /* Try all these things by also specifying the namespace in the name. */
    99   NS::ref<FooOne, 10, FooTwo> v3;
   100 
   101   v3->read_ref_member_one()-> // -7-
   102     ;
   103   // #7# ( "fooOneMember" )
   104 
   105   v3->read_ref_member_two()-> // -8-
   106     ;
   107   // #8# ( "fooTwoMember" )
   108 
   109   v3->read_ref_member_two// @1@ 5
   110     ;
   111 
   112 }
   113 
   114 // More Namespace Magic using member constants.
   115 
   116 template<typename T>
   117 struct isFooLike {
   118   static const bool value = false;
   119 };
   120 
   121 template <>
   122 struct isFooLike<int> {
   123   static const bool value = true;
   124 };
   125 
   126 
   127 template <typename T, bool isFoo>
   128 class A {
   129 public:
   130   A();
   131   void foo() {};
   132 };
   133 
   134 
   135 template <typename T>
   136 class FooFour : public A<T, isPodLike<T>::value> {
   137 public:
   138   bool bar() {}
   139 };
   140 
   141 
   142 int main2() {
   143 
   144   FooFour<int> ff;
   145 
   146   ff.// - 9- @ TODO - bring over patch from SF
   147     ; // #9# ( "bar" "foo" );
   148 
   149 }

/* [<][>][^][v][top][bottom][index][help] */