| | #ifndef OPENPOSE_FILESTREAM_JSON_OFSTREAM_HPP |
| | #define OPENPOSE_FILESTREAM_JSON_OFSTREAM_HPP |
| |
|
| | #include <fstream> |
| | #include <openpose/core/common.hpp> |
| |
|
| | namespace op |
| | { |
| | class OP_API JsonOfstream |
| | { |
| | public: |
| | explicit JsonOfstream(const std::string& filePath, const bool humanReadable = true); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | JsonOfstream(JsonOfstream&& jsonOfstream); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | JsonOfstream& operator=(JsonOfstream&& jsonOfstream); |
| |
|
| | virtual ~JsonOfstream(); |
| |
|
| | void objectOpen(); |
| |
|
| | void objectClose(); |
| |
|
| | void arrayOpen(); |
| |
|
| | void arrayClose(); |
| |
|
| | void version(const std::string& version); |
| |
|
| | void key(const std::string& string); |
| |
|
| | template <typename T> |
| | inline void plainText(const T& value) |
| | { |
| | *upOfstream << value; |
| | } |
| |
|
| | inline void comma() |
| | { |
| | *upOfstream << ","; |
| | } |
| |
|
| | void enter(); |
| |
|
| | private: |
| | bool mHumanReadable; |
| | long long mBracesCounter; |
| | long long mBracketsCounter; |
| | std::unique_ptr<std::ofstream> upOfstream; |
| |
|
| | DELETE_COPY(JsonOfstream); |
| | }; |
| | } |
| |
|
| | #endif |
| |
|