1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: usedtype.hxx,v $
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
36 #include <ary/cpp/c_type.hxx>
38 #include <ary/cpp/namechain.hxx>
48 class List_TplParameter
;
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
68 enum E_ClassId
{ class_id
= 1203 };
75 const UsedType
& i_rType
) const;
78 // Operations to build up the used type from parsing:
79 void Set_Absolute(); /// "::" is in front.
81 const char * i_sSeg
);
82 ut::List_TplParameter
&
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()
106 const CePilot
& i_ces
);
108 /** @see Connect2Ce()
110 void Connect2CeOnlyKnownViaBaseClass(
111 const Gate
& i_gate
);
114 /** @return True, if type consists of one built-in typename and
117 bool IsBuiltInType() const;
118 /** @return the full local name, including template instantiation, but without
119 '*','&' or modifiers.
121 const String
& LocalName() const;
123 TypeSpecialisation() const;
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
,
139 StreamStr
& o_rPostName
,
140 const ary::cpp::Gate
&
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
,
150 const String
& i_myName
,
151 const Gate
& i_gate
) const;
153 StringVector
& o_qualification
,
156 // Forbidden functions
158 const UsedType
& i_rType
);
160 const UsedType
& i_rType
);
164 PtrLevelVector aPtrLevels
;
165 ary::cpp::E_ConVol eConVol_Type
;
168 bool bRefers2BuiltInType
;
173 /// Namespace or class scope where the type occurred.
180 class TemplateParameter
;
182 class List_TplParameter
185 typedef std::vector
< DYN TemplateParameter
* >::const_iterator const_iterator
;
188 ~List_TplParameter();
192 /// puts "< " TemplateArgumentList " >" to o_rOut.
195 const ary::cpp::Gate
&
197 /// @return as strcmp().
199 const List_TplParameter
&
203 typedef std::vector
< DYN TemplateParameter
* > Vector_TplArgument
;
205 Vector_TplArgument aTplParameters
;