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

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

DEFINITIONS

This source file includes following definitions.
  1. fromroot
  2. fromchild
  3. myfcn_not_in_ns
  4. aaa
  5. foo
  6. fun

     1 /* testnsp.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 namespace nsp {
    24 
    25   class rootclass {
    26   public:
    27     int fromroot() {};
    28   };
    29 
    30 }
    31 
    32 namespace nsp {
    33   class childclass : public rootclass {
    34   public:
    35     int fromchild() {};
    36   };
    37 }
    38 
    39 void myfcn_not_in_ns (void) {
    40   nsp::childclass test;
    41 
    42   test.// -1-
    43     ; // #1# ( "fromchild" "fromroot" )
    44 }
    45 
    46 // Test a class declared in a class, where the contents
    47 // are in a qualified name.
    48 //
    49 // Thanks Michael Reiher for the concise example.
    50 
    51 class AAA
    52 {
    53 public:
    54   AAA();
    55 
    56   void aaa();
    57 
    58 private:
    59     class Private;
    60     Private * const d;
    61 };
    62 
    63 class AAA::Private
    64 {
    65     Private() : bbb(0) {
    66     }
    67 
    68     BBB* bbb;
    69 };
    70 
    71 void AAA::aaa()
    72 {
    73   d->// -2-
    74     ; // #2# ( "bbb" )
    75 }
    76 
    77 // #include files inside a namespace
    78 // David Engster <deng@randomsample.de>
    79 // See revisions 8034-8037 which implement this.
    80 
    81 namespace another {
    82   #include "testdoublens.hpp"
    83 }
    84 
    85 void foo(void) {
    86 
    87   another::// -3-
    88     ; // #3# ( "Name1" "a" "stage3_Foo" )
    89 
    90   another::Name1::Name2::Foo a;
    91 
    92   a.// -4-
    93     ; // #4# ( "Mumble" "get" )
    94 }
    95 
    96 // What happens if a type your looking for is scoped within a type,
    97 // but you are one level into the completion so the originating scope
    98 // excludes the type of the variable you are completing through?
    99 // Thanks Martin Stein for this nice example.
   100 
   101 namespace ms_structs
   102 {
   103    struct ms_aaa
   104    {
   105      int xx;
   106    };
   107 
   108    struct ms_bbb
   109    {
   110      struct ms_aaa yy;
   111    };
   112 };
   113 
   114 int fun()
   115 {
   116    using namespace ms_structs;
   117    struct ms_bbb mszz;
   118    int uu = mszz.// -5-
   119      ; // #5# ( "yy" )
   120    int kk = mszz.yy.// - 6-  @TODO - bring in patch from SF
   121      ; // #6# ( "xx" )
   122 }

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