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

  1 martin 1.6 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.7 //
  3 martin 1.6 // 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.7 //
 10 martin 1.6 // 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.7 //
 17 martin 1.6 // The above copyright notice and this permission notice shall be included
 18            // in all copies or substantial portions of the Software.
 19 martin 1.7 //
 20 martin 1.6 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.7 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.6 // 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.7 //
 28 martin 1.6 //////////////////////////////////////////////////////////////////////////
 29 schuur 1.1 //
 30            //%/////////////////////////////////////////////////////////////////////////////
 31            
 32            #include "WQLInstancePropertySource.h"
 33            #include <Pegasus/Common/CIMName.h>
 34            #include <Pegasus/Common/CIMInstance.h>
 35            
 36            PEGASUS_NAMESPACE_BEGIN
 37            
 38            Boolean WQLInstancePropertySource::getValue(
 39 kumpf  1.8     const CIMName& propertyName,
 40 karl   1.5     WQLOperand& value) const
 41 schuur 1.1 {
 42               unsigned int pos=ci.findProperty(propertyName);
 43               if (pos==PEG_NOT_FOUND) return false;
 44 kumpf  1.8 
 45 schuur 1.1    CIMValue val=ci.getProperty(pos).getValue();
 46               CIMType type=val.getType();
 47 kumpf  1.8 
 48 karl   1.5    if (val.isNull())
 49               {
 50 schuur 1.1       value=WQLOperand();
 51                  return true;
 52               }
 53               if (val.isArray()) return false;
 54 kumpf  1.8 
 55 karl   1.5    switch (type)
 56               {
 57                   case CIMTYPE_UINT8:
 58                      Uint8 propertyValueUint8;
 59                      val.get(propertyValueUint8);
 60                      value=WQLOperand(propertyValueUint8,WQL_INTEGER_VALUE_TAG);
 61                      break;
 62 kumpf  1.8 
 63 karl   1.5        case CIMTYPE_UINT16:
 64                      Uint16 propertyValueUint16;
 65                      val.get(propertyValueUint16);
 66                      value=WQLOperand(propertyValueUint16, WQL_INTEGER_VALUE_TAG);
 67                      break;
 68 kumpf  1.8 
 69 karl   1.5        case CIMTYPE_UINT32:
 70                      Uint32 propertyValueUint32;
 71                      val.get(propertyValueUint32);
 72                      value=WQLOperand(propertyValueUint32, WQL_INTEGER_VALUE_TAG);
 73                      break;
 74 kumpf  1.8 
 75 karl   1.5        case CIMTYPE_UINT64:
 76                      Uint64 propertyValueUint64;
 77                      val.get(propertyValueUint64);
 78                      value=WQLOperand(propertyValueUint64, WQL_INTEGER_VALUE_TAG);
 79                      break;
 80 kumpf  1.8 
 81 karl   1.5        case CIMTYPE_SINT8:
 82                      Sint8 propertyValueSint8;
 83                      val.get(propertyValueSint8);
 84                      value=WQLOperand(propertyValueSint8, WQL_INTEGER_VALUE_TAG);
 85                      break;
 86 kumpf  1.8 
 87 karl   1.5        case CIMTYPE_SINT16:
 88                      Sint16 propertyValueSint16;
 89                      val.get(propertyValueSint16);
 90                      value=WQLOperand(propertyValueSint16, WQL_INTEGER_VALUE_TAG);
 91                      break;
 92 kumpf  1.8 
 93 karl   1.5        case CIMTYPE_SINT32:
 94                      Sint32 propertyValueSint32;
 95                      val.get(propertyValueSint32);
 96                      value=WQLOperand(propertyValueSint32, WQL_INTEGER_VALUE_TAG);
 97                      break;
 98 kumpf  1.8 
 99 karl   1.5        case CIMTYPE_SINT64:
100                      Sint64 propertyValueSint64;
101                      val.get(propertyValueSint64);
102                      value=WQLOperand(propertyValueSint64, WQL_INTEGER_VALUE_TAG);
103                      break;
104 kumpf  1.8 
105 karl   1.5        case CIMTYPE_REAL32:
106                      Real32 propertyValueReal32;
107                      val.get(propertyValueReal32);
108                      value=WQLOperand(propertyValueReal32, WQL_DOUBLE_VALUE_TAG);
109                      break;
110 kumpf  1.8 
111 karl   1.5        case CIMTYPE_REAL64:
112                      Real64 propertyValueReal64;
113                      val.get(propertyValueReal64);
114                      value=WQLOperand(propertyValueReal64, WQL_DOUBLE_VALUE_TAG);
115                      break;
116 kumpf  1.8 
117 karl   1.5        case CIMTYPE_BOOLEAN :
118                      Boolean booleanValue;
119                      val.get(booleanValue);
120                      value=WQLOperand(booleanValue, WQL_BOOLEAN_VALUE_TAG);
121                      break;
122 kumpf  1.8 
123 karl   1.5        case CIMTYPE_CHAR16:
124                   case CIMTYPE_DATETIME :
125 kumpf  1.8        case CIMTYPE_STRING :
126 karl   1.5        {
127                      String strValue;
128                      val.get(strValue);
129                      value=WQLOperand(strValue,WQL_STRING_VALUE_TAG);
130                      break;
131                   }
132 kumpf  1.8        default: return false;
133 schuur 1.1    }
134               return true;
135 kumpf  1.8  }
136 schuur 1.1 
137            PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2