xref: /aoo42x/main/idlc/inc/idlc/fehelper.hxx (revision f04bd1c4)
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 #ifndef _IDLC_FEHELPER_HXX_
24 #define _IDLC_FEHELPER_HXX_
25 
26 #include <idlc/asttype.hxx>
27 #include <idlc/astinterface.hxx>
28 
29 #include <vector>
30 
31 class FeDeclarator
32 {
33 public:
34 	// Enum to denote types of declarators
35 	enum DeclaratorType
36 	{
37 		FD_simple,		// Simple declarator
38 		FD_complex		// Complex declarator (complex_part field used)
39 	};
40 
41 	FeDeclarator(const ::rtl::OString& name, DeclaratorType declType, AstDeclaration* pComplPart);
42 	virtual ~FeDeclarator();
43 
getComplexPart()44 	AstDeclaration* getComplexPart()
45 		{ return m_pComplexPart; }
getName()46 	const ::rtl::OString& getName()
47 		{ return m_name; }
getDeclType()48 	DeclaratorType	getDeclType()
49 		{ return m_declType; }
50 
51     sal_Bool checkType(AstDeclaration const * pType);
52     AstType const * compose(AstDeclaration const * pDecl);
53 private:
54 	AstDeclaration* m_pComplexPart;
55 	::rtl::OString  m_name;
56 	DeclaratorType	m_declType;
57 };
58 
59 typedef ::std::list< FeDeclarator* > FeDeclList;
60 
61 class FeInheritanceHeader
62 {
63 public:
64 	FeInheritanceHeader(
65         NodeType nodeType, ::rtl::OString* pName, ::rtl::OString* pInherits,
66         std::vector< rtl::OString > * typeParameters);
67 
~FeInheritanceHeader()68 	virtual ~FeInheritanceHeader()
69 	{
70 		if ( m_pName )
71 			delete m_pName;
72  	}
73 
getNodeType()74 	NodeType getNodeType()
75 		{ return m_nodeType; }
getName()76 	::rtl::OString* getName()
77 		{ return m_pName; }
getInherits()78 	AstDeclaration* getInherits()
79 		{ return m_pInherits; }
80 
getTypeParameters() const81     std::vector< rtl::OString > const & getTypeParameters() const
82     { return m_typeParameters; }
83 
84 private:
85     void initializeInherits(::rtl::OString* pinherits);
86 
87 	NodeType		m_nodeType;
88 	::rtl::OString*	m_pName;
89 	AstDeclaration* m_pInherits;
90     std::vector< rtl::OString > m_typeParameters;
91 };
92 
93 #endif // _IDLC_FEHELPER_HXX_
94 
95