mirror of
https://github.com/USCiLab/cereal.git
synced 2025-10-18 01:45:52 +02:00
Fixed small bug with xml output for unique_ptr, uint8_t was being serialized as a character, now serialized as a number
This commit is contained in:
@@ -135,6 +135,12 @@ namespace cereal
|
||||
itsNodes.top().node->append_node( itsXML.allocate_node( rapidxml::node_data, nullptr, dataPtr ) );
|
||||
}
|
||||
|
||||
//! Overload for uint8_t prevents them from being serialized as characters
|
||||
void saveValue( uint8_t const & value )
|
||||
{
|
||||
saveValue( static_cast<uint32_t>( value ) );
|
||||
}
|
||||
|
||||
//! Saves some binary data, encoded as a base64 string, with an optional name
|
||||
/*! This will create a new node, optionally named, and insert a value that consists of
|
||||
the data encoded as a base64 string */
|
||||
|
||||
@@ -351,6 +351,12 @@ int main()
|
||||
int xxx[] = {-1, 95, 3};
|
||||
oar.saveBinaryValue( xxx, sizeof(int)*3, "xxxbinary" );
|
||||
//oar.saveBinaryValue( xxx, sizeof(int)*3 );
|
||||
|
||||
std::unique_ptr<Derived> d1( new Derived() );
|
||||
std::unique_ptr<Base> d2( new Derived() );
|
||||
oar( d1 );
|
||||
oar( d2 );
|
||||
oar( d2 );
|
||||
}
|
||||
|
||||
if(false)
|
||||
|
||||
@@ -175,24 +175,6 @@ template <class T> void nop(T&&) {}
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << std::boolalpha;
|
||||
|
||||
std::cout << cereal::traits::is_specialized_member_load_save<DerivedVirtual, cereal::BinaryInputArchive>() << std::endl;
|
||||
std::cout << cereal::traits::is_specialized_member_load_save<DerivedVirtual&, cereal::BinaryInputArchive>() << std::endl;
|
||||
//std::cout << cereal::traits::is_specialized_non_member_serialize<DerivedVirtual, cereal::BinaryInputArchive>() << std::endl;
|
||||
//std::cout << cereal::traits::is_input_serializable<DerivedVirtual, cereal::BinaryInputArchive>() << std::endl;
|
||||
//std::cout << cereal::traits::has_non_member_serialize<DerivedVirtual, cereal::BinaryInputArchive>() << std::endl;
|
||||
//std::cout << cereal::traits::is_specialized_member_serialize<DerivedVirtual, cereal::BinaryInputArchive>() << std::endl;
|
||||
std::cout << cereal::traits::has_member_serialize<DerivedVirtual, cereal::BinaryInputArchive>() << std::endl;
|
||||
|
||||
std::cout << "sssssssssssss" <<std::endl;
|
||||
|
||||
std::cout << cereal::traits::has_member_load<DerivedVirtual, cereal::BinaryInputArchive>() << std::endl;
|
||||
//std::cout << cereal::traits::has_non_member_load<DerivedVirtual, cereal::BinaryInputArchive>() << std::endl;
|
||||
std::cout << cereal::traits::has_member_serialize<DerivedVirtual, cereal::BinaryInputArchive>() << std::endl;
|
||||
//std::cout << cereal::traits::has_non_member_serialize<DerivedVirtual, cereal::BinaryInputArchive>() << std::endl;
|
||||
|
||||
|
||||
{
|
||||
std::ofstream ostream("rtti.txt");
|
||||
cereal::BinaryOutputArchive oarchive(ostream);
|
||||
|
||||
Reference in New Issue
Block a user