mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-23 01:38:11 +08:00
added option to FastWriter which omits the trailing new line character
This commit is contained in:
@@ -180,16 +180,19 @@ Writer::~Writer() {}
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
|
||||
FastWriter::FastWriter()
|
||||
: yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false) {}
|
||||
: yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false), omitEndingLineFeed_(false) {}
|
||||
|
||||
void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; }
|
||||
|
||||
void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; }
|
||||
|
||||
void FastWriter::omitEndingLineFeed() { omitEndingLineFeed_ = true; }
|
||||
|
||||
std::string FastWriter::write(const Value &root) {
|
||||
document_ = "";
|
||||
writeValue(root);
|
||||
document_ += "\n";
|
||||
if (!omitEndingLineFeed_)
|
||||
document_ += "\n";
|
||||
return document_;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user