(file) Return to StringConversion.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/StringConversion.h between version 1.1 and 1.2

version 1.1, 2007/08/07 14:55:35 version 1.2, 2007/08/29 20:17:03
Line 34 
Line 34 
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/Linkage.h> #include <Pegasus/Common/Linkage.h>
   #include <Pegasus/Common/CIMType.h>
   #include <cctype>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
Line 66 
Line 68 
 PEGASUS_COMMON_LINKAGE PEGASUS_COMMON_LINKAGE
 const char* Sint64ToString(char buffer[22], Sint64 x, Uint32& size); const char* Sint64ToString(char buffer[22], Sint64 x, Uint32& size);
  
   class PEGASUS_COMMON_LINKAGE StringConversion
   {
   public:
   
       /**
           Converts a valid hexadecimal character to a Uint8 value.
           @param c The hexadecimal character to convert
           @return The converted Uint8 value
       */
       static inline Uint8 hexCharToNumeric(const char c)
       {
           Uint8 n;
   
           if (isdigit(c))
               n = (c - '0');
           else if (isupper(c))
               n = (c - 'A' + 10);
           else // if (islower(c))
               n = (c - 'a' + 10);
   
           return n;
       }
   
       /**
           Converts a character string to a Uint64 value according to the DMTF
           specifications for decimal formatting of integer values in MOF and XML.
           (The two specifications are identical.)
           @param stringValue The character string to convert
           @param x The converted Uint64 value
           @return true if the character string is well-formatted and the
               conversion is successful, false otherwise
       */
       static Boolean decimalStringToUint64(
           const char* stringValue,
           Uint64& x);
   
       /**
           Converts a character string to a Uint64 value according to the DMTF
           specifications for octal formatting of integer values in MOF
           and XML.  (The two specifications are identical.)
           @param stringValue The character string to convert
           @param x The converted Uint64 value
           @return true if the character string is well-formatted and the
               conversion is successful, false otherwise
       */
       static Boolean octalStringToUint64(
           const char* stringValue,
           Uint64& x);
   
       /**
           Converts a character string to a Uint64 value according to the DMTF
           specifications for hexadecimal formatting of integer values in MOF
           and XML.  (The two specifications are identical.)
           @param stringValue The character string to convert
           @param x The converted Uint64 value
           @return true if the character string is well-formatted and the
               conversion is successful, false otherwise
       */
       static Boolean hexStringToUint64(
           const char* stringValue,
           Uint64& x);
   
       /**
           Converts a character string to a Uint64 value according to the DMTF
           specifications for binary formatting of integer values in MOF
           and XML.  (The two specifications are identical.)
           @param stringValue The character string to convert
           @param x The converted Uint64 value
           @return true if the character string is well-formatted and the
               conversion is successful, false otherwise
       */
       static Boolean binaryStringToUint64(
           const char* stringValue,
           Uint64& x);
   
       /**
           Checks whether a specified Uint64 value will fit within a specified
           unsigned integer type (e.g., Uint8, Uint16, Uint32) without overflow.
           @param x The Uint64 value to check
           @param type A CIMType specifying the constraining unsigned integer size
           @return true if the specified integer fits within the specified type,
               false otherwise
       */
       static Boolean checkUintBounds(
           Uint64 x,
           CIMType type);
   
       /**
           Converts a character string to an Sint64 value by interpreting the
           optional leading sign character and using the specified function to
           convert the remainder of the string to a Uint64.  Bounds checking is
           performed when converting the Uint64 to Sint64.
           @param stringValue The character string to convert
           @param uint64Converter The function used to convert the unsigned
               portion of the string to a Uint64 value.
           @param x The converted Sint64 value
           @return true if the character string is well-formatted and the
               conversion is successful, false otherwise
       */
       static Boolean stringToSint64(
           const char* stringValue,
           Boolean (*uint64Converter)(const char*, Uint64&),
           Sint64& x);
   
       /**
           Checks whether a specified Sint64 value will fit within a specified
           signed integer type (e.g., Sint8, Sint16, Sint32) without overflow.
           @param x The Sint64 value to check
           @param type A CIMType specifying the constraining signed integer size
           @return true if the specified integer fits within the specified type,
               false otherwise
       */
       static Boolean checkSintBounds(
           Sint64 x,
           CIMType type);
   
       /**
           Converts a character string to a Real64 value according to the DMTF
           specifications for formatting real values in MOF and XML.  (The two
           specifications are identical.)
           @param stringValue The character string to convert
           @param x The converted Real64 value
           @return true if the character string is well-formatted and the
               conversion is successful, false otherwise
       */
       static Boolean stringToReal64(
           const char* stringValue,
           Real64& x);
   };
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  
 #endif /* Pegasus_String_Conversion_h */ #endif /* Pegasus_String_Conversion_h */


Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2