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