Esempio n. 1
0
	// Decode the object
	void DecodeSelf(const NEncoder &theEncoder)
	{	NArray			theArray;
		NDictionary		theDict;
		NData			theData;
	
		NN_ASSERT(theEncoder.DecodeBoolean(kKeyBoolean1) == kValueBoolean1);
		NN_ASSERT(theEncoder.DecodeBoolean(kKeyBoolean2) == kValueBoolean2);
		NN_ASSERT(theEncoder.DecodeNumber( kKeyNumber1)  == kValueNumber1);
		NN_ASSERT(theEncoder.DecodeNumber( kKeyNumber2)  == kValueNumber2);
		NN_ASSERT(theEncoder.DecodeNumber( kKeyNumber3)  == kValueNumber3);
		NN_ASSERT(theEncoder.DecodeNumber( kKeyNumber4)  == kValueNumber4);
		NN_ASSERT(theEncoder.DecodeString( kKeyString)   == kValueString);

		theData = theEncoder.DecodeData(kKeyData);
		NN_ASSERT(theData.GetSize() == NN_ARRAY_SIZE(kValueData));
		NN_ASSERT(memcmp(theData.GetData(), kValueData, (size_t) theData.GetSize()) == 0);

		NN_ASSERT(theEncoder.DecodeObject(kKeyArray).GetValue(theArray));
		NN_ASSERT(theArray.GetSize() == 3);
		NN_ASSERT(theArray.GetValueBoolean(0) == kValueBoolean1);
		NN_ASSERT(theArray.GetValue       (1) == kValueNumber1);
		NN_ASSERT(theArray.GetValueString (2) == kValueString);

		NN_ASSERT(theEncoder.DecodeObject(kKeyDictionary).GetValue(theDict));
		NN_ASSERT(theDict.GetSize() == 6);
		NN_ASSERT(theDict.GetValueBoolean  (kKeyBoolean1)  == kValueBoolean1);
		NN_ASSERT(theDict.GetValue         (kKeyNumber1)   == kValueNumber1);
		NN_ASSERT(theDict.GetValueString   (kKeyString)    == kValueString);
		NN_ASSERT(theDict.GetValuePoint    (kKeyPoint)     == kValuePoint);
		NN_ASSERT(theDict.GetValueSize     (kKeySize)      == kValueSize);
		NN_ASSERT(theDict.GetValueRectangle(kKeyRectangle) == kValueRectangle);
	}
Esempio n. 2
0
File: NURL.cpp Progetto: refnum/nano
//============================================================================
//      NURL::DecodeSelf : Decode the object.
//----------------------------------------------------------------------------
void NURL::DecodeSelf(const NEncoder &theEncoder)
{


	// Decode the object
	mValue = theEncoder.DecodeString(kNEncoderValueKey);
}