clarify Builders

This commit is contained in:
Christopher Dunn
2015-02-09 01:29:43 -06:00
parent 249fd18114
commit 66a8ba255f
5 changed files with 26 additions and 23 deletions

View File

@@ -274,21 +274,27 @@ public:
}; // Factory
}; // CharReader
/** \brief Build a CharReader implementation.
Usage:
\code
using namespace Json;
CharReaderBuilder builder;
builder.collectComments_ = true;
std::shared_ptr<CharReader> reader(
builder.newCharReader());
Value value;
std::string errs;
bool ok = parseFromStream(std::cin, &value, &errs);
\endcode
*/
class CharReaderBuilder : public CharReader::Factory {
public:
bool collectComments_;
Features features_;
public:
CharReaderBuilder();
CharReaderBuilder& withCollectComments(bool v) {
collectComments_ = v;
return *this;
}
CharReaderBuilder& withFeatures(Features const& v) {
features_ = v;
return *this;
}
virtual ~CharReaderBuilder();
virtual CharReader* newCharReader() const;
};