Questions tagged [yaml-cpp]

yaml-cpp is an open source C++ library, for parsing and emitting YAML.

yaml-cpp is an open source C++ library, hosted on GitHub, for parsing and emitting YAML.

314 questions
6
votes
2 answers

How can I get the name of a node?

Is there a way to get the name of a node? For example: Fruits: - apple - orange - pear and in C++: YAML::Node fruit = parser["Fruits"]; cout << fruit.name() << endl; // should print "Fruits" is there something like YAML::Node::name()? …
user3416593
  • 201
  • 3
  • 8
5
votes
2 answers

Yaml Emitter in C++

Is there a C++ library for emitting YAML? Wikipedia mentions a c++ wrapper for libyaml, but the link is broken. The official YAML site only offers yaml-cpp, which was also suggested in this SO question, but cpp-yaml is only a parser, not an…
Kyle Simek
  • 9,576
  • 4
  • 26
  • 32
5
votes
2 answers

How-to emit and parse raw binary data using yaml-cpp

Is it possible to emit and read(parse) binary data(image, file etc)? Like this is shown here: http://yaml.org/type/binary.html How can I do this in yaml-cpp?
Dmitriy
  • 5,357
  • 8
  • 45
  • 57
5
votes
1 answer

correctly set CMake variables when adding yaml-cpp to existing project

I've added the yaml-cpp git repository as a submodule and add it to my CMake project using add_subdirectory. Everything's fine but I have to set YAML_CPP_INCLUDE_DIR and YAML_CPP_LIBRARIES manually to use them for my own targets. Because there is a…
frans
  • 8,868
  • 11
  • 58
  • 132
5
votes
6 answers

undefined reference to YAML::LoadFile

I'm trying to use the new version of libyaml-cpp and having linker problems (undefined reference to 'YAML::LoadFile(std::basic_string, std::allocator > const&)'). I build the library as follows: cmake…
edA-qa mort-ora-y
  • 30,295
  • 39
  • 137
  • 267
5
votes
1 answer

Including yaml-cpp without Boost available -

Perhaps this is a naive question - but is there a way to build/install yaml-cpp so that you don't need to have the Boost library headers around when building a project that includes yaml.h? IE: I have a project I'm working on that uses yaml-cpp…
Waco
  • 53
  • 3
4
votes
1 answer

Parsing YAML file using yaml-cpp

I am using yaml-cpp 0.3.0 (old API version) to parse a yaml file (which I got from here). This is the yaml file: - name: Ogre position: [0, 5, 0] powers: - name: Club damage: 10 - name: Fist damage: 8 - name: Dragon …
Syam_Keyek
  • 41
  • 1
  • 2
4
votes
1 answer

same code, same library version, same compiler, different output

File h.cpp #include "yaml-cpp/yaml.h" #include int main() { YAML::Node node = YAML::Load("[1, 2, 3]"); std::cout << node << "\n"; std::cout << node.Type() << "\n"; std::cout << node.IsSequence() << "\n"; } compiled and…
Joachim W
  • 7,290
  • 5
  • 31
  • 59
4
votes
1 answer

The way of yaml parsing? (yaml-cpp)

I've made a yaml file like below. Define1: &Define1 0: zero 1: one Define2: <<: *Define1 2: two And tried in Online YAML parser. The result is like below. ( Just get how nodes are constructed. ) { "Define1": { "0": "zero", "1":…
SeniorLee
  • 805
  • 1
  • 12
  • 25
4
votes
1 answer

yaml-cpp compile error: "undefined reference to YAML::LoadFile"

I'm trying to get a simple test program with yaml-cpp to run that looks like this: // main.cpp #include #include "yaml-cpp/yaml.h" int main(int argc, const char *argv[]) { YAML::Node config = YAML::LoadFile("config.yaml"); …
Ben Lindsay
  • 1,686
  • 4
  • 23
  • 44
4
votes
1 answer

How do I override an array to be empty in YAML

Say I have a YML file original.yml with an array of objects array_in_yml: - start: 1 - middle: 2 - end: 3 I included it in modified.yml !include "original.yml" array_in_yml: [] I am expecting this array to be empty when I load the modified.yml,…
mkporkodi
  • 81
  • 1
  • 5
4
votes
2 answers

conversion of GetNextDocument() from old API- new API YAMLcpp

I could not find equivalent code for new YAMLcpp version p->GetNextDocument( n ).
abcd7
  • 61
  • 2
4
votes
1 answer

C++ YAML: How to edit/write to a node in a .yaml file

I am trying to write a function that will write/edit a node in my .yaml file using yaml-cpp. I kind of got it working as my code will edit the local copy. When I print out _baseNode it shows that the node has the value 5.4 in it. However, after…
jlcv
  • 1,688
  • 5
  • 21
  • 50
4
votes
1 answer

Converting with yaml-cpp to a template class

I have my own container: template class MyContainer {} And I'm using yaml-cpp for loading some data into this container. So I need to write specialization for convert struct: template<> struct convert< MyContainer > {}; template<>…
Nick Roz
  • 3,918
  • 2
  • 36
  • 57
4
votes
1 answer

How do you determine what kind of node you are dealing with in yaml-cpp?

I'm reading the tutorial code here: https://code.google.com/p/yaml-cpp/wiki/Tutorial One example goes like this: YAML::Node primes = YAML::Load("[2, 3, 5, 7, 11]"); for (YAML::const_iterator it=primes.begin();it!=primes.end();++it) { std::cout <<…
jeremy
  • 4,421
  • 4
  • 23
  • 27
1
2
3
20 21