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

Diff for /pegasus/src/Pegasus/Common/CIMValue.cpp between version 1.8 and 1.11.2.2

version 1.8, 2001/06/16 17:30:37 version 1.11.2.2, 2001/08/01 11:17:36
Line 170 
Line 170 
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
 // _toXml() routines:  // _toXml() and _toMof routines:
 // //
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
  
Line 178 
Line 178 
 { {
     out << (x ? "TRUE" : "FALSE");     out << (x ? "TRUE" : "FALSE");
 } }
   inline void _toMof(Array<Sint8>& out, Boolean x)
   {
       out << (x ? "TRUE" : "FALSE");
   }
  
 template<class T> template<class T>
 inline void _integerToXml(Array<Sint8>& out, const T& x) inline void _integerToXml(Array<Sint8>& out, const T& x)
Line 186 
Line 190 
     sprintf(buffer, "%d", x);     sprintf(buffer, "%d", x);
     out << (char*)buffer;     out << (char*)buffer;
 } }
   /* ATTNKS template<class T>
   inline void _integerToMof(Array<Sint8>& out, const T& x)
   {
       char buffer[32];
       sprintf(buffer, "%d", x);
       out << (char*)buffer;
   }
   */
 inline void _toXml(Array<Sint8>& out, Uint8 x) { _integerToXml(out, x); } inline void _toXml(Array<Sint8>& out, Uint8 x) { _integerToXml(out, x); }
   inline void _toMof(Array<Sint8>& out, Uint8 x) { _integerToXml(out, x); }
  
 inline void _toXml(Array<Sint8>& out, Sint8 x) { _integerToXml(out, x); } inline void _toXml(Array<Sint8>& out, Sint8 x) { _integerToXml(out, x); }
   inline void _toMof(Array<Sint8>& out, Sint8 x) { _integerToXml(out, x); }
  
 inline void _toXml(Array<Sint8>& out, Uint16 x) { _integerToXml(out, x); } inline void _toXml(Array<Sint8>& out, Uint16 x) { _integerToXml(out, x); }
   inline void _toMof(Array<Sint8>& out, Uint16 x) { _integerToXml(out, x); }
  
 inline void _toXml(Array<Sint8>& out, Sint16 x) { _integerToXml(out, x); } inline void _toXml(Array<Sint8>& out, Sint16 x) { _integerToXml(out, x); }
   inline void _toMof(Array<Sint8>& out, Sint16 x) { _integerToXml(out, x); }
  
 inline void _toXml(Array<Sint8>& out, Uint32 x) { _integerToXml(out, x); } inline void _toXml(Array<Sint8>& out, Uint32 x) { _integerToXml(out, x); }
   inline void _toMof(Array<Sint8>& out, Uint32 x) { _integerToXml(out, x); }
  
 inline void _toXml(Array<Sint8>& out, Sint32 x) { _integerToXml(out, x); } inline void _toXml(Array<Sint8>& out, Sint32 x) { _integerToXml(out, x); }
   inline void _toMof(Array<Sint8>& out, Sint32 x) { _integerToXml(out, x); }
  
 inline void _toXml(Array<Sint8>& out, Uint64 x) inline void _toXml(Array<Sint8>& out, Uint64 x)
 { {
Line 205 
Line 222 
     _UnsignedIntToStr(x, buffer);     _UnsignedIntToStr(x, buffer);
     out << buffer;     out << buffer;
 } }
   inline void _toMof(Array<Sint8>& out, Uint64 x)
   {
       char buffer[128];
       _UnsignedIntToStr(x, buffer);
       out << buffer;
   }
  
 inline void _toXml(Array<Sint8>& out, Sint64 x) inline void _toXml(Array<Sint8>& out, Sint64 x)
 { {
Line 212 
Line 235 
     _SignedIntToStr(x, buffer);     _SignedIntToStr(x, buffer);
     out << buffer;     out << buffer;
 } }
   inline void _toMof(Array<Sint8>& out, Sint64 x)
   {
       char buffer[128];
       _SignedIntToStr(x, buffer);
       out << buffer;
   }
  
 void _toXml(Array<Sint8>& out, Real32 x) void _toXml(Array<Sint8>& out, Real32 x)
 { {
Line 220 
Line 249 
     sprintf(buffer, "%f", x);     sprintf(buffer, "%f", x);
     out << buffer;     out << buffer;
 } }
   void _toMof(Array<Sint8>& out, Real32 x)
   {
       // ATTN: Does this format match the CIM/XML format?
       char buffer[128];
       sprintf(buffer, "%f", x);
       out << buffer;
   }
  
 void _toXml(Array<Sint8>& out, Real64 x) void _toXml(Array<Sint8>& out, Real64 x)
 { {
Line 227 
Line 263 
     sprintf(buffer, "%f", x);     sprintf(buffer, "%f", x);
     out << buffer;     out << buffer;
 } }
   void _toMof(Array<Sint8>& out, Real64 x)
   {
       char buffer[128];
       sprintf(buffer, "%f", x);
       out << buffer;
   }
  
 inline void _toXml(Array<Sint8>& out, Char16 x) inline void _toXml(Array<Sint8>& out, Char16 x)
 { {
     XmlWriter::appendSpecial(out, x);     XmlWriter::appendSpecial(out, x);
 } }
   inline void _toMof(Array<Sint8>& out, Char16 x)
   {
       XmlWriter::appendSpecial(out, x);
   }
  
 inline void _toXml(Array<Sint8>& out, const String& x) inline void _toXml(Array<Sint8>& out, const String& x)
 { {
     XmlWriter::appendSpecial(out, x);     XmlWriter::appendSpecial(out, x);
 } }
   inline void _toMof(Array<Sint8>& out, const String& x)
   {
       out << "\"";
       const Char16* tmp = x.getData();
       char c;
       while (c = *tmp++)
       {
           switch (c)
           {
               case '"':
                   out.append("'", 1);
                   break;
   
               case ' ':
                   out.append(Sint8(c));
                   break;
   
               default:
                   out.append(Sint8(c));
           }
   
       }
       out << "\"";
   }
  
 inline void _toXml(Array<Sint8>& out, const CIMDateTime& x) inline void _toXml(Array<Sint8>& out, const CIMDateTime& x)
 { {
     out << x.getString();     out << x.getString();
 } }
   inline void _toMof(Array<Sint8>& out, const CIMDateTime& x)
   {
       out << x.getString();
   }
  
 template<class T> template<class T>
 void _toXml(Array<Sint8>& out, const T* p, Uint32 size) void _toXml(Array<Sint8>& out, const T* p, Uint32 size)
Line 255 
Line 329 
         out << "</VALUE>\n";         out << "</VALUE>\n";
     }     }
 } }
   template<class T>
   void _toMof(Array<Sint8>& out, const T* p, Uint32 size)
   {
       Boolean isFirstEntry = true;
       out << "{";
       while (size--)
       {
           // Put comma on all but first entry.
           if (!isFirstEntry)
           {
               out << ", ";
           }
           isFirstEntry = false;
           _toMof(out, *p++);
       }
       out << "}";
   }
  
 template<class T> template<class T>
 void _toStr(Array<Sint8>& out, const T* p, Uint32 size) void _toStr(Array<Sint8>& out, const T* p, Uint32 size)
Line 297 
Line 388 
  
     _type = x._type;     _type = x._type;
     _isArray = x._isArray;     _isArray = x._isArray;
       _isNull = x._isNull;
     _u._voidPtr = 0;     _u._voidPtr = 0;
  
     if (_isArray)     if (_isArray)
Line 748 
Line 840 
         out << "</VALUE>\n";         out << "</VALUE>\n";
     }     }
 } }
   void CIMValue::toMof(Array<Sint8>& out) const    //ATTNKS:
   {
       if (_isArray)
       {
           switch (_type)
           {
               case CIMType::BOOLEAN:
               {
                   for (Uint32 i = 0, n = _u._booleanArray->size; i < n; i++)
                   {
                       _toMof(out, Boolean(_u._booleanArray->data()[i]));
                   }
                   break;
               }
               case CIMType::UINT8:
                   _toMof(out, _u._uint8Array->data(), _u._uint8Array->size);
                   break;
   
               case CIMType::SINT8:
                   _toMof(out, _u._sint8Array->data(), _u._sint8Array->size);
                   break;
   
               case CIMType::UINT16:
                   _toMof(out, _u._uint16Array->data(), _u._uint16Array->size);
                   break;
   
               case CIMType::SINT16:
                   _toMof(out, _u._sint16Array->data(), _u._sint16Array->size);
                   break;
   
               case CIMType::UINT32:
                   _toMof(out, _u._uint32Array->data(), _u._uint32Array->size);
                   break;
   
               case CIMType::SINT32:
                   _toMof(out, _u._sint32Array->data(), _u._sint32Array->size);
                   break;
   
               case CIMType::UINT64:
                   _toMof(out, _u._uint64Array->data(), _u._uint64Array->size);
                   break;
   
               case CIMType::SINT64:
                   _toMof(out, _u._sint64Array->data(), _u._sint64Array->size);
                   break;
   
               case CIMType::REAL32:
                   _toMof(out, _u._real32Array->data(), _u._real32Array->size);
                   break;
   
               case CIMType::REAL64:
                   _toMof(out, _u._real64Array->data(), _u._real64Array->size);
                   break;
   
               case CIMType::CHAR16:
                   _toMof(out, _u._char16Array->data(), _u._char16Array->size);
                   break;
   
               case CIMType::STRING:
                   _toMof(out, _u._stringArray->data(), _u._stringArray->size);
                   break;
   
               case CIMType::DATETIME:
                   _toMof(out, _u._dateTimeArray->data(),
                               _u._dateTimeArray->size); break;
           }
       }
       else if (_type == CIMType::REFERENCE)
       {
           _u._referenceValue->toMof(out);
       }
       else
       {
           switch (_type)
           {
               case CIMType::BOOLEAN:
                   _toMof(out, Boolean(_u._booleanValue != 0));
                   break;
   
               case CIMType::UINT8:
                   _toMof(out, _u._uint8Value);
                   break;
   
               case CIMType::SINT8:
                   _toMof(out, _u._sint8Value);
                   break;
   
               case CIMType::UINT16:
                   _toMof(out, _u._uint16Value);
                   break;
   
               case CIMType::SINT16:
                   _toMof(out, _u._sint16Value);
                   break;
   
               case CIMType::UINT32:
                   _toMof(out, _u._uint32Value);
                   break;
   
               case CIMType::SINT32:
                   _toMof(out, _u._sint32Value);
                   break;
   
               case CIMType::UINT64:
                   _toMof(out, _u._uint64Value);
                   break;
   
               case CIMType::SINT64:
                   _toMof(out, _u._sint64Value);
                   break;
   
               case CIMType::REAL32:
                   _toMof(out, _u._real32Value);
                   break;
   
               case CIMType::REAL64:
                   _toMof(out, _u._real64Value);
                   break;
   
               case CIMType::CHAR16:
                   _toMof(out, Char16(_u._char16Value));
                   break;
   
               case CIMType::STRING:
                   _toMof(out, *_u._stringValue);
                   break;
   
               case CIMType::DATETIME:
                   _toMof(out, *_u._dateTimeValue);
                   break;
           }
       }
   }
   
  
 void CIMValue::print(PEGASUS_STD(ostream) &os) const void CIMValue::print(PEGASUS_STD(ostream) &os) const
 { {
Line 873 
Line 1099 
     _Inc(_u._booleanArray = x._rep);     _Inc(_u._booleanArray = x._rep);
     _type = CIMType::BOOLEAN;     _type = CIMType::BOOLEAN;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Uint8>& x) void CIMValue::set(const Array<Uint8>& x)
Line 881 
Line 1108 
     _Inc(_u._uint8Array = x._rep);     _Inc(_u._uint8Array = x._rep);
     _type = CIMType::UINT8;     _type = CIMType::UINT8;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Sint8>& x) void CIMValue::set(const Array<Sint8>& x)
Line 889 
Line 1117 
     _Inc(_u._sint8Array = x._rep);     _Inc(_u._sint8Array = x._rep);
     _type = CIMType::SINT8;     _type = CIMType::SINT8;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Uint16>& x) void CIMValue::set(const Array<Uint16>& x)
Line 897 
Line 1126 
     _Inc(_u._uint16Array = x._rep);     _Inc(_u._uint16Array = x._rep);
     _type = CIMType::UINT16;     _type = CIMType::UINT16;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Sint16>& x) void CIMValue::set(const Array<Sint16>& x)
Line 905 
Line 1135 
     _Inc(_u._sint16Array = x._rep);     _Inc(_u._sint16Array = x._rep);
     _type = CIMType::SINT16;     _type = CIMType::SINT16;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Uint32>& x) void CIMValue::set(const Array<Uint32>& x)
Line 913 
Line 1144 
     _Inc(_u._uint32Array = x._rep);     _Inc(_u._uint32Array = x._rep);
     _type = CIMType::UINT32;     _type = CIMType::UINT32;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Sint32>& x) void CIMValue::set(const Array<Sint32>& x)
Line 921 
Line 1153 
     _Inc(_u._sint32Array = x._rep);     _Inc(_u._sint32Array = x._rep);
     _type = CIMType::SINT32;     _type = CIMType::SINT32;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Uint64>& x) void CIMValue::set(const Array<Uint64>& x)
Line 929 
Line 1162 
     _Inc(_u._uint64Array = x._rep);     _Inc(_u._uint64Array = x._rep);
     _type = CIMType::UINT64;     _type = CIMType::UINT64;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Sint64>& x) void CIMValue::set(const Array<Sint64>& x)
Line 937 
Line 1171 
     _Inc(_u._sint64Array = x._rep);     _Inc(_u._sint64Array = x._rep);
     _type = CIMType::SINT64;     _type = CIMType::SINT64;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Real32>& x) void CIMValue::set(const Array<Real32>& x)
Line 945 
Line 1180 
     _Inc(_u._real32Array = x._rep);     _Inc(_u._real32Array = x._rep);
     _type = CIMType::REAL32;     _type = CIMType::REAL32;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Real64>& x) void CIMValue::set(const Array<Real64>& x)
Line 953 
Line 1189 
     _Inc(_u._real64Array = x._rep);     _Inc(_u._real64Array = x._rep);
     _type = CIMType::REAL64;     _type = CIMType::REAL64;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<Char16>& x) void CIMValue::set(const Array<Char16>& x)
Line 961 
Line 1198 
     _Inc(_u._char16Array = x._rep);     _Inc(_u._char16Array = x._rep);
     _type = CIMType::CHAR16;     _type = CIMType::CHAR16;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<String>& x) void CIMValue::set(const Array<String>& x)
Line 969 
Line 1207 
     _Inc(_u._stringArray = x._rep);     _Inc(_u._stringArray = x._rep);
     _type = CIMType::STRING;     _type = CIMType::STRING;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::set(const Array<CIMDateTime>& x) void CIMValue::set(const Array<CIMDateTime>& x)
Line 977 
Line 1216 
     _Inc(_u._dateTimeArray = x._rep);     _Inc(_u._dateTimeArray = x._rep);
     _type = CIMType::DATETIME;     _type = CIMType::DATETIME;
     _isArray = true;     _isArray = true;
       _isNull = false;
 } }
  
 void CIMValue::get(Boolean& x) const void CIMValue::get(Boolean& x) const
Line 1215 
Line 1455 
 { {
     _type = CIMType::NONE;     _type = CIMType::NONE;
     _isArray = false;     _isArray = false;
       _isNull = true;
     _u._voidPtr = 0;     _u._voidPtr = 0;
 } }
  
Line 1341 
Line 1582 
  
 void CIMValue::setNullValue(CIMType type, Boolean isArray, Uint32 arraySize) void CIMValue::setNullValue(CIMType type, Boolean isArray, Uint32 arraySize)
 { {
       _isNull = true;
   
     clear();     clear();
  
     if (isArray)     if (isArray)


Legend:
Removed from v.1.8  
changed lines
  Added in v.1.11.2.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2