You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a struct/class containing a destructor and a function to serialize an arbitrary type of data, with the destructor calling the serialization function.
Create a static instance of that class and call the serilization function at least once.
What is the expected output? What do you see instead?
The expected output would be to see the serialized data, as many times as requested, beeing exactly the same, however, the last time the yaml string is printed, all keys, as well as all strings, are wrapped in double quotes.
Example
struct EmitterTest
{
~EmitterTest()
{
Serialize();
}
void Serialize()
{
YAML::Emitter out;
out << YAML::BeginMap << YAML::Key << "Test";
out << YAML::BeginMap;
out << YAML::Key << "String1" << YAML::Value << "String1";
out << YAML::Key << "String2" << YAML::Value << "String2";
out << YAML::Key << "String3" << YAML::Value << "Foo";
out << YAML::EndMap;
out << YAML::EndMap;
std::cout << out.c_str() << std::endl;
}
}
static EmitterTest s_Test;
int main()
{
s_Test.Serialize();
}
Additional Information
Note that this only happens when Serialize() is called once before destruction. Digging into the problem makes the problem pretty obvious: In emitter.h the function YAML::Emitter::Write(const std::string&) queries the StringFormat::value, by trying to match the string with a regex. This regex match returns false in the serialization called in the destructor, otherwise it returns true.
The text was updated successfully, but these errors were encountered:
What steps will reproduce the problem?
Create a struct/class containing a destructor and a function to serialize an arbitrary type of data, with the destructor calling the serialization function.
Create a static instance of that class and call the serilization function at least once.
What is the expected output? What do you see instead?
The expected output would be to see the serialized data, as many times as requested, beeing exactly the same, however, the last time the yaml string is printed, all keys, as well as all strings, are wrapped in double quotes.
Example
Expected output:
Actual output:
yaml-cpp version: 0.8.0
Additional Information
Note that this only happens when Serialize() is called once before destruction. Digging into the problem makes the problem pretty obvious: In emitter.h the function YAML::Emitter::Write(const std::string&) queries the StringFormat::value, by trying to match the string with a regex. This regex match returns false in the serialization called in the destructor, otherwise it returns true.
The text was updated successfully, but these errors were encountered: