xref: /trunk/main/idl/inc/attrib.hxx (revision f3ea6674)
1*f3ea6674SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f3ea6674SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f3ea6674SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f3ea6674SAndrew Rist  * distributed with this work for additional information
6*f3ea6674SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f3ea6674SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f3ea6674SAndrew Rist  * "License"); you may not use this file except in compliance
9*f3ea6674SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f3ea6674SAndrew Rist  *
11*f3ea6674SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f3ea6674SAndrew Rist  *
13*f3ea6674SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f3ea6674SAndrew Rist  * software distributed under the License is distributed on an
15*f3ea6674SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f3ea6674SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f3ea6674SAndrew Rist  * specific language governing permissions and limitations
18*f3ea6674SAndrew Rist  * under the License.
19*f3ea6674SAndrew Rist  *
20*f3ea6674SAndrew Rist  *************************************************************/
21*f3ea6674SAndrew Rist 
22*f3ea6674SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _ATTRIB_HXX
25cdf0e10cSrcweir #define _ATTRIB_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifdef IDL_COMPILER
28cdf0e10cSrcweir #include <hash.hxx>
29cdf0e10cSrcweir #include <object.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir /******************** class SvAttribute **********************************/
32cdf0e10cSrcweir class SvAttribute
33cdf0e10cSrcweir {
34cdf0e10cSrcweir     SvStringHashEntryRef    aName;
35cdf0e10cSrcweir     CreateMetaObjectType    pCreateMethod;
36cdf0e10cSrcweir     SvMetaObjectRef         aTmpClass;
37cdf0e10cSrcweir public:
SvAttribute(SvStringHashEntry * pAttribName,CreateMetaObjectType pMethod)38cdf0e10cSrcweir                         SvAttribute( SvStringHashEntry * pAttribName,
39cdf0e10cSrcweir                                      CreateMetaObjectType pMethod )
40cdf0e10cSrcweir                             : aName( pAttribName ),
41cdf0e10cSrcweir                               pCreateMethod( pMethod ) {}
42cdf0e10cSrcweir 
CreateClass()43cdf0e10cSrcweir     SvMetaObjectRef     CreateClass()
44cdf0e10cSrcweir                         {
45cdf0e10cSrcweir                             if( aTmpClass.Is() )
46cdf0e10cSrcweir                             {
47cdf0e10cSrcweir                                 SvMetaObjectRef aTmp( aTmpClass );
48cdf0e10cSrcweir                                 aTmpClass.Clear();
49cdf0e10cSrcweir                                 return aTmp;
50cdf0e10cSrcweir                             }
51cdf0e10cSrcweir                             return pCreateMethod();
52cdf0e10cSrcweir                         }
53cdf0e10cSrcweir };
54cdf0e10cSrcweir 
55cdf0e10cSrcweir #define SV_ATTRIBUTE( AttributeName, PostfixClassName )                 \
56cdf0e10cSrcweir         SvAttribute( SvHash_##AttributeName(),                          \
57cdf0e10cSrcweir                      SvMeta##PostfixClassName::Create )
58cdf0e10cSrcweir 
59cdf0e10cSrcweir /******************** class SvAttributeList ******************************/
60cdf0e10cSrcweir DECLARE_LIST(SvAttributeListImpl,SvAttribute*)
61cdf0e10cSrcweir class SvAttributeList : public SvAttributeListImpl
62cdf0e10cSrcweir {
63cdf0e10cSrcweir public:
SvAttributeList()64cdf0e10cSrcweir             SvAttributeList() : SvAttributeListImpl() {}
65cdf0e10cSrcweir 
Append(SvAttribute * pObj)66cdf0e10cSrcweir     void    Append( SvAttribute * pObj )
67cdf0e10cSrcweir             { Insert( pObj, LIST_APPEND ); }
68cdf0e10cSrcweir };
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir #endif // IDL_COMPILER
72cdf0e10cSrcweir #endif // _ATTRIB_HXX
73cdf0e10cSrcweir 
74