(file) Return to valueFactory.h 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.8  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             
 33             //
 34             // Header for a class to generate CIMValue objects from String values
 35             //
 36             
 37             #ifndef _VALUEFACTORY_H_
 38             #define _VALUEFACTORY_H_
 39             
 40             #include <Pegasus/Common/String.h>
 41             #include <Pegasus/Common/CIMValue.h>
 42 kumpf  1.13 #include <Pegasus/Compiler/Linkage.h>
 43 mike   1.8  
 44             PEGASUS_USING_PEGASUS;
 45             PEGASUS_USING_STD;
 46             
 47             // The valueFactory builds a CIMValue object given an indication of
 48             // whether this is a Array type, the CIM type to be coerced, and
 49             // a String representation of the value.
 50             //
 51 karl   1.19 class PEGASUS_COMPILER_LINKAGE valueFactory
 52             {
 53 kumpf  1.21 public:
 54                 static String stringWComma(String tmp);
 55             
 56                 /**
 57                     Converts a String to a Uint64 according to the DMTF specification for
 58                     MOF encoding.  A CIMType specification also allows for overflow
 59                     checking of smaller unsigned integer type (e.g., Uint8, Uint16,
 60                     Uint32).
 61                     @param val The String to convert
 62                     @param type A CIMType to use for bounds checking
 63                     @exception Exception if the conversion is unsuccessful
 64                     @return The converted Uint64 value
 65                 */
 66                 static Uint64 stringToUint(
 67                     const String& val,
 68                     CIMType type);
 69             
 70                 /**
 71                     Converts a String to a Sint64 according to the DMTF specification for
 72                     MOF encoding.  A CIMType specification also allows for overflow
 73                     checking of smaller unsigned integer type (e.g., Sint8, Sint16,
 74 kumpf  1.21         Sint32).
 75                     @param val The String to convert
 76                     @param type A CIMType to use for bounds checking
 77                     @exception Exception if the conversion is unsuccessful
 78                     @return The converted Sint64 value
 79                 */
 80                 static Sint64 stringToSint(
 81                     const String& val,
 82                     CIMType type);
 83             
 84                 /**
 85                     Converts a String to a Rint64 according to the DMTF specification for
 86                     MOF encoding.
 87                     @param val The String to convert
 88                     @param type A CIMType to use in an exception message
 89                     @exception Exception if the conversion is unsuccessful
 90                     @return The converted Real64 value
 91                 */
 92                 static Real64 stringToReal(
 93                     const String& val,
 94                     CIMType type);
 95 kumpf  1.21 
 96                 static CIMValue * createValue(CIMType type, int arrayDimension,
 97                     Boolean isNull,
 98                     const String *rep);
 99             
100             private:
101             
102                 static CIMValue* _buildArrayValue(
103                     CIMType type,
104                     const String& rep);
105 mike   1.8  };
106             
107             #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2