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

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

DEFINITIONS

This source file includes following definitions.
  1. get
  2. publishStuff
  3. publishStuff
  4. sendStuff
  5. test_fcn
  6. foo_fcn
  7. xx
  8. baz
  9. baz
  10. someFunc
  11. someOtherFunc

     1 // testdoublens.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 #include "testdoublens.hpp"
    23 
    24 namespace Name1 {
    25   namespace Name2 {
    26 
    27     Foo::Foo()
    28     {
    29       p// -1-
    30         // #1# ( "pMumble" "publishStuff" )
    31         ;
    32     }
    33 
    34     int Foo::get() // ^1^
    35     {
    36       p// -2-
    37         // #2# ( "pMumble" "publishStuff" )
    38         ;
    39       return 0;
    40     }
    41 
    42     void Foo::publishStuff(int a, int b) // ^2^
    43     {
    44       int foo = a;
    45       int bar = b;
    46     }
    47 
    48     // Test polymorphism on arg types.  Note that order is
    49     // mixed to maximize failure cases
    50     void Foo::publishStuff(char a, char b) // ^4^
    51     {
    52       int foo = a;
    53       int bar = b;
    54     }
    55 
    56     void Foo::sendStuff(int a, int b) // ^3^
    57     {
    58       int foo = a;
    59       int bar = b;
    60 
    61       Foo::publishStuff(1,2)
    62 
    63     }
    64 
    65   } // namespace Name2
    66 } // namespace Name1
    67 
    68 // Test multiple levels of metatype expansion
    69 int test_fcn () {
    70   stage3_Foo MyFoo;
    71 
    72   MyFoo.// -3-
    73     // #3# ( "Mumble" "get" )
    74     ;
    75 
    76   Name1::Name2::F//-4-
    77     // #4# ( "Foo" )
    78     ;
    79 
    80   // @TODO - get this working...
    81   Name1::stage2_Foo::M//-5-
    82     /// #5# ( "Mumble" )
    83     ;
    84 }
    85 
    86 stage3_Foo foo_fcn() {
    87   // Can we go "up" to foo with senator-go-to-up-reference?
    88 }
    89 
    90 
    91 // Second test from Ravikiran Rajagopal
    92 
    93 namespace A {
    94   class foo {
    95   public:
    96     void aa();
    97     void bb();
    98   };
    99 }
   100 namespace A {
   101   class bar {
   102   public:
   103     void xx();
   104   public:
   105     foo myFoo;
   106   };
   107 
   108   void bar::xx()
   109   {
   110     myFoo.// -6- <--- cursor is here after the dot
   111       // #6# ( "aa" "bb" )
   112       ;
   113   }
   114 }
   115 
   116 // Double namespace example from Hannu Koivisto
   117 //
   118 // This is tricky because the parent class "Foo" is found within the
   119 // scope of B, so the scope calculation needs to put that together
   120 // before searching for parents in scope.
   121 namespace a {
   122   namespace b {
   123 
   124     class Bar : public Foo
   125     {
   126       int baz();
   127     };
   128 
   129     int Bar::baz()
   130     {
   131       return dum// -7-
   132         // #7# ( "dumdum" )
   133         ;
   134     }
   135 
   136   } // namespace b
   137 } // namespace a
   138 
   139 // Three namespace example from Hannu Koivisto
   140 //
   141 // This one is special in that the name e::Foo, where "e" is in
   142 // the scope, and not referenced from the global namespace.  This
   143 // wasn't previously handled, so the fullscope needed to be added
   144 // to the list of things searched when in split-name decent search mode
   145 // for scopes.
   146 
   147 namespace d {
   148   namespace e {
   149 
   150     class Foo
   151     {
   152     public:
   153       int write();
   154     };
   155 
   156   } // namespace d
   157 } // namespace e
   158 
   159 
   160 namespace d {
   161   namespace f {
   162 
   163     class Bar
   164     {
   165     public:
   166       int baz();
   167 
   168     private:
   169       e::Foo &foo;
   170     };
   171 
   172     int Bar::baz()
   173     {
   174       return foo.w// -8-
   175         // #8# ( "write" )
   176         ;
   177     }
   178 
   179   } // namespace f
   180 } // namespace d
   181 
   182 // Fully qualified const struct function arguments
   183 class ContainsStruct
   184 {
   185   struct TheStruct
   186   {
   187     int memberOne;
   188     int memberTwo;
   189   };
   190 };
   191 
   192 void someFunc(const struct ContainsStruct::TheStruct *foo)
   193 {
   194   foo->// -9-
   195     // #9# ("memberOne" "memberTwo")
   196 }
   197 
   198 // Class with structure tag
   199 class ContainsNamedStruct
   200 {
   201   struct _fooStruct
   202   {
   203     int memberOne;
   204     int memberTwo;
   205   } member;
   206 };
   207 
   208 void someOtherFunc(void)
   209 {
   210   ContainsNamedStruct *someClass;
   211   // This has to find ContainsNamedStruct::_fooStruct
   212   someClass->member.// -10-
   213     // #10# ("memberOne" "memberTwo")
   214 }

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