xref: /aoo42x/main/idlc/inc/idlc/fehelper.hxx (revision f04bd1c4)
1*f04bd1c4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f04bd1c4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f04bd1c4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f04bd1c4SAndrew Rist  * distributed with this work for additional information
6*f04bd1c4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f04bd1c4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f04bd1c4SAndrew Rist  * "License"); you may not use this file except in compliance
9*f04bd1c4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f04bd1c4SAndrew Rist  *
11*f04bd1c4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f04bd1c4SAndrew Rist  *
13*f04bd1c4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f04bd1c4SAndrew Rist  * software distributed under the License is distributed on an
15*f04bd1c4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f04bd1c4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f04bd1c4SAndrew Rist  * specific language governing permissions and limitations
18*f04bd1c4SAndrew Rist  * under the License.
19*f04bd1c4SAndrew Rist  *
20*f04bd1c4SAndrew Rist  *************************************************************/
21*f04bd1c4SAndrew Rist 
22*f04bd1c4SAndrew Rist 
23cdf0e10cSrcweir #ifndef _IDLC_FEHELPER_HXX_
24cdf0e10cSrcweir #define _IDLC_FEHELPER_HXX_
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <idlc/asttype.hxx>
27cdf0e10cSrcweir #include <idlc/astinterface.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <vector>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir class FeDeclarator
32cdf0e10cSrcweir {
33cdf0e10cSrcweir public:
34cdf0e10cSrcweir 	// Enum to denote types of declarators
35cdf0e10cSrcweir 	enum DeclaratorType
36cdf0e10cSrcweir 	{
37cdf0e10cSrcweir 		FD_simple,		// Simple declarator
38cdf0e10cSrcweir 		FD_complex		// Complex declarator (complex_part field used)
39cdf0e10cSrcweir 	};
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 	FeDeclarator(const ::rtl::OString& name, DeclaratorType declType, AstDeclaration* pComplPart);
42cdf0e10cSrcweir 	virtual ~FeDeclarator();
43cdf0e10cSrcweir 
getComplexPart()44cdf0e10cSrcweir 	AstDeclaration* getComplexPart()
45cdf0e10cSrcweir 		{ return m_pComplexPart; }
getName()46cdf0e10cSrcweir 	const ::rtl::OString& getName()
47cdf0e10cSrcweir 		{ return m_name; }
getDeclType()48cdf0e10cSrcweir 	DeclaratorType	getDeclType()
49cdf0e10cSrcweir 		{ return m_declType; }
50cdf0e10cSrcweir 
51cdf0e10cSrcweir     sal_Bool checkType(AstDeclaration const * pType);
52cdf0e10cSrcweir     AstType const * compose(AstDeclaration const * pDecl);
53cdf0e10cSrcweir private:
54cdf0e10cSrcweir 	AstDeclaration* m_pComplexPart;
55cdf0e10cSrcweir 	::rtl::OString  m_name;
56cdf0e10cSrcweir 	DeclaratorType	m_declType;
57cdf0e10cSrcweir };
58cdf0e10cSrcweir 
59cdf0e10cSrcweir typedef ::std::list< FeDeclarator* > FeDeclList;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir class FeInheritanceHeader
62cdf0e10cSrcweir {
63cdf0e10cSrcweir public:
64cdf0e10cSrcweir 	FeInheritanceHeader(
65cdf0e10cSrcweir         NodeType nodeType, ::rtl::OString* pName, ::rtl::OString* pInherits,
66cdf0e10cSrcweir         std::vector< rtl::OString > * typeParameters);
67cdf0e10cSrcweir 
~FeInheritanceHeader()68cdf0e10cSrcweir 	virtual ~FeInheritanceHeader()
69cdf0e10cSrcweir 	{
70cdf0e10cSrcweir 		if ( m_pName )
71cdf0e10cSrcweir 			delete m_pName;
72cdf0e10cSrcweir  	}
73cdf0e10cSrcweir 
getNodeType()74cdf0e10cSrcweir 	NodeType getNodeType()
75cdf0e10cSrcweir 		{ return m_nodeType; }
getName()76cdf0e10cSrcweir 	::rtl::OString* getName()
77cdf0e10cSrcweir 		{ return m_pName; }
getInherits()78cdf0e10cSrcweir 	AstDeclaration* getInherits()
79cdf0e10cSrcweir 		{ return m_pInherits; }
80cdf0e10cSrcweir 
getTypeParameters() const81cdf0e10cSrcweir     std::vector< rtl::OString > const & getTypeParameters() const
82cdf0e10cSrcweir     { return m_typeParameters; }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir private:
85cdf0e10cSrcweir     void initializeInherits(::rtl::OString* pinherits);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	NodeType		m_nodeType;
88cdf0e10cSrcweir 	::rtl::OString*	m_pName;
89cdf0e10cSrcweir 	AstDeclaration* m_pInherits;
90cdf0e10cSrcweir     std::vector< rtl::OString > m_typeParameters;
91cdf0e10cSrcweir };
92cdf0e10cSrcweir 
93cdf0e10cSrcweir #endif // _IDLC_FEHELPER_HXX_
94cdf0e10cSrcweir 
95