mFrame(0),
mCurrentAnimation(0)
{
- for(int i=0; i<anims.size(); i++)
+ for(unsigned int i=0; i<anims.size(); i++)
mAnimations.push_back(Game::game()->getCurrentLevel()->getAnimation(anims[i]));
}
\ No newline at end of file
#include "Animation.h"
#include "fns.h"
#include <GL/gl.h>
+#include "yaml-cpp/yaml.h"
using namespace std;
Animation::Animation():mName()
int Animation::loadAnimation(std::string animFile)
{
- //variables
- string buffer,file;
- int transparency[3];
- int pause;
- int count=0;
- animFile="ArtAssets/Sprites/"+animFile;
-
- //file
- ifstream fin(animFile.c_str());
-
- if(!fin)
- {
- printf("Error opening %s\n\n",animFile.c_str());
- return -1;
- }
-
- while(getline(fin,buffer))
- {
- if(buffer[0] != '#' && buffer[0] != '\r' && buffer[0] != '\0' && buffer[0] != '\n' && buffer.length() != 0)
- {
- stringstream value(buffer);
- string temp;
- value>>temp;
- if(temp=="NumFrames:")
- {
- value>>mNumFrames;
- mFrames = new SpriteFrame[mNumFrames];
- mBuilt = 1;
- }
- else
- {
+ try{
+ //variables
+ string buffer,file;
+ int transparency[3];
+ int pause;
+ int count=0;
+ animFile="ArtAssets/Sprites/"+animFile;
+
+ //file
+ ifstream fin(animFile.c_str());
+
+ if(!fin)
+ {
+ printf("Error opening %s\n\n",animFile.c_str());
+ return -1;
+ }
+
+ YAML::Parser parser(fin);
+
+ YAML::Node doc;
+ while(parser.GetNextDocument(doc)) {
+ cout<<doc.size()<<endl;
+ mNumFrames = doc.size();
+ mFrames = new SpriteFrame[mNumFrames];
+ mBuilt = 1;
+ //read out frames
+ for(unsigned int i=0; i<doc.size(); i++){
/** File name */
- file=temp;
+ file=doc[i]["file"].to<string>();
+
/** Pause time */
- value>>pause;
+ pause=doc[i]["pause"].to<int>();
+
/** transparency #'s R G B */
- for(int i=0; i<3;++i)
- {
- int num;
- value>>num;
- if(num >= 0 && num<=255)
- transparency[i] = num;///< \todo check to see if this is being stupid.
- else
- {
- transparency[i] = 0;
- cout<<"Invalid value!"<<endl;
- }
- }
- /** AnimationPeg */
- double x=0.0, y=0.0;
- value>>x;
- value>>y;
+ transparency[0]=doc[i]["transparency"]["r"].to<int>();
+ transparency[1]=doc[i]["transparency"]["g"].to<int>();
+ transparency[2]=doc[i]["transparency"]["b"].to<int>();
-
+ /** AnimationPeg */
+ double x=doc[i]["offset"]["x"].to<double>();
+ double y=doc[i]["offset"]["y"].to<double>();
/** Collision data */
- char c;
- value>>c;
- if(c == '('){
- value>>c;
- while(c != ')'){
- if(c == 'n'){
- value>>c;
- continue;
- }
- else if(c == 'c')
- {
- double xOffset = 0.0, yOffset = 0.0;
- value>>xOffset;
- value>>yOffset;
- double radius;
- value>>radius;
- mFrames[count].collisionData.push_back(new CollisionCircle(Point2D(xOffset, yOffset), radius));
- }
- else if(c == 'r')
- {
- double xOffset = 0.0, yOffset = 0.0;
- value>>xOffset;
- value>>yOffset;
- double width = 0.0 , height = 0.0;
- value>>width;
- value>>height;
- mFrames[count].collisionData.push_back(new CollisionRectangle(Point2D(xOffset, yOffset), width, height));
- }
- value>>c;
+ for(unsigned int j=0; j<doc[i]["collision"].size();j++){
+ if(doc[i]["collision"][j]["type"].to<string>()=="circle"){
+ double xOffset = doc[i]["collision"][j]["offset"]["x"].to<double>();
+ double yOffset = doc[i]["collision"][j]["offset"]["y"].to<double>();
+ double radius = doc[i]["collision"][j]["radius"].to<double>();
+ mFrames[count].collisionData.push_back(new CollisionCircle(Point2D(xOffset, yOffset), radius));
+ }
+ else if(doc[i]["collision"][j]["type"].to<string>()=="rectangle"){
+ double xOffset = doc[i]["collision"][j]["offset"]["x"].to<double>();
+ double yOffset = doc[i]["collision"][j]["offset"]["y"].to<double>();
+ double width = doc[i]["collision"][j]["width"].to<double>();
+ double height = doc[i]["collision"][j]["height"].to<double>();
+ mFrames[count].collisionData.push_back(new CollisionRectangle(Point2D(xOffset, yOffset), width, height));
}
}
-
/** Load image for Frame */
SDL_Surface *temp=NULL;
if((temp = LoadImage("Sprites/"+file)) == NULL) return -1;//Load image for Frame
-
+
/** Set transparent color */
SDL_SetColorKey(temp, SDL_SRCCOLORKEY, SDL_MapRGB(temp->format, transparency[0], transparency[1], transparency[2]));
-
+
/** Loads image into animation */
SDL_Surface* surface = SDL_DisplayFormatAlpha(temp);
SDL_FreeSurface(temp);
// Check that the image\92s width is a power of 2
if ( (surface->w & (surface->w - 1)) != 0 ) {
- cout<<"warning: image.bmp\92s width is not a power of 2"<<endl;
+ cout<<"warning: image.bmp's width is not a power of 2"<<endl;
}
// Also check if the height is a power of 2
if ( (surface->h & (surface->h - 1)) != 0 ) {
- cout<<"warning: image.bmp\92s height is not a power of 2"<<endl;
+ cout<<"warning: image.bmp's height is not a power of 2"<<endl;
}
//get number of channels in the SDL surface
// allocate a texture name
glGenTextures( 1, &mFrames[count].image );
-
+
// select our current texture
glBindTexture( GL_TEXTURE_2D, mFrames[count].image );
-
+
// select modulate to mix texture with color for shading
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
mFrames[count].pause = pause;
mW = mFrames[count].width;
mH = mFrames[count].height;
-
+
/** Set the animation Peg*/
mFrames[count].animationPeg = Point2D(x + double(mW)/2, y + double(mH)/2);
count++;
}
- }
- }
- fin.close();
- return 0;
+ }
+
+ // /** File name */
+ // file=temp;
+ // /** Pause time */
+ // value>>pause;
+ // /** transparency #'s R G B */
+ // for(int i=0; i<3;++i)
+ // {
+ // int num;
+ // value>>num;
+ // if(num >= 0 && num<=255)
+ // transparency[i] = num;///< \todo check to see if this is being stupid.
+ // else
+ // {
+ // transparency[i] = 0;
+ // cout<<"Invalid value!"<<endl;
+ // }
+ // }
+ // /** AnimationPeg */
+ // double x=0.0, y=0.0;
+ // value>>x;
+ // value>>y;
+
+
+ // /** Collision data */
+ // char c;
+ // value>>c;
+ // if(c == '('){
+ // value>>c;
+ // while(c != ')'){
+ // if(c == 'n'){
+ // value>>c;
+ // continue;
+ // }
+ // else if(c == 'c')
+ // {
+ // double xOffset = 0.0, yOffset = 0.0;
+ // value>>xOffset;
+ // value>>yOffset;
+ // double radius;
+ // value>>radius;
+ // mFrames[count].collisionData.push_back(new CollisionCircle(Point2D(xOffset, yOffset), radius));
+ // }
+ // else if(c == 'r')
+ // {
+ // double xOffset = 0.0, yOffset = 0.0;
+ // value>>xOffset;
+ // value>>yOffset;
+ // double width = 0.0 , height = 0.0;
+ // value>>width;
+ // value>>height;
+ // mFrames[count].collisionData.push_back(new CollisionRectangle(Point2D(xOffset, yOffset), width, height));
+ // }
+ // value>>c;
+ // }
+ // }
+
+ fin.close();
+ } catch(YAML::ParserException& e) {
+ std::cout << e.what() << "\n";
+ mBuilt = false;
+ return -1;
+ }
+ return 0;
}
{
public:
//variables
- int mBuilt,/**< Using as a bool */
+ int mBuilt,/**< Tells if loading the Animation was successful */
mNumFrames,/**< Number of frames in this Animation */
mW,/**< Animation's current width */
mH;/**< The animation's current Height */
-#Number of Frames
-#ArtAssets/ milisec Transparency
-#filename pause r g b xOffset yOffset ( <n | c | r> <c=circle has offset, radius | r=rectangle has offset, width, height>, ... )
-NumFrames: 4
-sun1.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 10.0 )
-sun2.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 10.0 )
-sun3.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 10.0 )
-sun4.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 10.0 )
+-
+ file: sun1.bmp
+ pause: 20
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: circle
+ offset:
+ x: 0
+ y: 0
+ radius: 10
+-
+ file: sun2.bmp
+ pause: 20
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: circle
+ offset:
+ x: 0
+ y: 0
+ radius: 10
+-
+ file: sun3.bmp
+ pause: 20
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: circle
+ offset:
+ x: 0
+ y: 0
+ radius: 10
+-
+ file: sun4.bmp
+ pause: 20
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: circle
+ offset:
+ x: 0
+ y: 0
+ radius: 10
\ No newline at end of file
-#Number of Frames
-#ArtAssets/ milisec Transparency
-#filename pause r g b xOffset yOffset ( <n | c | r> <c=circle has offset, radius | r=rectangle has offset, width, height>, ... )
-NumFrames: 9
-viking1.bmp 50 0 255 0 0.0 0.0 ( r 0 0 150.0 100.0 )
-viking2.bmp 50 0 255 0 0.0 0.0 ( r 0 0 150.0 100.0 )
-viking3.bmp 50 0 255 0 0.0 0.0 ( r 0 0 150.0 100.0 )
-viking4.bmp 50 0 255 0 0.0 0.0 ( r 0 0 150.0 100.0 c 0.0 0.0 5.0 )
-viking5.bmp 50 0 255 0 0.0 0.0 ( r 0 0 150.0 100.0 )
-viking6.bmp 50 0 255 0 0.0 0.0 ( r 0 0 150.0 100.0 )
-viking7.bmp 50 0 255 0 0.0 0.0 ( r 0 0 150.0 100.0 )
-viking8.bmp 50 0 255 0 0.0 0.0 ( r 0 0 150.0 100.0 )
-viking9.bmp 50 0 255 0 0.0 0.0 ( r 0 0 150.0 100.0 )
+-
+ file: viking1.bmp
+ pause: 50
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: rectangle
+ offset:
+ x: 0.0
+ y: 0.0
+ width: 150
+ height: 100
+-
+ file: viking2.bmp
+ pause: 50
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: rectangle
+ offset:
+ x: 0.0
+ y: 0.0
+ width: 150
+ height: 100
+-
+ file: viking3.bmp
+ pause: 50
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: rectangle
+ offset:
+ x: 0.0
+ y: 0.0
+ width: 150
+ height: 100
+-
+ file: viking4.bmp
+ pause: 50
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: rectangle
+ offset:
+ x: 0.0
+ y: 0.0
+ width: 150
+ height: 100
+ -
+ type: circle
+ offset:
+ x: 0
+ y: 0
+ radius: 5
+-
+ file: viking5.bmp
+ pause: 50
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: rectangle
+ offset:
+ x: 0.0
+ y: 0.0
+ width: 150
+ height: 100
+-
+ file: viking6.bmp
+ pause: 50
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: rectangle
+ offset:
+ x: 0.0
+ y: 0.0
+ width: 150
+ height: 100
+-
+ file: viking7.bmp
+ pause: 50
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: rectangle
+ offset:
+ x: 0.0
+ y: 0.0
+ width: 150
+ height: 100
+-
+ file: viking8.bmp
+ pause: 50
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: rectangle
+ offset:
+ x: 0.0
+ y: 0.0
+ width: 150
+ height: 100
+-
+ file: viking9.bmp
+ pause: 50
+ transparency:
+ r: 0
+ g: 255
+ b: 0
+ offset:
+ x: 0.0
+ y: 0.0
+ collision:
+ -
+ type: rectangle
+ offset:
+ x: 0.0
+ y: 0.0
+ width: 150
+ height: 100
\ No newline at end of file
glDisable(GL_BLEND);
glLoadIdentity();
}
-
}
vector<Collision*>& Sprite::getCollisionData(){
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\SDL\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>SDL.lib;SDL_image.lib;SDLmain.lib;SDL_draw.lib;glu32.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>libyaml-cppmdd.lib;SDL.lib;SDL_image.lib;SDLmain.lib;SDL_draw.lib;glu32.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
</Link>
<PostBuildEvent>
--- /dev/null
+#ifndef ALIASMANAGER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define ALIASMANAGER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/anchor.h"
+#include <map>
+
+namespace YAML
+{
+ class Node;
+
+ class AliasManager
+ {
+ public:
+ AliasManager();
+
+ void RegisterReference(const Node& node);
+ anchor_t LookupAnchor(const Node& node) const;
+
+ private:
+ anchor_t _CreateNewAnchor();
+
+ private:
+ typedef std::map<const Node*, anchor_t> AnchorByIdentity;
+ AnchorByIdentity m_anchorByIdentity;
+
+ anchor_t m_curAnchor;
+ };
+}
+
+#endif // ALIASMANAGER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <cstddef>
+
+namespace YAML
+{
+ typedef std::size_t anchor_t;
+ const anchor_t NullAnchor = 0;
+}
+
+#endif // ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include <vector>
+
+namespace YAML
+{
+ class Node;
+
+ std::string EncodeBase64(const unsigned char *data, std::size_t size);
+ std::vector<unsigned char> DecodeBase64(const std::string& input);
+
+ class Binary {
+ public:
+ Binary(): m_unownedData(0), m_unownedSize(0) {}
+ Binary(const unsigned char *data, std::size_t size): m_unownedData(data), m_unownedSize(size) {}
+
+ bool owned() const { return !m_unownedData; }
+ std::size_t size() const { return owned() ? m_data.size() : m_unownedSize; }
+ const unsigned char *data() const { return owned() ? &m_data[0] : m_unownedData; }
+
+ void swap(std::vector<unsigned char>& rhs) {
+ if(m_unownedData) {
+ m_data.swap(rhs);
+ rhs.clear();
+ rhs.resize(m_unownedSize);
+ std::copy(m_unownedData, m_unownedData + m_unownedSize, &rhs[0]);
+ m_unownedData = 0;
+ m_unownedSize = 0;
+ } else {
+ m_data.swap(rhs);
+ }
+ }
+
+ bool operator == (const Binary& rhs) const {
+ const std::size_t s = size();
+ if(s != rhs.size())
+ return false;
+ const unsigned char *d1 = data();
+ const unsigned char *d2 = rhs.data();
+ for(std::size_t i=0;i<s;i++) {
+ if(*d1++ != *d2++)
+ return false;
+ }
+ return true;
+ }
+
+ bool operator != (const Binary& rhs) const {
+ return !(*this == rhs);
+ }
+
+ private:
+ std::vector<unsigned char> m_data;
+ const unsigned char *m_unownedData;
+ std::size_t m_unownedSize;
+ };
+
+ void operator >> (const Node& node, Binary& binary);
+}
+
+#endif // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <vector>
+
+#include "../anchor.h"
+
+namespace YAML
+{
+ /// AnchorDict
+ /// . An object that stores and retrieves values correlating to anchor_t
+ /// values.
+ /// . Efficient implementation that can make assumptions about how anchor_t
+ /// values are assigned by the Parser class.
+ template <class T>
+ class AnchorDict
+ {
+ public:
+ void Register(anchor_t anchor, T value)
+ {
+ if (anchor > m_data.size())
+ {
+ m_data.resize(anchor);
+ }
+ m_data[anchor - 1] = value;
+ }
+
+ T Get(anchor_t anchor) const
+ {
+ return m_data[anchor - 1];
+ }
+
+ private:
+ std::vector<T> m_data;
+ };
+}
+
+#endif // ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/mark.h"
+#include <string>
+
+namespace YAML
+{
+ class Parser;
+
+ // GraphBuilderInterface
+ // . Abstraction of node creation
+ // . pParentNode is always NULL or the return value of one of the NewXXX()
+ // functions.
+ class GraphBuilderInterface
+ {
+ public:
+ // Create and return a new node with a null value.
+ virtual void *NewNull(const Mark& mark, void *pParentNode) = 0;
+
+ // Create and return a new node with the given tag and value.
+ virtual void *NewScalar(const Mark& mark, const std::string& tag, void *pParentNode, const std::string& value) = 0;
+
+ // Create and return a new sequence node
+ virtual void *NewSequence(const Mark& mark, const std::string& tag, void *pParentNode) = 0;
+ // Add pNode to pSequence. pNode was created with one of the NewXxx()
+ // functions and pSequence with NewSequence().
+ virtual void AppendToSequence(void *pSequence, void *pNode) = 0;
+ // Note that no moew entries will be added to pSequence
+ virtual void SequenceComplete(void *pSequence) {(void)pSequence;}
+
+ // Create and return a new map node
+ virtual void *NewMap(const Mark& mark, const std::string& tag, void *pParentNode) = 0;
+ // Add the pKeyNode => pValueNode mapping to pMap. pKeyNode and pValueNode
+ // were created with one of the NewXxx() methods and pMap with NewMap().
+ virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) = 0;
+ // Note that no more assignments will be made in pMap
+ virtual void MapComplete(void *pMap) {(void)pMap;}
+
+ // Return the node that should be used in place of an alias referencing
+ // pNode (pNode by default)
+ virtual void *AnchorReference(const Mark& mark, void *pNode) {(void)mark; return pNode;}
+ };
+
+ // Typesafe wrapper for GraphBuilderInterface. Assumes that Impl defines
+ // Node, Sequence, and Map types. Sequence and Map must derive from Node
+ // (unless Node is defined as void). Impl must also implement function with
+ // all of the same names as the virtual functions in GraphBuilderInterface
+ // -- including the ones with default implementations -- but with the
+ // prototypes changed to accept an explicit Node*, Sequence*, or Map* where
+ // appropriate.
+ template <class Impl>
+ class GraphBuilder : public GraphBuilderInterface
+ {
+ public:
+ typedef typename Impl::Node Node;
+ typedef typename Impl::Sequence Sequence;
+ typedef typename Impl::Map Map;
+
+ GraphBuilder(Impl& impl) : m_impl(impl)
+ {
+ Map* pMap = NULL;
+ Sequence* pSeq = NULL;
+ Node* pNode = NULL;
+
+ // Type consistency checks
+ pNode = pMap;
+ pNode = pSeq;
+ }
+
+ GraphBuilderInterface& AsBuilderInterface() {return *this;}
+
+ virtual void *NewNull(const Mark& mark, void* pParentNode) {
+ return CheckType<Node>(m_impl.NewNull(mark, AsNode(pParentNode)));
+ }
+
+ virtual void *NewScalar(const Mark& mark, const std::string& tag, void *pParentNode, const std::string& value) {
+ return CheckType<Node>(m_impl.NewScalar(mark, tag, AsNode(pParentNode), value));
+ }
+
+ virtual void *NewSequence(const Mark& mark, const std::string& tag, void *pParentNode) {
+ return CheckType<Sequence>(m_impl.NewSequence(mark, tag, AsNode(pParentNode)));
+ }
+ virtual void AppendToSequence(void *pSequence, void *pNode) {
+ m_impl.AppendToSequence(AsSequence(pSequence), AsNode(pNode));
+ }
+ virtual void SequenceComplete(void *pSequence) {
+ m_impl.SequenceComplete(AsSequence(pSequence));
+ }
+
+ virtual void *NewMap(const Mark& mark, const std::string& tag, void *pParentNode) {
+ return CheckType<Map>(m_impl.NewMap(mark, tag, AsNode(pParentNode)));
+ }
+ virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) {
+ m_impl.AssignInMap(AsMap(pMap), AsNode(pKeyNode), AsNode(pValueNode));
+ }
+ virtual void MapComplete(void *pMap) {
+ m_impl.MapComplete(AsMap(pMap));
+ }
+
+ virtual void *AnchorReference(const Mark& mark, void *pNode) {
+ return CheckType<Node>(m_impl.AnchorReference(mark, AsNode(pNode)));
+ }
+
+ private:
+ Impl& m_impl;
+
+ // Static check for pointer to T
+ template <class T, class U>
+ static T* CheckType(U* p) {return p;}
+
+ static Node *AsNode(void *pNode) {return static_cast<Node*>(pNode);}
+ static Sequence *AsSequence(void *pSeq) {return static_cast<Sequence*>(pSeq);}
+ static Map *AsMap(void *pMap) {return static_cast<Map*>(pMap);}
+ };
+
+ void *BuildGraphOfNextDocument(Parser& parser, GraphBuilderInterface& graphBuilder);
+
+ template <class Impl>
+ typename Impl::Node *BuildGraphOfNextDocument(Parser& parser, Impl& impl)
+ {
+ GraphBuilder<Impl> graphBuilder(impl);
+ return static_cast<typename Impl::Node *>(BuildGraphOfNextDocument(
+ parser, graphBuilder
+ ));
+ }
+}
+
+#endif // GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include "yaml-cpp/null.h"
+#include "yaml-cpp/traits.h"
+#include <limits>
+#include <string>
+#include <sstream>
+
+namespace YAML
+{
+ // traits for conversion
+
+ template<typename T>
+ struct is_scalar_convertible { enum { value = is_numeric<T>::value }; };
+
+ template<> struct is_scalar_convertible<std::string> { enum { value = true }; };
+ template<> struct is_scalar_convertible<bool> { enum { value = true }; };
+ template<> struct is_scalar_convertible<_Null> { enum { value = true }; };
+
+ // actual conversion
+
+ inline bool Convert(const std::string& input, std::string& output) {
+ output = input;
+ return true;
+ }
+
+ YAML_CPP_API bool Convert(const std::string& input, bool& output);
+ YAML_CPP_API bool Convert(const std::string& input, _Null& output);
+
+ inline bool IsInfinity(const std::string& input) {
+ return input == ".inf" || input == ".Inf" || input == ".INF" || input == "+.inf" || input == "+.Inf" || input == "+.INF";
+ }
+
+ inline bool IsNegativeInfinity(const std::string& input) {
+ return input == "-.inf" || input == "-.Inf" || input == "-.INF";
+ }
+
+ inline bool IsNaN(const std::string& input) {
+ return input == ".nan" || input == ".NaN" || input == ".NAN";
+ }
+
+
+ template <typename T>
+ inline bool Convert(const std::string& input, T& output, typename enable_if<is_numeric<T> >::type * = 0) {
+ std::stringstream stream(input);
+ stream.unsetf(std::ios::dec);
+ if((stream >> output) && (stream >> std::ws).eof())
+ return true;
+
+ if(std::numeric_limits<T>::has_infinity) {
+ if(IsInfinity(input)) {
+ output = std::numeric_limits<T>::infinity();
+ return true;
+ } else if(IsNegativeInfinity(input)) {
+ output = -std::numeric_limits<T>::infinity();
+ return true;
+ }
+ }
+
+ if(std::numeric_limits<T>::has_quiet_NaN && IsNaN(input)) {
+ output = std::numeric_limits<T>::quiet_NaN();
+ return true;
+ }
+
+ return false;
+ }
+}
+
+#endif // CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the yaml_cpp_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// YAML_CPP_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+#undef YAML_CPP_API
+
+#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined manually)
+ #ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake or defined manually)
+ // #pragma message( "Defining YAML_CPP_API for DLL export" )
+ #define YAML_CPP_API __declspec(dllexport)
+ #else // yaml_cpp_EXPORTS
+ // #pragma message( "Defining YAML_CPP_API for DLL import" )
+ #define YAML_CPP_API __declspec(dllimport)
+ #endif // yaml_cpp_EXPORTS
+#else //YAML_CPP_DLL
+#define YAML_CPP_API
+#endif // YAML_CPP_DLL
+
+#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/eventhandler.h"
+#include <stack>
+
+namespace YAML
+{
+ class Emitter;
+
+ class EmitFromEvents: public EventHandler
+ {
+ public:
+ EmitFromEvents(Emitter& emitter);
+
+ virtual void OnDocumentStart(const Mark& mark);
+ virtual void OnDocumentEnd();
+
+ virtual void OnNull(const Mark& mark, anchor_t anchor);
+ virtual void OnAlias(const Mark& mark, anchor_t anchor);
+ virtual void OnScalar(const Mark& mark, const std::string& tag, anchor_t anchor, const std::string& value);
+
+ virtual void OnSequenceStart(const Mark& mark, const std::string& tag, anchor_t anchor);
+ virtual void OnSequenceEnd();
+
+ virtual void OnMapStart(const Mark& mark, const std::string& tag, anchor_t anchor);
+ virtual void OnMapEnd();
+
+ private:
+ void BeginNode();
+ void EmitProps(const std::string& tag, anchor_t anchor);
+
+ private:
+ Emitter& m_emitter;
+
+ struct State { enum value { WaitingForSequenceEntry, WaitingForKey, WaitingForValue }; };
+ std::stack<State::value> m_stateStack;
+ };
+}
+
+#endif // EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/binary.h"
+#include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/ostream.h"
+#include "yaml-cpp/noncopyable.h"
+#include "yaml-cpp/null.h"
+#include <memory>
+#include <string>
+#include <sstream>
+
+namespace YAML
+{
+ class EmitterState;
+
+ class YAML_CPP_API Emitter: private noncopyable
+ {
+ public:
+ Emitter();
+ ~Emitter();
+
+ // output
+ const char *c_str() const;
+ unsigned size() const;
+
+ // state checking
+ bool good() const;
+ const std::string GetLastError() const;
+
+ // global setters
+ bool SetOutputCharset(EMITTER_MANIP value);
+ bool SetStringFormat(EMITTER_MANIP value);
+ bool SetBoolFormat(EMITTER_MANIP value);
+ bool SetIntBase(EMITTER_MANIP value);
+ bool SetSeqFormat(EMITTER_MANIP value);
+ bool SetMapFormat(EMITTER_MANIP value);
+ bool SetIndent(unsigned n);
+ bool SetPreCommentIndent(unsigned n);
+ bool SetPostCommentIndent(unsigned n);
+ bool SetFloatPrecision(unsigned n);
+ bool SetDoublePrecision(unsigned n);
+
+ // local setters
+ Emitter& SetLocalValue(EMITTER_MANIP value);
+ Emitter& SetLocalIndent(const _Indent& indent);
+ Emitter& SetLocalPrecision(const _Precision& precision);
+
+ // overloads of write
+ Emitter& Write(const std::string& str);
+ Emitter& Write(bool b);
+ Emitter& Write(char ch);
+ Emitter& Write(const _Alias& alias);
+ Emitter& Write(const _Anchor& anchor);
+ Emitter& Write(const _Tag& tag);
+ Emitter& Write(const _Comment& comment);
+ Emitter& Write(const _Null& null);
+ Emitter& Write(const Binary& binary);
+
+ template <typename T>
+ Emitter& WriteIntegralType(T value);
+
+ template <typename T>
+ Emitter& WriteStreamable(T value);
+
+ private:
+ void PreWriteIntegralType(std::stringstream& str);
+ void PreWriteStreamable(std::stringstream& str);
+ void PostWriteIntegralType(const std::stringstream& str);
+ void PostWriteStreamable(const std::stringstream& str);
+
+ template<typename T> void SetStreamablePrecision(std::stringstream&) {}
+ unsigned GetFloatPrecision() const;
+ unsigned GetDoublePrecision() const;
+
+ private:
+ void PreAtomicWrite();
+ bool GotoNextPreAtomicState();
+ void PostAtomicWrite();
+ void EmitSeparationIfNecessary();
+
+ void EmitBeginDoc();
+ void EmitEndDoc();
+ void EmitBeginSeq();
+ void EmitEndSeq();
+ void EmitBeginMap();
+ void EmitEndMap();
+ void EmitKey();
+ void EmitValue();
+ void EmitNewline();
+ void EmitKindTag();
+ void EmitTag(bool verbatim, const _Tag& tag);
+
+ const char *ComputeFullBoolName(bool b) const;
+ bool CanEmitNewline() const;
+
+ private:
+ ostream m_stream;
+ std::auto_ptr <EmitterState> m_pState;
+ };
+
+ template <typename T>
+ inline Emitter& Emitter::WriteIntegralType(T value)
+ {
+ if(!good())
+ return *this;
+
+ std::stringstream str;
+ PreWriteIntegralType(str);
+ str << value;
+ PostWriteIntegralType(str);
+ return *this;
+ }
+
+ template <typename T>
+ inline Emitter& Emitter::WriteStreamable(T value)
+ {
+ if(!good())
+ return *this;
+
+ std::stringstream str;
+ PreWriteStreamable(str);
+ SetStreamablePrecision<T>(str);
+ str << value;
+ PostWriteStreamable(str);
+ return *this;
+ }
+
+ template<>
+ inline void Emitter::SetStreamablePrecision<float>(std::stringstream& str)
+ {
+ str.precision(GetFloatPrecision());
+ }
+
+ template<>
+ inline void Emitter::SetStreamablePrecision<double>(std::stringstream& str)
+ {
+ str.precision(GetDoublePrecision());
+ }
+
+ // overloads of insertion
+ inline Emitter& operator << (Emitter& emitter, const std::string& v) { return emitter.Write(v); }
+ inline Emitter& operator << (Emitter& emitter, bool v) { return emitter.Write(v); }
+ inline Emitter& operator << (Emitter& emitter, char v) { return emitter.Write(v); }
+ inline Emitter& operator << (Emitter& emitter, unsigned char v) { return emitter.Write(static_cast<char>(v)); }
+ inline Emitter& operator << (Emitter& emitter, const _Alias& v) { return emitter.Write(v); }
+ inline Emitter& operator << (Emitter& emitter, const _Anchor& v) { return emitter.Write(v); }
+ inline Emitter& operator << (Emitter& emitter, const _Tag& v) { return emitter.Write(v); }
+ inline Emitter& operator << (Emitter& emitter, const _Comment& v) { return emitter.Write(v); }
+ inline Emitter& operator << (Emitter& emitter, const _Null& v) { return emitter.Write(v); }
+ inline Emitter& operator << (Emitter& emitter, const Binary& b) { return emitter.Write(b); }
+
+ inline Emitter& operator << (Emitter& emitter, const char *v) { return emitter.Write(std::string(v)); }
+
+ inline Emitter& operator << (Emitter& emitter, int v) { return emitter.WriteIntegralType(v); }
+ inline Emitter& operator << (Emitter& emitter, unsigned int v) { return emitter.WriteIntegralType(v); }
+ inline Emitter& operator << (Emitter& emitter, short v) { return emitter.WriteIntegralType(v); }
+ inline Emitter& operator << (Emitter& emitter, unsigned short v) { return emitter.WriteIntegralType(v); }
+ inline Emitter& operator << (Emitter& emitter, long v) { return emitter.WriteIntegralType(v); }
+ inline Emitter& operator << (Emitter& emitter, unsigned long v) { return emitter.WriteIntegralType(v); }
+ inline Emitter& operator << (Emitter& emitter, long long v) { return emitter.WriteIntegralType(v); }
+ inline Emitter& operator << (Emitter& emitter, unsigned long long v) { return emitter.WriteIntegralType(v); }
+
+ inline Emitter& operator << (Emitter& emitter, float v) { return emitter.WriteStreamable(v); }
+ inline Emitter& operator << (Emitter& emitter, double v) { return emitter.WriteStreamable(v); }
+
+ inline Emitter& operator << (Emitter& emitter, EMITTER_MANIP value) {
+ return emitter.SetLocalValue(value);
+ }
+
+ inline Emitter& operator << (Emitter& emitter, _Indent indent) {
+ return emitter.SetLocalIndent(indent);
+ }
+
+ inline Emitter& operator << (Emitter& emitter, _Precision precision) {
+ return emitter.SetLocalPrecision(precision);
+ }
+}
+
+#endif // EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include <string>
+
+namespace YAML
+{
+ enum EMITTER_MANIP {
+ // general manipulators
+ Auto,
+ TagByKind,
+ Newline,
+
+ // output character set
+ EmitNonAscii,
+ EscapeNonAscii,
+
+ // string manipulators
+ // Auto, // duplicate
+ SingleQuoted,
+ DoubleQuoted,
+ Literal,
+
+ // bool manipulators
+ YesNoBool, // yes, no
+ TrueFalseBool, // true, false
+ OnOffBool, // on, off
+ UpperCase, // TRUE, N
+ LowerCase, // f, yes
+ CamelCase, // No, Off
+ LongBool, // yes, On
+ ShortBool, // y, t
+
+ // int manipulators
+ Dec,
+ Hex,
+ Oct,
+
+ // document manipulators
+ BeginDoc,
+ EndDoc,
+
+ // sequence manipulators
+ BeginSeq,
+ EndSeq,
+ Flow,
+ Block,
+
+ // map manipulators
+ BeginMap,
+ EndMap,
+ Key,
+ Value,
+ // Flow, // duplicate
+ // Block, // duplicate
+ // Auto, // duplicate
+ LongKey
+ };
+
+ struct _Indent {
+ _Indent(int value_): value(value_) {}
+ int value;
+ };
+
+ inline _Indent Indent(int value) {
+ return _Indent(value);
+ }
+
+ struct _Alias {
+ _Alias(const std::string& content_): content(content_) {}
+ std::string content;
+ };
+
+ inline _Alias Alias(const std::string content) {
+ return _Alias(content);
+ }
+
+ struct _Anchor {
+ _Anchor(const std::string& content_): content(content_) {}
+ std::string content;
+ };
+
+ inline _Anchor Anchor(const std::string content) {
+ return _Anchor(content);
+ }
+
+ struct _Tag {
+ struct Type { enum value { Verbatim, PrimaryHandle, NamedHandle }; };
+
+ explicit _Tag(const std::string& prefix_, const std::string& content_, Type::value type_)
+ : prefix(prefix_), content(content_), type(type_)
+ {
+ }
+ std::string prefix;
+ std::string content;
+ Type::value type;
+ };
+
+ inline _Tag VerbatimTag(const std::string content) {
+ return _Tag("", content, _Tag::Type::Verbatim);
+ }
+
+ inline _Tag LocalTag(const std::string content) {
+ return _Tag("", content, _Tag::Type::PrimaryHandle);
+ }
+
+ inline _Tag LocalTag(const std::string& prefix, const std::string content) {
+ return _Tag(prefix, content, _Tag::Type::NamedHandle);
+ }
+
+ inline _Tag SecondaryTag(const std::string content) {
+ return _Tag("", content, _Tag::Type::NamedHandle);
+ }
+
+ struct _Comment {
+ _Comment(const std::string& content_): content(content_) {}
+ std::string content;
+ };
+
+ inline _Comment Comment(const std::string content) {
+ return _Comment(content);
+ }
+
+ struct _Precision {
+ _Precision(int floatPrecision_, int doublePrecision_): floatPrecision(floatPrecision_), doublePrecision(doublePrecision_) {}
+
+ int floatPrecision;
+ int doublePrecision;
+ };
+
+ inline _Precision FloatPrecision(int n) {
+ return _Precision(n, -1);
+ }
+
+ inline _Precision DoublePrecision(int n) {
+ return _Precision(-1, n);
+ }
+
+ inline _Precision Precision(int n) {
+ return _Precision(n, n);
+ }
+}
+
+#endif // EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/anchor.h"
+#include <string>
+
+namespace YAML
+{
+ struct Mark;
+
+ class EventHandler
+ {
+ public:
+ virtual ~EventHandler() {}
+
+ virtual void OnDocumentStart(const Mark& mark) = 0;
+ virtual void OnDocumentEnd() = 0;
+
+ virtual void OnNull(const Mark& mark, anchor_t anchor) = 0;
+ virtual void OnAlias(const Mark& mark, anchor_t anchor) = 0;
+ virtual void OnScalar(const Mark& mark, const std::string& tag, anchor_t anchor, const std::string& value) = 0;
+
+ virtual void OnSequenceStart(const Mark& mark, const std::string& tag, anchor_t anchor) = 0;
+ virtual void OnSequenceEnd() = 0;
+
+ virtual void OnMapStart(const Mark& mark, const std::string& tag, anchor_t anchor) = 0;
+ virtual void OnMapEnd() = 0;
+ };
+}
+
+#endif // EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
--- /dev/null
+#ifndef EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include "yaml-cpp/mark.h"
+#include "yaml-cpp/traits.h"
+#include <stdexcept>
+#include <string>
+#include <sstream>
+
+namespace YAML
+{
+ // error messages
+ namespace ErrorMsg
+ {
+ const char * const YAML_DIRECTIVE_ARGS = "YAML directives must have exactly one argument";
+ const char * const YAML_VERSION = "bad YAML version: ";
+ const char * const YAML_MAJOR_VERSION = "YAML major version too large";
+ const char * const REPEATED_YAML_DIRECTIVE= "repeated YAML directive";
+ const char * const TAG_DIRECTIVE_ARGS = "TAG directives must have exactly two arguments";
+ const char * const REPEATED_TAG_DIRECTIVE = "repeated TAG directive";
+ const char * const CHAR_IN_TAG_HANDLE = "illegal character found while scanning tag handle";
+ const char * const TAG_WITH_NO_SUFFIX = "tag handle with no suffix";
+ const char * const END_OF_VERBATIM_TAG = "end of verbatim tag not found";
+ const char * const END_OF_MAP = "end of map not found";
+ const char * const END_OF_MAP_FLOW = "end of map flow not found";
+ const char * const END_OF_SEQ = "end of sequence not found";
+ const char * const END_OF_SEQ_FLOW = "end of sequence flow not found";
+ const char * const MULTIPLE_TAGS = "cannot assign multiple tags to the same node";
+ const char * const MULTIPLE_ANCHORS = "cannot assign multiple anchors to the same node";
+ const char * const MULTIPLE_ALIASES = "cannot assign multiple aliases to the same node";
+ const char * const ALIAS_CONTENT = "aliases can't have any content, *including* tags";
+ const char * const INVALID_HEX = "bad character found while scanning hex number";
+ const char * const INVALID_UNICODE = "invalid unicode: ";
+ const char * const INVALID_ESCAPE = "unknown escape character: ";
+ const char * const UNKNOWN_TOKEN = "unknown token";
+ const char * const DOC_IN_SCALAR = "illegal document indicator in scalar";
+ const char * const EOF_IN_SCALAR = "illegal EOF in scalar";
+ const char * const CHAR_IN_SCALAR = "illegal character in scalar";
+ const char * const TAB_IN_INDENTATION = "illegal tab when looking for indentation";
+ const char * const FLOW_END = "illegal flow end";
+ const char * const BLOCK_ENTRY = "illegal block entry";
+ const char * const MAP_KEY = "illegal map key";
+ const char * const MAP_VALUE = "illegal map value";
+ const char * const ALIAS_NOT_FOUND = "alias not found after *";
+ const char * const ANCHOR_NOT_FOUND = "anchor not found after &";
+ const char * const CHAR_IN_ALIAS = "illegal character found while scanning alias";
+ const char * const CHAR_IN_ANCHOR = "illegal character found while scanning anchor";
+ const char * const ZERO_INDENT_IN_BLOCK = "cannot set zero indentation for a block scalar";
+ const char * const CHAR_IN_BLOCK = "unexpected character in block scalar";
+ const char * const AMBIGUOUS_ANCHOR = "cannot assign the same alias to multiple nodes";
+ const char * const UNKNOWN_ANCHOR = "the referenced anchor is not defined";
+
+ const char * const INVALID_SCALAR = "invalid scalar";
+ const char * const KEY_NOT_FOUND = "key not found";
+ const char * const BAD_DEREFERENCE = "bad dereference";
+
+ const char * const UNMATCHED_GROUP_TAG = "unmatched group tag";
+ const char * const UNEXPECTED_END_SEQ = "unexpected end sequence token";
+ const char * const UNEXPECTED_END_MAP = "unexpected end map token";
+ const char * const SINGLE_QUOTED_CHAR = "invalid character in single-quoted string";
+ const char * const INVALID_ANCHOR = "invalid anchor";
+ const char * const INVALID_ALIAS = "invalid alias";
+ const char * const INVALID_TAG = "invalid tag";
+ const char * const EXPECTED_KEY_TOKEN = "expected key token";
+ const char * const EXPECTED_VALUE_TOKEN = "expected value token";
+ const char * const UNEXPECTED_KEY_TOKEN = "unexpected key token";
+ const char * const UNEXPECTED_VALUE_TOKEN = "unexpected value token";
+
+ template <typename T>
+ inline const std::string KEY_NOT_FOUND_WITH_KEY(const T&, typename disable_if<is_numeric<T> >::type * = 0) {
+ return KEY_NOT_FOUND;
+ }
+
+ inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) {
+ std::stringstream stream;
+ stream << KEY_NOT_FOUND << ": " << key;
+ return stream.str();
+ }
+
+ template <typename T>
+ inline const std::string KEY_NOT_FOUND_WITH_KEY(const T& key, typename enable_if<is_numeric<T> >::type * = 0) {
+ std::stringstream stream;
+ stream << KEY_NOT_FOUND << ": " << key;
+ return stream.str();
+ }
+ }
+
+ class Exception: public std::runtime_error {
+ public:
+ Exception(const Mark& mark_, const std::string& msg_)
+ : std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
+ virtual ~Exception() throw() {}
+
+ Mark mark;
+ std::string msg;
+
+ private:
+ static const std::string build_what(const Mark& mark, const std::string& msg) {
+ std::stringstream output;
+ output << "yaml-cpp: error at line " << mark.line+1 << ", column " << mark.column+1 << ": " << msg;
+ return output.str();
+ }
+ };
+
+ class ParserException: public Exception {
+ public:
+ ParserException(const Mark& mark_, const std::string& msg_)
+ : Exception(mark_, msg_) {}
+ };
+
+ class RepresentationException: public Exception {
+ public:
+ RepresentationException(const Mark& mark_, const std::string& msg_)
+ : Exception(mark_, msg_) {}
+ };
+
+ // representation exceptions
+ class InvalidScalar: public RepresentationException {
+ public:
+ InvalidScalar(const Mark& mark_)
+ : RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
+ };
+
+ class KeyNotFound: public RepresentationException {
+ public:
+ template <typename T>
+ KeyNotFound(const Mark& mark_, const T& key_)
+ : RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) {}
+ };
+
+ template <typename T>
+ class TypedKeyNotFound: public KeyNotFound {
+ public:
+ TypedKeyNotFound(const Mark& mark_, const T& key_)
+ : KeyNotFound(mark_, key_), key(key_) {}
+ virtual ~TypedKeyNotFound() throw() {}
+
+ T key;
+ };
+
+ template <typename T>
+ inline TypedKeyNotFound <T> MakeTypedKeyNotFound(const Mark& mark, const T& key) {
+ return TypedKeyNotFound <T> (mark, key);
+ }
+
+ class BadDereference: public RepresentationException {
+ public:
+ BadDereference()
+ : RepresentationException(Mark::null(), ErrorMsg::BAD_DEREFERENCE) {}
+ };
+
+ class EmitterException: public Exception {
+ public:
+ EmitterException(const std::string& msg_)
+ : Exception(Mark::null(), msg_) {}
+ };
+}
+
+#endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include <memory>
+
+namespace YAML
+{
+ class Node;
+ struct IterPriv;
+
+ class YAML_CPP_API Iterator
+ {
+ public:
+ Iterator();
+ Iterator(std::auto_ptr<IterPriv> pData);
+ Iterator(const Iterator& rhs);
+ ~Iterator();
+
+ Iterator& operator = (const Iterator& rhs);
+ Iterator& operator ++ ();
+ Iterator operator ++ (int);
+ const Node& operator * () const;
+ const Node *operator -> () const;
+ const Node& first() const;
+ const Node& second() const;
+
+ friend YAML_CPP_API bool operator == (const Iterator& it, const Iterator& jt);
+ friend YAML_CPP_API bool operator != (const Iterator& it, const Iterator& jt);
+
+ private:
+ std::auto_ptr<IterPriv> m_pData;
+ };
+}
+
+#endif // ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef LTNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define LTNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+namespace YAML
+{
+ class Node;
+
+ struct ltnode {
+ bool operator()(const Node *pNode1, const Node *pNode2) const;
+ };
+}
+
+#endif // LTNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML
+{
+ struct YAML_CPP_API Mark {
+ Mark(): pos(0), line(0), column(0) {}
+
+ static const Mark null() { return Mark(-1, -1, -1); }
+
+ int pos;
+ int line, column;
+
+ private:
+ Mark(int pos_, int line_, int column_): pos(pos_), line(line_), column(column_) {}
+ };
+}
+
+#endif // MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/exceptions.h"
+#include "yaml-cpp/mark.h"
+#include "yaml-cpp/noncopyable.h"
+#include "yaml-cpp/conversion.h"
+#include "yaml-cpp/iterator.h"
+#include "yaml-cpp/ltnode.h"
+#include <iostream>
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace YAML
+{
+ class AliasManager;
+ class Content;
+ class NodeOwnership;
+ class Scanner;
+ class Emitter;
+ class EventHandler;
+
+ struct NodeType { enum value { Null, Scalar, Sequence, Map }; };
+
+ class YAML_CPP_API Node: private noncopyable
+ {
+ public:
+ friend class NodeOwnership;
+ friend class NodeBuilder;
+
+ Node();
+ ~Node();
+
+ void Clear();
+ std::auto_ptr<Node> Clone() const;
+ void EmitEvents(EventHandler& eventHandler) const;
+ void EmitEvents(AliasManager& am, EventHandler& eventHandler) const;
+
+ NodeType::value Type() const { return m_type; }
+ bool IsAliased() const;
+
+ // file location of start of this node
+ const Mark GetMark() const { return m_mark; }
+
+ // accessors
+ Iterator begin() const;
+ Iterator end() const;
+ std::size_t size() const;
+
+ // extraction of scalars
+ bool GetScalar(std::string& s) const;
+
+ // we can specialize this for other values
+ template <typename T>
+ bool Read(T& value) const;
+
+ template <typename T>
+ const T to() const;
+
+ template <typename T>
+ friend YAML_CPP_API typename enable_if<is_scalar_convertible<T> >::type operator >> (const Node& node, T& value);
+
+ // retrieval for maps and sequences
+ template <typename T>
+ const Node *FindValue(const T& key) const;
+
+ template <typename T>
+ const Node& operator [] (const T& key) const;
+
+ // specific to maps
+ const Node *FindValue(const char *key) const;
+ const Node *FindValue(char *key) const;
+ const Node& operator [] (const char *key) const;
+ const Node& operator [] (char *key) const;
+
+ // for tags
+ const std::string& Tag() const { return m_tag; }
+
+ // emitting
+ friend YAML_CPP_API Emitter& operator << (Emitter& out, const Node& node);
+
+ // ordering
+ int Compare(const Node& rhs) const;
+ friend bool operator < (const Node& n1, const Node& n2);
+
+ private:
+ explicit Node(NodeOwnership& owner);
+ Node& CreateNode();
+
+ void Init(NodeType::value type, const Mark& mark, const std::string& tag);
+
+ void MarkAsAliased();
+ void SetScalarData(const std::string& data);
+ void Append(Node& node);
+ void Insert(Node& key, Node& value);
+
+ // helper for sequences
+ template <typename, bool> friend struct _FindFromNodeAtIndex;
+ const Node *FindAtIndex(std::size_t i) const;
+
+ // helper for maps
+ template <typename T>
+ const Node& GetValue(const T& key) const;
+
+ template <typename T>
+ const Node *FindValueForKey(const T& key) const;
+
+ private:
+ std::auto_ptr<NodeOwnership> m_pOwnership;
+
+ Mark m_mark;
+ std::string m_tag;
+
+ typedef std::vector<Node *> node_seq;
+ typedef std::map<Node *, Node *, ltnode> node_map;
+
+ NodeType::value m_type;
+ std::string m_scalarData;
+ node_seq m_seqData;
+ node_map m_mapData;
+ };
+}
+
+#include "yaml-cpp/nodeimpl.h"
+#include "yaml-cpp/nodereadimpl.h"
+
+#endif // NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include "yaml-cpp/nodeutil.h"
+#include <cassert>
+
+namespace YAML
+{
+ // implementation of templated things
+ template <typename T>
+ inline const T Node::to() const {
+ T value;
+ *this >> value;
+ return value;
+ }
+
+ template <typename T>
+ inline typename enable_if<is_scalar_convertible<T> >::type operator >> (const Node& node, T& value) {
+ if(!ConvertScalar(node, value))
+ throw InvalidScalar(node.m_mark);
+ }
+
+ template <typename T>
+ inline const Node *Node::FindValue(const T& key) const {
+ switch(m_type) {
+ case NodeType::Null:
+ case NodeType::Scalar:
+ throw BadDereference();
+ case NodeType::Sequence:
+ return FindFromNodeAtIndex(*this, key);
+ case NodeType::Map:
+ return FindValueForKey(key);
+ }
+ assert(false);
+ throw BadDereference();
+ }
+
+ template <typename T>
+ inline const Node *Node::FindValueForKey(const T& key) const {
+ for(Iterator it=begin();it!=end();++it) {
+ T t;
+ if(it.first().Read(t)) {
+ if(key == t)
+ return &it.second();
+ }
+ }
+
+ return 0;
+ }
+
+ template <typename T>
+ inline const Node& Node::GetValue(const T& key) const {
+ if(const Node *pValue = FindValue(key))
+ return *pValue;
+ throw MakeTypedKeyNotFound(m_mark, key);
+ }
+
+ template <typename T>
+ inline const Node& Node::operator [] (const T& key) const {
+ return GetValue(key);
+ }
+
+ inline const Node *Node::FindValue(const char *key) const {
+ return FindValue(std::string(key));
+ }
+
+ inline const Node *Node::FindValue(char *key) const {
+ return FindValue(std::string(key));
+ }
+
+ inline const Node& Node::operator [] (const char *key) const {
+ return GetValue(std::string(key));
+ }
+
+ inline const Node& Node::operator [] (char *key) const {
+ return GetValue(std::string(key));
+ }
+}
+
+#endif // NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef NODEREADIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODEREADIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+namespace YAML
+{
+ // implementation for Node::Read
+ // (the goal is to call ConvertScalar if we can, and fall back to operator >> if not)
+ // thanks to litb from stackoverflow.com
+ // http://stackoverflow.com/questions/1386183/how-to-call-a-templated-function-if-it-exists-and-something-else-otherwise/1386390#1386390
+
+ // Note: this doesn't work on gcc 3.2, but does on gcc 3.4 and above. I'm not sure about 3.3.
+
+#if __GNUC__ && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3))
+ // trick doesn't work? Just fall back to ConvertScalar.
+ // This means that we can't use any user-defined types as keys in a map
+ template <typename T>
+ inline bool Node::Read(T& value) const {
+ return ConvertScalar(*this, value);
+ }
+#else
+ // usual case: the trick!
+ template<bool>
+ struct read_impl;
+
+ // ConvertScalar available
+ template<>
+ struct read_impl<true> {
+ template<typename T>
+ static bool read(const Node& node, T& value) {
+ return ConvertScalar(node, value);
+ }
+ };
+
+ // ConvertScalar not available
+ template<>
+ struct read_impl<false> {
+ template<typename T>
+ static bool read(const Node& node, T& value) {
+ try {
+ node >> value;
+ } catch(const Exception&) {
+ return false;
+ }
+ return true;
+ }
+ };
+
+ namespace fallback {
+ // sizeof > 1
+ struct flag { char c[2]; };
+ flag Convert(...);
+
+ int operator,(flag, flag);
+
+ template<typename T>
+ char operator,(flag, T const&);
+
+ char operator,(int, flag);
+ int operator,(char, flag);
+ }
+
+ template <typename T>
+ inline bool Node::Read(T& value) const {
+ using namespace fallback;
+
+ return read_impl<sizeof (fallback::flag(), Convert(std::string(), value), fallback::flag()) != 1>::read(*this, value);
+ }
+#endif // done with trick
+
+ // the main conversion function
+ template <typename T>
+ inline bool ConvertScalar(const Node& node, T& value) {
+ std::string scalar;
+ if(!node.GetScalar(scalar))
+ return false;
+
+ return Convert(scalar, value);
+ }
+}
+
+#endif // NODEREADIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+namespace YAML
+{
+ template <typename T, typename U>
+ struct is_same_type {
+ enum { value = false };
+ };
+
+ template <typename T>
+ struct is_same_type<T, T> {
+ enum { value = true };
+ };
+
+ template <typename T, bool check>
+ struct is_index_type_with_check {
+ enum { value = false };
+ };
+
+ template <> struct is_index_type_with_check<std::size_t, false> { enum { value = true }; };
+
+#define MAKE_INDEX_TYPE(Type) \
+ template <> struct is_index_type_with_check<Type, is_same_type<Type, std::size_t>::value> { enum { value = true }; }
+
+ MAKE_INDEX_TYPE(int);
+ MAKE_INDEX_TYPE(unsigned);
+ MAKE_INDEX_TYPE(short);
+ MAKE_INDEX_TYPE(unsigned short);
+ MAKE_INDEX_TYPE(long);
+ MAKE_INDEX_TYPE(unsigned long);
+
+#undef MAKE_INDEX_TYPE
+
+ template <typename T>
+ struct is_index_type: public is_index_type_with_check<T, false> {};
+
+ // messing around with template stuff to get the right overload for operator [] for a sequence
+ template <typename T, bool b>
+ struct _FindFromNodeAtIndex {
+ const Node *pRet;
+ _FindFromNodeAtIndex(const Node&, const T&): pRet(0) {}
+ };
+
+ template <typename T>
+ struct _FindFromNodeAtIndex<T, true> {
+ const Node *pRet;
+ _FindFromNodeAtIndex(const Node& node, const T& key): pRet(node.FindAtIndex(static_cast<std::size_t>(key))) {}
+ };
+
+ template <typename T>
+ inline const Node *FindFromNodeAtIndex(const Node& node, const T& key) {
+ return _FindFromNodeAtIndex<T, is_index_type<T>::value>(node, key).pRet;
+ }
+}
+
+#endif // NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML
+{
+ // this is basically boost::noncopyable
+ class YAML_CPP_API noncopyable
+ {
+ protected:
+ noncopyable() {}
+ ~noncopyable() {}
+
+ private:
+ noncopyable(const noncopyable&);
+ const noncopyable& operator = (const noncopyable&);
+ };
+}
+
+#endif // NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML
+{
+ class Node;
+
+ struct YAML_CPP_API _Null {};
+ inline bool operator == (const _Null&, const _Null&) { return true; }
+ inline bool operator != (const _Null&, const _Null&) { return false; }
+
+ YAML_CPP_API bool IsNull(const Node& node); // old API only
+
+ extern YAML_CPP_API _Null Null;
+}
+
+#endif // NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
--- /dev/null
+#ifndef OSTREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define OSTREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include <string>
+
+namespace YAML
+{
+ class ostream
+ {
+ public:
+ ostream();
+ ~ostream();
+
+ void reserve(unsigned size);
+ void put(char ch);
+ const char *str() const { return m_buffer; }
+
+ unsigned row() const { return m_row; }
+ unsigned col() const { return m_col; }
+ unsigned pos() const { return m_pos; }
+
+ private:
+ char *m_buffer;
+ unsigned m_pos;
+ unsigned m_size;
+
+ unsigned m_row, m_col;
+ };
+
+ ostream& operator << (ostream& out, const char *str);
+ ostream& operator << (ostream& out, const std::string& str);
+ ostream& operator << (ostream& out, char ch);
+}
+
+#endif // OSTREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/noncopyable.h"
+#include <ios>
+#include <memory>
+
+namespace YAML
+{
+ struct Directives;
+ struct Mark;
+ struct Token;
+ class EventHandler;
+ class Node;
+ class Scanner;
+
+ class YAML_CPP_API Parser: private noncopyable
+ {
+ public:
+ Parser();
+ Parser(std::istream& in);
+ ~Parser();
+
+ operator bool() const;
+
+ void Load(std::istream& in);
+ bool HandleNextDocument(EventHandler& eventHandler);
+
+ bool GetNextDocument(Node& document); // old API only
+
+ void PrintTokens(std::ostream& out);
+
+ private:
+ void ParseDirectives();
+ void HandleDirective(const Token& token);
+ void HandleYamlDirective(const Token& token);
+ void HandleTagDirective(const Token& token);
+
+ private:
+ std::auto_ptr<Scanner> m_pScanner;
+ std::auto_ptr<Directives> m_pDirectives;
+ };
+}
+
+#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include <vector>
+#include <list>
+#include <set>
+#include <map>
+
+namespace YAML
+{
+ template<typename Seq>
+ inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
+ emitter << BeginSeq;
+ for(typename Seq::const_iterator it=seq.begin();it!=seq.end();++it)
+ emitter << *it;
+ emitter << EndSeq;
+ return emitter;
+ }
+
+ template<typename T>
+ inline Emitter& operator << (Emitter& emitter, const std::vector<T>& v) {
+ return EmitSeq(emitter, v);
+ }
+
+ template<typename T>
+ inline Emitter& operator << (Emitter& emitter, const std::list<T>& v) {
+ return EmitSeq(emitter, v);
+ }
+
+ template<typename T>
+ inline Emitter& operator << (Emitter& emitter, const std::set<T>& v) {
+ return EmitSeq(emitter, v);
+ }
+
+ template <typename K, typename V>
+ inline Emitter& operator << (Emitter& emitter, const std::map<K, V>& m) {
+ typedef typename std::map <K, V> map;
+ emitter << BeginMap;
+ for(typename map::const_iterator it=m.begin();it!=m.end();++it)
+ emitter << Key << it->first << Value << it->second;
+ emitter << EndMap;
+ return emitter;
+ }
+}
+
+#endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef STLNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define STLNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+#include <vector>
+#include <map>
+
+namespace YAML
+{
+ template <typename T>
+ void operator >> (const Node& node, std::vector<T>& v)
+ {
+ v.clear();
+ v.resize(node.size());
+ for(unsigned i=0;i<node.size();++i)
+ node[i] >> v[i];
+ }
+
+
+ template <typename K, typename V>
+ void operator >> (const Node& node, std::map<K, V>& m)
+ {
+ m.clear();
+ for(Iterator it=node.begin();it!=node.end();++it) {
+ K k;
+ V v;
+ it.first() >> k;
+ it.second() >> v;
+ m[k] = v;
+ }
+ }
+}
+
+#endif // STLNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
--- /dev/null
+#ifndef TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+
+namespace YAML
+{
+ template <typename>
+ struct is_numeric { enum { value = false }; };
+
+ template <> struct is_numeric <char> { enum { value = true }; };
+ template <> struct is_numeric <unsigned char> { enum { value = true }; };
+ template <> struct is_numeric <int> { enum { value = true }; };
+ template <> struct is_numeric <unsigned int> { enum { value = true }; };
+ template <> struct is_numeric <long int> { enum { value = true }; };
+ template <> struct is_numeric <unsigned long int> { enum { value = true }; };
+ template <> struct is_numeric <short int> { enum { value = true }; };
+ template <> struct is_numeric <unsigned short int> { enum { value = true }; };
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+ template <> struct is_numeric <__int64> { enum { value = true }; };
+ template <> struct is_numeric <unsigned __int64> { enum { value = true }; };
+#else
+ template <> struct is_numeric <long long> { enum { value = true }; };
+ template <> struct is_numeric <unsigned long long> { enum { value = true }; };
+#endif
+ template <> struct is_numeric <float> { enum { value = true }; };
+ template <> struct is_numeric <double> { enum { value = true }; };
+ template <> struct is_numeric <long double> { enum { value = true }; };
+
+ template <bool, class T = void>
+ struct enable_if_c {
+ typedef T type;
+ };
+
+ template <class T>
+ struct enable_if_c<false, T> {};
+
+ template <class Cond, class T = void>
+ struct enable_if : public enable_if_c<Cond::value, T> {};
+
+ template <bool, class T = void>
+ struct disable_if_c {
+ typedef T type;
+ };
+
+ template <class T>
+ struct disable_if_c<true, T> {};
+
+ template <class Cond, class T = void>
+ struct disable_if : public disable_if_c<Cond::value, T> {};
+}
+
+#endif // TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
--- /dev/null
+#ifndef YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/parser.h"
+#include "yaml-cpp/emitter.h"
+#include "yaml-cpp/stlemitter.h"
+#include "yaml-cpp/exceptions.h"
+
+#include "yaml-cpp/node.h"
+#include "yaml-cpp/stlnode.h"
+#include "yaml-cpp/iterator.h"
+
+#endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66