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