Util: Implement Json::Value type customization for print formatting
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility> // move, swap
|
#include <utility> // move, swap
|
||||||
|
|
||||||
|
#include "util/format/format.h"
|
||||||
#include "util/json/array.h"
|
#include "util/json/array.h"
|
||||||
#include "util/json/job.h"
|
#include "util/json/job.h"
|
||||||
#include "util/json/object.h"
|
#include "util/json/object.h"
|
||||||
@@ -331,4 +332,9 @@ std::ostream& operator<<(std::ostream& output, const Value& value)
|
|||||||
return output << value.dump(4);
|
return output << value.dump(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void format(FormatBuilder& builder, const Value& value)
|
||||||
|
{
|
||||||
|
builder.putString(value.dump(4));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Json
|
} // namespace Json
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility> // forward
|
#include <utility> // forward
|
||||||
|
|
||||||
|
#include "util/format/format.h"
|
||||||
#include "util/json/fromjson.h"
|
#include "util/json/fromjson.h"
|
||||||
#include "util/json/tojson.h"
|
#include "util/json/tojson.h"
|
||||||
|
|
||||||
@@ -134,6 +135,8 @@ private:
|
|||||||
std::istream& operator>>(std::istream& input, Value& value);
|
std::istream& operator>>(std::istream& input, Value& value);
|
||||||
std::ostream& operator<<(std::ostream& output, const Value& value);
|
std::ostream& operator<<(std::ostream& output, const Value& value);
|
||||||
|
|
||||||
|
void format(FormatBuilder& builder, const Value& value);
|
||||||
|
|
||||||
} // namespace Json
|
} // namespace Json
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user