(file) Return to compilerDeclContext.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Compiler

  1 martin 1.22 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.23 //
  3 martin 1.22 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.23 //
 10 martin 1.22 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.23 //
 17 martin 1.22 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.23 //
 20 martin 1.22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.23 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.23 //
 28 martin 1.22 //////////////////////////////////////////////////////////////////////////
 29 mike   1.4  //
 30 bob    1.5  //%////////////////////////////////////////////////////////////////////////////
 31 mike   1.4  
 32             
 33             #include "compilerDeclContext.h"
 34             
 35 kumpf  1.16 PEGASUS_NAMESPACE_BEGIN
 36             
 37 dmitry.mikulin 1.21 compilerDeclContext::compilerDeclContext(compilerCommonDefs::operationType ot):
 38                         _ot(ot)
 39                     {
 40 mike           1.4  }
 41                     
 42                     compilerDeclContext::~compilerDeclContext() {}
 43                     
 44 karl           1.20 CIMQualifierDecl compilerDeclContext::lookupQualifierDecl(
 45                         const CIMNamespaceName &nameSpace,
 46                          const CIMName &qualifierName) const
 47                     {
 48                         const CIMQualifierDecl *pTheQualifier = 0;
 49                         if (_ot != compilerCommonDefs::USE_REPOSITORY) {
 50                             if ( (pTheQualifier =
 51                                         _findQualifierInMemory(qualifierName)) )
 52                                 return *pTheQualifier;
 53                         }
 54                         if (_repository && (_ot != compilerCommonDefs::IGNORE_REPOSITORY)) {
 55                             return _repository->_getQualifier(nameSpace, qualifierName);
 56                         }
 57                         return CIMQualifierDecl();
 58                     }
 59                     
 60                     CIMClass compilerDeclContext::lookupClass(const CIMNamespaceName &nameSpace,
 61                                      const CIMName &className) const
 62                     {
 63                         const CIMClass *pTheClass;
 64                     
 65 karl           1.20     if (_ot != compilerCommonDefs::USE_REPOSITORY) {
 66                             if ( (pTheClass =_findClassInMemory(className)) )
 67                                 return *pTheClass;
 68                         }
 69                         if (_repository && _ot != compilerCommonDefs::IGNORE_REPOSITORY) {
 70                             return _repository->_getClass(
 71                                     nameSpace, className, false, true, true, CIMPropertyList());
 72                         }
 73                         return CIMClass();
 74 mike           1.4  }
 75                     
 76                     void
 77 kumpf          1.9  compilerDeclContext::addQualifierDecl(const CIMNamespaceName &nameSpace,
 78 karl           1.20                       const CIMQualifierDecl &x)
 79 mike           1.4  {
 80 bob            1.5    if (_ot != compilerCommonDefs::USE_REPOSITORY)
 81 mike           1.4      _qualifiers.append(x);
 82                       else
 83 kumpf          1.15     _repository->_setQualifier(nameSpace, x);
 84 mike           1.4  }
 85                     
 86 karl           1.20 void compilerDeclContext::addClass(const CIMNamespaceName &nameSpace,
 87                             CIMClass &x)
 88 mike           1.4  {
 89 karl           1.20     if (_ot != compilerCommonDefs::USE_REPOSITORY)
 90                             _classes.append(x);
 91                         else
 92                             _repository->_createClass(nameSpace, x);
 93 bob            1.5  }
 94                     
 95 karl           1.20 void compilerDeclContext::addInstance(const CIMNamespaceName &nameSpace,
 96 kumpf          1.9                                   CIMInstance &x)
 97 bob            1.5  {
 98 karl           1.20     if (_ot == compilerCommonDefs::USE_REPOSITORY)
 99                             _repository->_createInstance(nameSpace, x);
100 mike           1.4  }
101                     
102 karl           1.20 void compilerDeclContext::modifyClass(const CIMNamespaceName &nameSpace,
103                         CIMClass &x)
104 mike           1.4  {
105 karl           1.20     if (_ot != compilerCommonDefs::USE_REPOSITORY)
106                         {
107                             _classes.append(x);
108                         }
109                         else
110                         {
111                             _repository->_modifyClass(nameSpace, x);
112                         }
113                     }
114                     
115                     const CIMClass * compilerDeclContext::_findClassInMemory(
116                         const CIMName &classname) const
117                     {
118                         for (unsigned int i = 0; i < _classes.size(); i++)
119                         {
120                             if (classname.equal (_classes[i].getClassName()))
121                                 return &(_classes[i]);
122                         }
123                         return 0;
124                     }
125                     
126 karl           1.20 const CIMQualifierDecl * compilerDeclContext::_findQualifierInMemory(
127                         const CIMName &classname) const
128                     {
129                         for (unsigned int i = 0; i < _qualifiers.size(); i++) {
130                             if (classname.equal (_qualifiers[i].getName()))
131                                 return &(_qualifiers[i]);
132                         }
133                         return 0;
134 mike           1.4  }
135 kumpf          1.16 
136                     PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2