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: aryattrs.cxx,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 ************************************************************************/
32 #include "aryattrs.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/getncast.hxx>
37 #include <ary/cpp/c_class.hxx>
38 #include <ary/cpp/c_enum.hxx>
39 #include <ary/cpp/c_funct.hxx>
40 #include <ary/cpp/c_gate.hxx>
41 #include <ary/cpp/c_namesp.hxx>
42 #include <ary/cpp/cp_ce.hxx>
43 #include <ary/cpp/cp_type.hxx>
44 #include "strconst.hxx"
49 //******************** HtmlDisplay_Impl *********************//
52 Get_ClassTypeKey( const ary::cpp::Class
& i_rClass
)
54 return i_rClass
.ClassKey() == ary::cpp::CK_class
55 ? C_sHFTypeTitle_Class
56 : i_rClass
.ClassKey() == ary::cpp::CK_struct
57 ? C_sHFTypeTitle_Struct
58 : C_sHFTypeTitle_Union
;
63 Get_TypeKey( const ary::cpp::CodeEntity
& i_rCe
)
65 if ( ary::is_type
<ary::cpp::Class
>(i_rCe
) )
67 return Get_ClassTypeKey(
68 ary::ary_cast
<ary::cpp::Class
>(i_rCe
) );
70 if ( ary::is_type
<ary::cpp::Enum
>(i_rCe
) )
78 Ce_IsInternal( const ary::cpp::CodeEntity
& i_rCe
)
80 return NOT i_rCe
.IsVisible();
84 SyntaxText_PreName( const ary::cpp::Function
& i_rFunction
,
85 const ary::cpp::Gate
& i_rAryGate
)
87 static StreamStr
sResult( 150 );
91 const ary::cpp::FunctionFlags
& rFlags
= i_rFunction
.Flags();
92 if ( rFlags
.IsStaticLocal() OR rFlags
.IsStaticMember() )
94 if ( rFlags
.IsExplicit() )
95 sResult
<< "explicit ";
96 if ( rFlags
.IsMutable() )
97 sResult
<< "mutable ";
98 if ( i_rFunction
.Virtuality() != ary::cpp::VIRTUAL_none
)
99 sResult
<< "virtual ";
100 i_rAryGate
.Types().Get_TypeText( sResult
, i_rFunction
.ReturnType() );
103 return sResult
.c_str();
107 SyntaxText_PostName( const ary::cpp::Function
& i_rFunction
,
108 const ary::cpp::Gate
& i_rAryGate
)
110 static StreamStr
sResult( 850 );
113 // parameters and con_vol
114 i_rAryGate
.Ces().Get_SignatureText( sResult
, i_rFunction
.Signature(), &i_rFunction
.ParamInfos() );
117 const std::vector
< ary::cpp::Type_id
> *
118 pThrow
= i_rFunction
.Exceptions();
122 std::vector
< ary::cpp::Type_id
>::const_iterator
123 it
= pThrow
->begin();
124 std::vector
< ary::cpp::Type_id
>::const_iterator
125 it_end
= pThrow
->end();
129 sResult
<< " throw( ";
130 i_rAryGate
.Types().Get_TypeText(sResult
, *it
);
132 for ( ++it
; it
!= it_end
; ++it
)
135 i_rAryGate
.Types().Get_TypeText(sResult
, *it
);
141 sResult
<< " throw( )";
146 if ( i_rFunction
.Virtuality() == ary::cpp::VIRTUAL_abstract
)
152 return sResult
.c_str();
156 Get_TypeText( const char * & o_rPreName
,
157 const char * & o_rName
,
158 const char * & o_rPostName
,
159 ary::cpp::Type_id i_nTypeid
,
160 const ary::cpp::Gate
& i_rAryGate
)
162 static StreamStr
sResult_PreName(250);
163 static StreamStr
sResult_Name(250);
164 static StreamStr
sResult_PostName(250);
166 sResult_PreName
.seekp(0);
167 sResult_Name
.seekp(0);
168 sResult_PostName
.seekp(0);
170 bool ret
= i_rAryGate
.Types().Get_TypeText(
175 if ( sResult_PreName
.tellp() > 0 )
177 char cLast
= *( sResult_PreName
.c_str() + (sResult_PreName
.tellp() - 1) );
178 if (cLast
!= ':' AND cLast
!= ' ')
179 sResult_PreName
<< " ";
185 o_rPreName
= sResult_PreName
.c_str();
186 o_rName
= sResult_Name
.c_str();
187 o_rPostName
= sResult_PostName
.c_str();
191 o_rPreName
= o_rName
= o_rPostName
= "";
199 //********************* FunctionParam_Iterator *****************//
202 FunctionParam_Iterator::FunctionParam_Iterator()
206 // itNames_andMore_end
207 eConVol(ary::cpp::CONVOL_none
)
209 static std::vector
<ary::cpp::Type_id
> aTypesNull_
;
210 static StringVector aNamesNull_
;
212 itTypes
= itTypes_end
= aTypesNull_
.end();
213 itNames_andMore
= itNames_andMore_end
= aNamesNull_
.end();
216 FunctionParam_Iterator::~FunctionParam_Iterator()
220 FunctionParam_Iterator
&
221 FunctionParam_Iterator::operator++()
232 FunctionParam_Iterator::Assign( const ary::cpp::Function
& i_rFunction
)
234 const ary::cpp::OperationSignature
&
235 rSigna
= i_rFunction
.Signature();
237 const std::vector
<ary::cpp::Type_id
> &
238 rTypes
= rSigna
.Parameters();
240 rNames
= i_rFunction
.ParamInfos();
242 if ( rTypes
.size() != rNames
.size() OR rTypes
.size() == 0 )
245 itTypes
= rTypes
.begin();
246 itTypes_end
= rTypes
.end();
247 itNames_andMore
= rNames
.begin();
248 itNames_andMore_end
= rNames
.end();
250 eConVol
= rSigna
.ConVol();