certik / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

how to set node style? #186

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
i have a vector3 class.
class vector3
{
    float x, y, z;
}

node["x"] = vector3.x;
node["y"] = vector3.y;
node["z"] = vector3.z;

the result is
    x: 0
    y: 0
    z: 0

i want the result to be:
   {x: 0, y: 0, z: 0}

if use the old api, i can use YAML::Flow to set the style:
YAML::Emitter emitter;
out << YAML::Flow  << YAML::BeginMap << YAML::Key << "x" << YAML::Value << x << 
YAML::EndMap

use the new api, how to set the style?

thanks.

Original issue reported on code.google.com by ChenA.Invalid@gmail.com on 22 Jan 2013 at 2:34

GoogleCodeExporter commented 9 years ago
You can still use the emitter and set the flow style:

YAML::Emitter emitter;
emitter << YAML::Flow << node;

In the future, please ask questions like these on stackoverflow.com and tag 
them yaml-cpp. File an issue report if it is a bug or feature request.

Original comment by jbe...@gmail.com on 22 Jan 2013 at 2:39