예제 #1
0
파일: storage.cpp 프로젝트: behrisch/shawn
	// ----------------------------------------------------------------------
	void Storage::writeShort( int value ) throw(std::invalid_argument)
	{
		if (value < -32768 || value > 32767)
		{
			throw std::invalid_argument("Storage::writeShort(): Invalid value, not in [-32768, 32767]");
		}

		short svalue = static_cast<short>(value);
		unsigned char *p_svalue = reinterpret_cast<unsigned char*>(&svalue);
		writeByEndianess(p_svalue, 2);
	}
예제 #2
0
파일: storage.cpp 프로젝트: behrisch/shawn
	// ----------------------------------------------------------------------
	void Storage::writeDouble( double value ) throw ()
	{
		unsigned char *p_value = reinterpret_cast<unsigned char*>(&value);
		writeByEndianess(p_value, 8);
	}
예제 #3
0
파일: storage.cpp 프로젝트: behrisch/shawn
	// ----------------------------------------------------------------------
	void Storage::writeFloat( float value ) throw()
	{
		unsigned char *p_value = reinterpret_cast<unsigned char*>(&value);
		writeByEndianess(p_value, 4);
	}
예제 #4
0
	// ----------------------------------------------------------------------
	void NetStreamStorage::writeLong( long value ) throw()
	{
		unsigned char *p_value = reinterpret_cast<unsigned char*>(&value);
		writeByEndianess(p_value, 8);
	}