1 mike 1.1 //BEGIN_LICENSE
2 //
3 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
11 //
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 // DEALINGS IN THE SOFTWARE.
19 //
20 //END_LICENSE
21 //BEGIN_HISTORY
22 mike 1.1 //
23 // Author:
24 //
25 // $Log$
26 //
27 //END_HISTORY
28
29 ////////////////////////////////////////////////////////////////////////////////
30 //
31 // DeclContext.h
32 //
33 // This class is used internally as a source of CIM declarations.
34 // It is passed to the _resolve() method of several classes (ClassDecl,
35 // Method, Property, Reference, Qualifier). Methods are provided for
36 // looking up class, qualifier, and instance declarations. This is
37 // an abstract base class: implementations must be provided by derived
38 // classes.
39 //
40 ////////////////////////////////////////////////////////////////////////////////
41
42 #ifndef Pegasus_DeclContext_h
43 mike 1.1 #define Pegasus_DeclContext_h
44
45 #include <Pegasus/Common/Config.h>
46 #include <Pegasus/Common/Array.h>
47 #include <Pegasus/Common/ClassDecl.h>
48 #include <Pegasus/Common/QualifierDecl.h>
49
50 PEGASUS_NAMESPACE_BEGIN
51
52 class PEGASUS_COMMON_LINKAGE DeclContext
53 {
54 public:
55
56 virtual ~DeclContext();
57
58 virtual QualifierDecl lookupQualifierDecl(
59 const String& nameSpace,
60 const String& name) const = 0;
61
62 virtual ClassDecl lookupClassDecl(
63 const String& nameSpace,
64 mike 1.1 const String& name) const = 0;
65 };
66
67 class PEGASUS_COMMON_LINKAGE SimpleDeclContext : public DeclContext
68 {
69 public:
70
71 virtual ~SimpleDeclContext();
72
73 void addQualifierDecl(
74 const String& nameSpace,
75 const QualifierDecl& x);
76
77 void addClassDecl(
78 const String& nameSpace,
79 const ClassDecl& x);
80
81 virtual QualifierDecl lookupQualifierDecl(
82 const String& nameSpace,
83 const String& name) const;
84
85 mike 1.1 virtual ClassDecl lookupClassDecl(
86 const String& nameSpace,
87 const String& name) const;
88
89 private:
90
91 typedef Pair<String, ClassDecl> CPair;
92 typedef Pair<String, QualifierDecl> QPair;
93
94 Array<CPair> _classDeclarations;
95 Array<QPair> _qualifierDeclarations;
96 };
97
98 PEGASUS_NAMESPACE_END
99
100 #endif /* Pegasus_DeclContext_h */
|