xref: /aoo4110/main/autodoc/inc/ary/idl/i_interface.hxx (revision b1cdbd2c)
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 ARY_IDL_I_INTERFACE_HXX
25 #define ARY_IDL_I_INTERFACE_HXX
26 
27 // BASE CLASSES
28 #include <ary/idl/i_ce.hxx>
29 
30 // USED SERVICES
31 #include <ary/idl/i_comrela.hxx>
32 #include <ary/stdconstiter.hxx>
33 
34 
35 
36 
37 namespace ary
38 {
39 namespace idl
40 {
41 namespace ifc_interface
42 {
43     struct attr;
44 }
45     class Interface_2s;
46 
47 
48 /** Represents an IDL interface.
49 */
50 class Interface : public CodeEntity
51 {
52   public:
53     enum E_ClassId { class_id = 2001 };
54 
55     // LIFECYCLE
56                         Interface(
57                             const String &      i_sName,
58                             Ce_id               i_nOwner );
59                         ~Interface();
60     // INQUIRY
61     bool                HasBase() const;
62 
63     // ACCESS
64     void                Add_Function(
65                             Ce_id               i_nId );
66     void                Add_Attribute(
67                             Ce_id               i_nId );
68     void                Add_Base(
69                             Type_id             i_nInterface,
70                             DYN doc::OldIdlDocu *
71                                                 pass_dpDocu );
72 
73   private:
74     // Interface csv::ConstProcessorClient:
75     virtual void        do_Accept(
76                             csv::ProcessorIfc & io_processor ) const;
77     // Interface ary::Object:
78     virtual ClassId     get_AryClass() const;
79 
80     // Interface CodeEntity:
81     virtual const String &  inq_LocalName() const;
82     virtual Ce_id           inq_NameRoom() const;
83     virtual Ce_id           inq_Owner() const;
84     virtual E_SightLevel    inq_SightLevel() const;
85 
86     // Local
87     typedef std::vector< CommentedRelation >    RelationList;
88     typedef std::vector<Ce_id>                  MemberList;
89     friend struct ifc_interface::attr;
90 
91     // DATA
92     String              sName;
93     Ce_id               nOwner;
94     RelationList        aBases;
95     MemberList          aFunctions;
96     MemberList          aAttributes;
97     Dyn<Interface_2s>   p2s;
98 };
99 
100 
101 
102 
103 // IMPLEMENTATION
104 inline bool
HasBase() const105 Interface::HasBase() const
106     { return aBases.size() > 0; }
107 inline void
Add_Function(Ce_id i_nId)108 Interface::Add_Function( Ce_id i_nId )
109     { aFunctions.push_back(i_nId); }
110 inline void
Add_Attribute(Ce_id i_nId)111 Interface::Add_Attribute( Ce_id i_nId )
112     { aAttributes.push_back(i_nId); }
113 inline void
Add_Base(Type_id i_nInterface,DYN doc::OldIdlDocu * pass_dpDocu)114 Interface::Add_Base( Type_id                i_nInterface,
115                      DYN doc::OldIdlDocu *  pass_dpDocu )
116     { aBases.push_back( CommentedRelation(i_nInterface, pass_dpDocu) ); }
117 
118 
119 
120 
121 }   // namespace idl
122 }   // namespace ary
123 #endif
124