xref: /aoo41x/main/autodoc/inc/ary/cpp/c_vfflag.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 
28 #ifndef ARY_CPP_C_VFFLAG_HXX
29 #define ARY_CPP_C_VFFLAG_HXX
30 
31 // USED SERVICES
32 
33 
34 namespace ary
35 {
36 namespace cpp
37 {
38 
39 
40 /** Properties of C++ variables.
41 */
42 struct VariableFlags
43 {
44   public:
45 	enum E_Flags
46 	{
47 		f_static_local 		= 0x0001,
48 		f_static_member 	= 0x0002,
49 		f_extern 			= 0x0004,
50 		f_mutable			= 0x0008
51 	};
52 
53                         VariableFlags(
54                             UINT16              i_nFlags = 0 )
55                                                 :   nFlags(i_nFlags) {}
56 
57     void                Reset()                 { nFlags = 0; }
58 
59 	void 				SetStaticLocal()		{ nFlags |= f_static_local; }
60 	void 				SetStaticMember()		{ nFlags |= f_static_member; }
61 	void 				SetExtern() 	  		{ nFlags |= f_extern; }
62 	void 				SetMutable() 			{ nFlags |= f_mutable; }
63 
64 	bool 				IsStaticLocal()	const	{ return (nFlags & f_static_local) != 0; }
65 	bool 				IsStaticMember() const	{ return (nFlags & f_static_member) != 0; }
66 	bool 				IsExtern() const  		{ return (nFlags & f_extern) != 0; }
67 	bool 				IsMutable() const		{ return (nFlags & f_mutable) != 0; }
68 
69   private:
70     UINT16              nFlags;
71 };
72 
73 
74 /** Properties of C++ functions.
75 */
76 struct FunctionFlags
77 {
78   public:
79 	enum E_Flags
80 	{
81 		f_static_local 		= 0x0001,
82 		f_static_member 	= 0x0002,
83 		f_extern 			= 0x0004,
84 		f_externC 			= 0x0008,
85 		f_mutable			= 0x0010,
86 		f_inline 	        = 0x0100,
87 		f_register		 	= 0x0200,
88 		f_explicit			= 0x0400
89 	};
90 
91                         FunctionFlags(
92                             UINT16              i_nFlags = 0 )
93                                                 :   nFlags(i_nFlags) {}
94 
95     bool                operator==(
96                             const FunctionFlags &
97                                                 i_ff ) const
98                                                 { return nFlags == i_ff.nFlags; }
99     bool                operator!=(
100                             const FunctionFlags &
101                                                 i_ff ) const
102                                                 { return NOT operator==(i_ff); }
103 
104     void                Reset()                 { nFlags = 0; }
105 
106 	void 				SetStaticLocal()		{ nFlags |= f_static_local; }
107 	void 				SetStaticMember()		{ nFlags |= f_static_member; }
108 	void 				SetExtern() 	  		{ nFlags |= f_extern; }
109 	void 				SetExternC() 	  		{ nFlags |= f_externC; }
110 	void 				SetMutable() 			{ nFlags |= f_mutable; }
111 	void 				SetInline() 	  	    { nFlags |= f_inline; }
112 	void 				SetRegister() 			{ nFlags |= f_register; }
113 	void 				SetExplicit() 		    { nFlags |= f_explicit; }
114 
115 	bool 				IsStaticLocal()	const	{ return (nFlags & f_static_local) != 0; }
116 	bool 				IsStaticMember() const	{ return (nFlags & f_static_member) != 0; }
117 	bool 				IsExtern() const  		{ return (nFlags & f_extern) != 0; }
118 	bool 				IsExternC() const  		{ return (nFlags & f_externC) != 0; }
119 	bool 				IsMutable() const		{ return (nFlags & f_mutable) != 0; }
120 	bool 				IsInline() const  	    { return (nFlags & f_inline) != 0; }
121 	bool 				IsRegister() const		{ return (nFlags & f_register) != 0; }
122 	bool                IsExplicit() const      { return (nFlags & f_explicit) != 0; }
123 
124   private:
125     UINT16              nFlags;
126 };
127 
128 
129 /** A C++ function parameter.
130 */
131 struct S_Parameter
132 {
133     String              sName;
134     String              sSizeExpression;
135     String              sInitExpression;
136     Type_id             nType;
137 
138                         S_Parameter()           : nType(0) {}
139                         ~S_Parameter()          {}
140     void                Empty()                 { nType = Type_id(0);
141                                                   sName.clear();
142                                                   sSizeExpression.clear();
143                                                   sInitExpression.clear(); }
144 };
145 
146 
147 
148 
149 }   // namespace cpp
150 }   // namespace ary
151 #endif
152