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: dependency.hxx,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 ************************************************************************/
31 #ifndef _CODEMAKER_DEPENDENCY_HXX_
32 #define _CODEMAKER_DEPENDENCY_HXX_
35 #include <registry/registry.hxx>
36 #ifndef __REGISTRY_REFLREAD_HXX__
37 #include <registry/reflread.hxx>
39 #include <codemaker/typemanager.hxx>
40 #include <codemaker/global.hxx>
41 #include <osl/diagnose.h>
43 #define TYPEUSE_NORMAL 0x0001
44 #define TYPEUSE_SUPER 0x0002
45 #define TYPEUSE_MEMBER 0x0004
46 #define TYPEUSE_INPARAM 0x0008
47 #define TYPEUSE_OUTPARAM 0x0010
48 #define TYPEUSE_INOUTPARAM 0x0020
49 #define TYPEUSE_RETURN 0x0040
50 #define TYPEUSE_EXCEPTION 0x0080
51 #define TYPEUSE_SCOPE 0x0100
54 * Flag shows the state of the code generation. If the Flag is set
55 * the code for this type is generated.
57 #define CODEGEN_DEFAULT 0x0001
61 TypeUsing(const ::rtl::OString
& type
, sal_uInt16 use
)
66 ::rtl::OString m_type
;
69 sal_Bool
operator == (const TypeUsing
& typeUsing
) const
72 return m_type
== typeUsing
.m_type
&& m_use
== typeUsing
.m_use
;
78 sal_Bool
operator()(const TypeUsing
& tuse1
, const TypeUsing
& tuse2
) const
80 return (tuse1
.m_type
< tuse2
.m_type
);
84 typedef ::std::set
< TypeUsing
, LessTypeUsing
> TypeUsingSet
;
87 #if (defined( _MSC_VER ) && ( _MSC_VER < 1200 ))
88 typedef ::std::__hash_map__
97 typedef ::std::__hash_map__
106 typedef ::std::hash_map
114 typedef ::std::hash_map
124 struct TypeDependencyImpl
130 sal_Int32 m_refCount
;
131 DependencyMap m_dependencies
;
132 GenerationMap m_generatedTypes
;
141 TypeDependency( const TypeDependency
& value
)
142 : m_pImpl( value
.m_pImpl
)
147 TypeDependency
& operator = ( const TypeDependency
& value
)
150 m_pImpl
= value
.m_pImpl
;
155 sal_Bool
insert(const ::rtl::OString
& type
, const ::rtl::OString
& depend
, sal_uInt16
);
156 TypeUsingSet
getDependencies(const ::rtl::OString
& type
);
157 sal_Bool
hasDependencies(const ::rtl::OString
& type
);
159 void setGenerated(const ::rtl::OString
& type
, sal_uInt16 genFlag
=CODEGEN_DEFAULT
);
160 sal_Bool
isGenerated(const ::rtl::OString
& type
, sal_uInt16 genFlag
=CODEGEN_DEFAULT
);
162 sal_Int32
getSize() { return m_pImpl
->m_generatedTypes
.size(); }
168 TypeDependencyImpl
* m_pImpl
;
171 sal_Bool
checkTypeDependencies(TypeManager
& typeMgr
, TypeDependency
& dependencies
, const ::rtl::OString
& type
, sal_Bool bDepend
= sal_False
);
173 #endif // _CODEMAKER_DEPENDENCY_HXX_