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

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

DEFINITIONS

This source file includes following definitions.
  1. use_parser
  2. test1
  3. start
  4. main
  5. interface
  6. static_func
  7. implementation
  8. static_sub_func
  9. foo

     1 // teststruct.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 // Note: initially provided by Alex Ott.
    24 
    25 template <typename DerivedT>
    26 struct grammar {
    27 public:
    28   typedef grammar<DerivedT> self_t;
    29   typedef DerivedT const& embed_t;
    30   grammar() {}
    31   ~grammar() { }
    32   void use_parser() const { }
    33   void test1() { }
    34 };
    35 
    36 struct PDFbool_parser : public grammar<PDFbool_parser> {
    37   PDFbool_parser() {}
    38   template <typename scannerT> struct definition {
    39     typedef typename scannerT::iterator_t iterator_t;
    40     int top;
    41     definition(const PDFbool_parser& /*self*/) {
    42       return ;
    43     }
    44     const int start() const {
    45       return top;
    46     }
    47   };
    48 };
    49 
    50 int main(void) {
    51   PDFbool_parser PDFbool_p = PDFbool_parser();
    52   PDFbool_p.//-1-
    53     ;
    54   // #1# ("definition" "embed_t" "self_t" "test1" "use_parser")
    55 }
    56 
    57 // ----------------------------------------------------------------------
    58 
    59 template <class Derived> struct Base {
    60 public:
    61   void interface()
    62   {
    63     // ...
    64     static_cast<Derived*>(this)->implementation();
    65     // ...
    66   }
    67 
    68   static void static_func()
    69   {
    70     // ...
    71     Derived::static_sub_func();
    72     // ...
    73   }
    74 };
    75 
    76 struct Derived : Base<Derived> {
    77   void implementation() { }
    78   static void static_sub_func() { }
    79 };
    80 
    81 int foo () {
    82   Derived d;
    83   d.//-2-
    84     ;
    85   // #2# ("implementation" "interface" "static_func" "static_sub_func")
    86 }

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