merge the formfield patch from ooo-build
[ooovba.git] / autodoc / inc / ary / cpp / usedtype.hxx
blobcc8c7d69820e6377fe78d451518f134e34186776
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: usedtype.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef ARY_CPP_USEDTYPE_HXX
32 #define ARY_CPP_USEDTYPE_HXX
34 // USED SERVICES
35 // BASE CLASSES
36 #include <ary/cpp/c_type.hxx>
37 // OTHER
38 #include <ary/cpp/namechain.hxx>
40 namespace ary
42 namespace cpp
44 class CePilot;
46 namespace ut
48 class List_TplParameter;
56 namespace ary
58 namespace cpp
62 /** This class represents a type in textual form, like it is parsed out of
63 source code as a variable type or function return type.
65 class UsedType : public Type
67 public:
68 enum E_ClassId { class_id = 1203 };
70 explicit UsedType(
71 Ce_id i_scope );
72 ~UsedType();
73 // OPERATORS
74 bool operator<(
75 const UsedType & i_rType ) const;
76 // OPERATIONS
78 // Operations to build up the used type from parsing:
79 void Set_Absolute(); /// "::" is in front.
80 void Add_NameSegment(
81 const char * i_sSeg );
82 ut::List_TplParameter &
83 Enter_Template();
84 void Set_Unsigned();
85 void Set_Signed();
86 void Set_BuiltIn(
87 const char * i_sType );
88 void Set_Const(); /// Sets CV to the type or the present pointer level, whatever is highest.
89 void Set_Volatile(); /// Sets CV to the type or the present pointer level, whatever is highest.
90 void Add_PtrLevel(); /// For an '*'.
91 void Set_Reference(); /// For an '&'.
93 // Operations to find the relating CodeEntity:
94 /** This needs to be called only one time. After that
95 RelatedCe() will return the value.
97 When connectiing all parsed types, there are three steps:
98 1. Find related types in the same scope and namespaces above.
99 2. Then all classes can be connected to their base classes.
100 3. Lastly types can be connected to Ces only known via their base
101 classes. This is not possible at step 1.
103 @see Connect2CeOnlyKnownViaBaseClass()
105 void Connect2Ce(
106 const CePilot & i_ces );
108 /** @see Connect2Ce()
110 void Connect2CeOnlyKnownViaBaseClass(
111 const Gate & i_gate );
113 // INQUIRY
114 /** @return True, if type consists of one built-in typename and
115 nothing else.
117 bool IsBuiltInType() const;
118 /** @return the full local name, including template instantiation, but without
119 '*','&' or modifiers.
121 const String & LocalName() const;
122 E_TypeSpecialisation
123 TypeSpecialisation() const;
125 private:
126 // Interface csv::ConstProcessorClient
127 virtual void do_Accept(
128 csv::ProcessorIfc & io_processor ) const;
130 // Interface ary::Object:
131 virtual ClassId get_AryClass() const;
133 // Interface ary::cpp::Type:
134 virtual Rid inq_RelatedCe() const;
135 virtual bool inq_IsConst() const;
136 virtual void inq_Get_Text(
137 StreamStr & o_rPreName,
138 StreamStr & o_rName,
139 StreamStr & o_rPostName,
140 const ary::cpp::Gate &
141 i_rGate ) const;
142 // Local
143 typedef std::vector< ary::cpp::E_ConVol > PtrLevelVector;
145 uintt PtrLevel() const { return uintt(aPtrLevels.size()); }
146 Ce_id RecursiveSearchCe_InBaseClassesOf(
147 const CodeEntity & i_mayBeClass,
148 const StringVector &
149 i_myQualification,
150 const String & i_myName,
151 const Gate & i_gate ) const;
152 void Get_NameParts(
153 StringVector & o_qualification,
154 String & o_name );
156 // Forbidden functions
157 UsedType(
158 const UsedType & i_rType );
159 bool operator=(
160 const UsedType & i_rType );
162 // DATA
163 ut::NameChain aPath;
164 PtrLevelVector aPtrLevels;
165 ary::cpp::E_ConVol eConVol_Type;
166 bool bIsReference;
167 bool bIsAbsolute;
168 bool bRefers2BuiltInType;
169 E_TypeSpecialisation
170 eTypeSpecialisation;
171 Ce_id nRelatedCe;
173 /// Namespace or class scope where the type occurred.
174 Ce_id nScope;
178 namespace ut
180 class TemplateParameter;
182 class List_TplParameter
184 public:
185 typedef std::vector< DYN TemplateParameter * >::const_iterator const_iterator;
187 List_TplParameter();
188 ~List_TplParameter();
190 void AddParam_Type(
191 Type_id i_nType );
192 /// puts "< " TemplateArgumentList " >" to o_rOut.
193 void Get_Text(
194 StreamStr & o_rOut,
195 const ary::cpp::Gate &
196 i_rGate ) const;
197 /// @return as strcmp().
198 intt Compare(
199 const List_TplParameter &
200 i_rOther ) const;
202 private:
203 typedef std::vector< DYN TemplateParameter * > Vector_TplArgument;
205 Vector_TplArgument aTplParameters;
208 } // namespace ut
213 } // namespace cpp
214 } // namespace ary
215 #endif