merge the formfield patch from ooo-build
[ooovba.git] / codemaker / source / idlmaker / idltype.hxx
blob0af2a0e2d99e6a6069dc4c8fa56f7efc83ada0ce
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: idltype.hxx,v $
10 * $Revision: 1.4 $
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 INCLUDED_CODEMAKER_SOURCE_IDLMAKER_IDLTYPE_HXX
32 #define INCLUDED_CODEMAKER_SOURCE_IDLMAKER_IDLTYPE_HXX
34 #include <codemaker/typemanager.hxx>
35 #include <codemaker/dependency.hxx>
37 enum BASETYPE
39 BT_INVALID,
40 BT_VOID,
41 BT_ANY,
42 BT_TYPE,
43 BT_BOOLEAN,
44 BT_CHAR,
45 BT_STRING,
46 BT_FLOAT,
47 BT_DOUBLE,
48 BT_OCTET,
49 BT_BYTE,
50 BT_SHORT,
51 BT_LONG,
52 BT_HYPER,
53 BT_UNSIGNED_SHORT,
54 BT_UNSIGNED_LONG,
55 BT_UNSIGNED_HYPER
59 enum IdlTypeDecl
61 CPPUTYPEDECL_ALLTYPES,
62 CPPUTYPEDECL_NOINTERFACES,
63 CPPUTYPEDECL_ONLYINTERFACES
64 };
66 class IdlOptions;
67 class FileStream;
69 class IdlType
71 public:
72 IdlType(TypeReader& typeReader,
73 const ::rtl::OString& typeName,
74 const TypeManager& typeMgr,
75 const TypeDependency& typeDependencies);
77 virtual ~IdlType();
79 virtual sal_Bool dump(IdlOptions* pOptions) throw( CannotDumpException );
80 virtual sal_Bool dumpDependedTypes(IdlOptions* pOptions) throw( CannotDumpException );
81 virtual sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException ) = 0;
83 virtual ::rtl::OString dumpHeaderDefine(FileStream& o, sal_Char* prefix );
84 virtual void dumpDefaultHIncludes(FileStream& o);
85 virtual void dumpInclude(FileStream& o, const ::rtl::OString& genTypeName, const ::rtl::OString& typeName, sal_Char* prefix );
87 virtual void dumpDepIncludes(FileStream& o, const ::rtl::OString& typeName, sal_Char* prefix);
89 virtual void dumpNameSpace(FileStream& o, sal_Bool bOpen = sal_True, sal_Bool bFull = sal_False, const ::rtl::OString& type="");
91 virtual void dumpType(FileStream& o, const ::rtl::OString& type)
92 throw( CannotDumpException );
93 ::rtl::OString getBaseType(const ::rtl::OString& type);
94 void dumpIdlGetType(FileStream& o, const ::rtl::OString& type, sal_Bool bDecl=sal_False, IdlTypeDecl eDeclFlag=CPPUTYPEDECL_ALLTYPES);
95 BASETYPE isBaseType(const ::rtl::OString& type);
97 void dumpConstantValue(FileStream& o, sal_uInt16 index);
99 virtual sal_uInt32 getMemberCount();
100 virtual sal_uInt32 getInheritedMemberCount();
102 void inc(sal_uInt32 num=4);
103 void dec(sal_uInt32 num=4);
104 ::rtl::OString indent();
105 ::rtl::OString indent(sal_uInt32 num);
106 protected:
107 virtual sal_uInt32 checkInheritedMemberCount(const TypeReader* pReader);
109 ::rtl::OString checkSpecialIdlType(const ::rtl::OString& type);
110 ::rtl::OString checkRealBaseType(const ::rtl::OString& type, sal_Bool bResolveTypeOnly = sal_False);
112 protected:
113 sal_uInt32 m_inheritedMemberCount;
115 sal_uInt32 m_indentLength;
116 ::rtl::OString m_typeName;
117 ::rtl::OString m_name;
118 TypeReader m_reader;
119 TypeManager& m_typeMgr;
120 TypeDependency m_dependencies;
123 class InterfaceType : public IdlType
125 public:
126 InterfaceType(TypeReader& typeReader,
127 const ::rtl::OString& typeName,
128 const TypeManager& typeMgr,
129 const TypeDependency& typeDependencies);
131 virtual ~InterfaceType();
133 sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
135 void dumpAttributes(FileStream& o);
136 void dumpMethods(FileStream& o);
138 sal_uInt32 getMemberCount();
139 sal_uInt32 getInheritedMemberCount();
141 protected:
142 sal_uInt32 checkInheritedMemberCount(const TypeReader* pReader);
144 protected:
145 sal_uInt32 m_inheritedMemberCount;
146 sal_Bool m_hasAttributes;
147 sal_Bool m_hasMethods;
150 class ModuleType : public IdlType
152 public:
153 ModuleType(TypeReader& typeReader,
154 const ::rtl::OString& typeName,
155 const TypeManager& typeMgr,
156 const TypeDependency& typeDependencies);
158 virtual ~ModuleType();
160 virtual sal_Bool dump(IdlOptions* pOptions) throw( CannotDumpException );
161 sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
162 sal_Bool hasConstants();
165 class ConstantsType : public ModuleType
167 public:
168 ConstantsType(TypeReader& typeReader,
169 const ::rtl::OString& typeName,
170 const TypeManager& typeMgr,
171 const TypeDependency& typeDependencies);
173 virtual ~ConstantsType();
175 virtual sal_Bool dump(IdlOptions* pOptions) throw( CannotDumpException );
178 class StructureType : public IdlType
180 public:
181 StructureType(TypeReader& typeReader,
182 const ::rtl::OString& typeName,
183 const TypeManager& typeMgr,
184 const TypeDependency& typeDependencies);
186 virtual ~StructureType();
188 sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
190 void dumpSuperMember(FileStream& o, const ::rtl::OString& super);
193 class ExceptionType : public IdlType
195 public:
196 ExceptionType(TypeReader& typeReader,
197 const ::rtl::OString& typeName,
198 const TypeManager& typeMgr,
199 const TypeDependency& typeDependencies);
201 virtual ~ExceptionType();
203 sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
205 void dumpSuperMember(FileStream& o, const ::rtl::OString& super);
208 class EnumType : public IdlType
210 public:
211 EnumType(TypeReader& typeReader,
212 const ::rtl::OString& typeName,
213 const TypeManager& typeMgr,
214 const TypeDependency& typeDependencies);
216 virtual ~EnumType();
218 sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
221 class TypeDefType : public IdlType
223 public:
224 TypeDefType(TypeReader& typeReader,
225 const ::rtl::OString& typeName,
226 const TypeManager& typeMgr,
227 const TypeDependency& typeDependencies);
229 virtual ~TypeDefType();
231 sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
235 sal_Bool produceType(const ::rtl::OString& typeName,
236 TypeManager& typeMgr,
237 TypeDependency& typeDependencies,
238 IdlOptions* pOptions)
239 throw( CannotDumpException );
242 * This function returns a C++ scoped name, represents the namespace
243 * scoping of this type, e.g. com:.sun::star::uno::XInterface. If the scope of
244 * the type is equal scope, the relativ name will be used.
246 ::rtl::OString scopedName(const ::rtl::OString& scope, const ::rtl::OString& type, sal_Bool bNoNameSpace = sal_False );
248 ::rtl::OString scope(const ::rtl::OString& scope, const ::rtl::OString& type );
251 #endif // INCLUDED_CODEMAKER_SOURCE_IDLMAKER_IDLTYPE_HXX