1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ADC_DISPLAY_ARYATTRS_HXX
25 #define ADC_DISPLAY_ARYATTRS_HXX
26 
27 // USED SERVICES
28 #include <ary/cpp/c_types4cpp.hxx>
29 #include <ary/doc/d_docu.hxx>
30 #include <ary/doc/d_oldcppdocu.hxx>
31 
32 namespace ary
33 {
34  	namespace cpp
35     {
36         class CodeEntity;
37         class Class;
38         class DisplayGate;
39         class Function;
40         class Namespace;
41     }
42 }
43 
44 
45 
46 
47 const char *        Get_ClassTypeKey(
48                         const ary::cpp::Class & i_rClass );
49 const char *        Get_TypeKey(
50                         const ary::cpp::CodeEntity &
51                                                 i_rCe );
52 bool                Ce_IsInternal(
53                         const ary::cpp::CodeEntity &
54                                                 i_rCe );
55 const char *        SyntaxText_PreName(
56                         const ary::cpp::Function &
57                                                 i_rFunction,
58                         const ary::cpp::Gate &  i_rAryGate );
59 const char *        SyntaxText_PostName(
60                         const ary::cpp::Function &
61                                                 i_rFunction,
62                         const ary::cpp::Gate &  i_rAryGate );
63 
64 bool                Get_TypeText(
65                         const char * &          o_rPreName,
66                         const char * &          o_rName,
67                         const char * &          o_rPostName,
68                         ary::cpp::Type_id       i_nTypeid,
69                         const ary::cpp::Gate &  i_rAryGate );
70 
71 
72 inline const ary::doc::OldCppDocu *
Get_CppDocu(const ary::doc::Documentation & i_doc)73 Get_CppDocu(const ary::doc::Documentation & i_doc)
74 {
75     return dynamic_cast< const ary::doc::OldCppDocu* >(i_doc.Data());
76 }
77 
78 
79 class FunctionParam_Iterator
80 {
81   public:
82                     FunctionParam_Iterator();
83                     ~FunctionParam_Iterator();
84 
85                     operator bool() const;
86     FunctionParam_Iterator &
87                     operator++();
88 
89     void            Assign(
90                         const ary::cpp::Function &
91                                                 i_rFunction );
92 
93     ary::cpp::Type_id
94                     CurType() const;
95     const String  & CurName() const;
96 
97     bool            IsFunctionConst() const;
98     bool            IsFunctionVolatile() const;
99 
100   private:
101     typedef std::vector<ary::cpp::Type_id>::const_iterator  Type_Iterator;
102     typedef StringVector::const_iterator                    Name_Iterator;
103 
104     bool                IsValid() const;
105 
106     // Forbidden
107     FunctionParam_Iterator &
108                     operator++(int);
109     // DATA
110     Type_Iterator       itTypes;
111     Type_Iterator       itTypes_end;
112     Name_Iterator       itNames_andMore;        /// Name, init-value.
113     Name_Iterator       itNames_andMore_end;
114 
115     ary::cpp::E_ConVol  eConVol;
116 };
117 
118 
119 
120 
121 // IMPLEMENTATION
122 inline
123 FunctionParam_Iterator::operator bool() const
124     { return IsValid(); }
125 
126 inline bool
IsValid() const127 FunctionParam_Iterator::IsValid() const
128 {
129     // By C'tor and Assign(), it is assured, that
130     //   both iterators are valid, if one is valid.
131     return itTypes != itTypes_end;
132 }
133 
134 inline ary::cpp::Type_id
CurType() const135 FunctionParam_Iterator::CurType() const
136     { return IsValid() ? *itTypes : ary::cpp::Type_id(0); }
137 inline const String  &
CurName() const138 FunctionParam_Iterator::CurName() const
139     { return IsValid() ? *itNames_andMore : String::Null_(); }
140 inline bool
IsFunctionConst() const141 FunctionParam_Iterator::IsFunctionConst() const
142     { return (eConVol & ary::cpp::CONVOL_const) != 0; }
143 inline bool
IsFunctionVolatile() const144 FunctionParam_Iterator::IsFunctionVolatile() const
145     { return (eConVol & ary::cpp::CONVOL_volatile) != 0; }
146 
147 
148 
149 
150 #endif
151