Skip to content

Instantly share code, notes, and snippets.

@xatest
Created July 26, 2012 08:20
Show Gist options
  • Save xatest/3180939 to your computer and use it in GitHub Desktop.
Save xatest/3180939 to your computer and use it in GitHub Desktop.
YAML printer test
#include <iostream>
#include <sstream>
using namespace std;
class YAMLPrinter
{
public:
inline void addKeyValue(const char* key, const char* value)
{
bufstream << key << " = " << value << endl;
}
inline void flushResult()
{
bufstream.flush();
cout << bufstream.str();
}
ostringstream bufstream;
};
int main()
{
YAMLPrinter printer;
printer.addKeyValue("type", "spp");
printer.flushResult();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment