xref: /aoo42x/main/idlc/inc/idlc/fehelper.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _IDLC_FEHELPER_HXX_
28 #define _IDLC_FEHELPER_HXX_
29 
30 #include <idlc/asttype.hxx>
31 #include <idlc/astinterface.hxx>
32 
33 #include <vector>
34 
35 class FeDeclarator
36 {
37 public:
38 	// Enum to denote types of declarators
39 	enum DeclaratorType
40 	{
41 		FD_simple,		// Simple declarator
42 		FD_complex		// Complex declarator (complex_part field used)
43 	};
44 
45 	FeDeclarator(const ::rtl::OString& name, DeclaratorType declType, AstDeclaration* pComplPart);
46 	virtual ~FeDeclarator();
47 
48 	AstDeclaration* getComplexPart()
49 		{ return m_pComplexPart; }
50 	const ::rtl::OString& getName()
51 		{ return m_name; }
52 	DeclaratorType	getDeclType()
53 		{ return m_declType; }
54 
55     sal_Bool checkType(AstDeclaration const * pType);
56     AstType const * compose(AstDeclaration const * pDecl);
57 private:
58 	AstDeclaration* m_pComplexPart;
59 	::rtl::OString  m_name;
60 	DeclaratorType	m_declType;
61 };
62 
63 typedef ::std::list< FeDeclarator* > FeDeclList;
64 
65 class FeInheritanceHeader
66 {
67 public:
68 	FeInheritanceHeader(
69         NodeType nodeType, ::rtl::OString* pName, ::rtl::OString* pInherits,
70         std::vector< rtl::OString > * typeParameters);
71 
72 	virtual ~FeInheritanceHeader()
73 	{
74 		if ( m_pName )
75 			delete m_pName;
76  	}
77 
78 	NodeType getNodeType()
79 		{ return m_nodeType; }
80 	::rtl::OString* getName()
81 		{ return m_pName; }
82 	AstDeclaration* getInherits()
83 		{ return m_pInherits; }
84 
85     std::vector< rtl::OString > const & getTypeParameters() const
86     { return m_typeParameters; }
87 
88 private:
89     void initializeInherits(::rtl::OString* pinherits);
90 
91 	NodeType		m_nodeType;
92 	::rtl::OString*	m_pName;
93 	AstDeclaration* m_pInherits;
94     std::vector< rtl::OString > m_typeParameters;
95 };
96 
97 #endif // _IDLC_FEHELPER_HXX_
98 
99