Go to the documentation of this file.00001
00002
00003 #include "yaml-cpp-pm/yaml.h"
00004 #include <iostream>
00005
00006 int main()
00007 {
00008 {
00009
00010
00011
00012
00013
00014
00015
00016 YAML::Value root = YAML::Parse("test.yaml");
00017
00018 std::cout << root[0].as<std::string>();
00019 std::cout << str(root[0]);
00020 std::cout << root[1]["primes"][3].as<int>();
00021 std::cout << root[1]["odds"][6].as<int>();
00022
00023 root[2].push_back(5);
00024 root[3] = "Hello, World";
00025 root[0].reset();
00026 root[0]["key"] = "value";
00027
00028 std::cout << root;
00029
00030
00031
00032
00033
00034
00035 }
00036
00037 {
00038
00039 YAML::Value root = "Hello";
00040 root = YAML::Sequence();
00041 root[0] = 0;
00042 root[2] = "two";
00043
00044 YAML::Value other = root;
00045 other[0] = 5;
00046 other.push_back(root);
00047 other[3][0] = 0;
00048 other.push_back(Copy(root));
00049 other[4][0] = 5;
00050 }
00051
00052 {
00053 YAML::Value node;
00054 node[0] = 1;
00055 node["key"] = 5;
00056 node.push_back(10);
00057 node.erase("key");
00058 node = "Hello";
00059 }
00060
00061 {
00062 YAML::Value map;
00063 map[3] = 1;
00064
00065 YAML::Value seq;
00066 seq = YAML::Sequence();
00067 seq[3] = 1;
00068 }
00069
00070 {
00071 YAML::Value node;
00072 node[0] = node;
00073 }
00074
00075 {
00076 YAML::Value node;
00077 YAML::Value subnode = node["key"];
00078 subnode = "value";
00079 YAML::Value subnode2 = node["key2"];
00080 node["key3"] = subnode2;
00081 subnode2 = "monkey";
00082 }
00083
00084 {
00085 YAML::Value seq = YAML::Sequence();
00086 seq[0] = "zero";
00087 seq[1] = seq[0];
00088 seq[0] = seq[1];
00089 Is(seq[0], seq[1]);
00090 seq[1] = "one";
00091 UnAlias(seq[1]);
00092 Is(seq[0], seq[1]);
00093 }
00094
00095 {
00096 YAML::Value root;
00097 root.push_back("zero");
00098 root.push_back("one");
00099 root.push_back("two");
00100 YAML::Value two = root[2];
00101 root = "scalar";
00102
00103
00104 }
00105
00106 {
00107 YAML::Value root;
00108 root[0] = root;
00109 root[0] = 5;
00110 }
00111
00112 {
00113 YAML::Value root;
00114 YAML::Value key;
00115 key["key"] = "value";
00116 root[key] = key;
00117 }
00118
00119 {
00120 YAML::Value root;
00121 root[0] = "hi";
00122 root[1][0] = "bye";
00123 root[1][1] = root;
00124 YAML::Value sub = root[1];
00125 root = "gone";
00126 }
00127
00128 return 0;
00129 }