Created
July 26, 2012 08:20
-
-
Save xatest/3180939 to your computer and use it in GitHub Desktop.
YAML printer test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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