diff --git a/src/property.cpp b/src/property.cpp index 61e3e0b..4efe4f8 100644 --- a/src/property.cpp +++ b/src/property.cpp @@ -22,6 +22,41 @@ template <> std::istream& Property::loadBinary(std::istream& is) { return template <> std::istream& Property::loadAscii(std::istream& is) { return is >> value; } template <> AbstractProperty::PropertyType Property::getStaticPropertyType() { return AbstractProperty::BOOLEAN; } +// UNSIGNED INTEGER PROPERTY +template <> std::ostream& Property::saveBinary(std::ostream& os) { return os.write((char*)&value, sizeof(unsigned int)); } +template <> std::ostream& Property::saveAscii(std::ostream& os) { return os << value; } +template <> std::istream& Property::loadBinary(std::istream& is) { return is.read((char*)&value, sizeof(unsigned int)); } +template <> std::istream& Property::loadAscii(std::istream& is) { return is >> value; } +template <> AbstractProperty::PropertyType Property::getStaticPropertyType() { return AbstractProperty::UNSIGNED_INTEGER; } + +// BYTE PROPERTY +template <> std::ostream& Property::saveBinary(std::ostream& os) { return os.write((char*)&value, sizeof(char)); } +template <> std::ostream& Property::saveAscii(std::ostream& os) { return os << value; } +template <> std::istream& Property::loadBinary(std::istream& is) { return is.read((char*)&value, sizeof(char)); } +template <> std::istream& Property::loadAscii(std::istream& is) { return is >> value; } +template <> AbstractProperty::PropertyType Property::getStaticPropertyType() { return AbstractProperty::BYTE; } + +// SHORT PROPERTY +template <> std::ostream& Property::saveBinary(std::ostream& os) { return os.write((char*)&value, sizeof(short)); } +template <> std::ostream& Property::saveAscii(std::ostream& os) { return os << value; } +template <> std::istream& Property::loadBinary(std::istream& is) { return is.read((char*)&value, sizeof(short)); } +template <> std::istream& Property::loadAscii(std::istream& is) { return is >> value; } +template <> AbstractProperty::PropertyType Property::getStaticPropertyType() { return AbstractProperty::SHORT; } + +// LONG PROPERTY +template <> std::ostream& Property::saveBinary(std::ostream& os) { return os.write((char*)&value, sizeof(long)); } +template <> std::ostream& Property::saveAscii(std::ostream& os) { return os << value; } +template <> std::istream& Property::loadBinary(std::istream& is) { return is.read((char*)&value, sizeof(long)); } +template <> std::istream& Property::loadAscii(std::istream& is) { return is >> value; } +template <> AbstractProperty::PropertyType Property::getStaticPropertyType() { return AbstractProperty::LONG; } + +// DOUBLE PROPERTY +template <> std::ostream& Property::saveBinary(std::ostream& os) { return os.write((char*)&value, sizeof(double)); } +template <> std::ostream& Property::saveAscii(std::ostream& os) { return os << value; } +template <> std::istream& Property::loadBinary(std::istream& is) { return is.read((char*)&value, sizeof(double)); } +template <> std::istream& Property::loadAscii(std::istream& is) { return is >> value; } +template <> AbstractProperty::PropertyType Property::getStaticPropertyType() { return AbstractProperty::DOUBLE; } + // VEC2 PROPERTY template <> std::ostream& Property::saveBinary(std::ostream& os) { return os.write((char*)glm::value_ptr(value), sizeof(float)*value.length()); } template <> std::ostream& Property::saveAscii(std::ostream& os) { os << "["; for(int i=0; i