tageditor/cli/json.h

65 lines
1.7 KiB
C
Raw Permalink Normal View History

2018-01-15 00:14:53 +01:00
#ifndef CLI_JSON
#define CLI_JSON
#include <reflective_rapidjson/json/serializable.h>
2018-01-15 00:14:53 +01:00
2018-01-19 23:43:54 +01:00
#include <tagparser/tagtarget.h>
2018-01-15 00:14:53 +01:00
#include <c++utilities/chrono/timespan.h>
#include <unordered_map>
2018-03-06 23:10:13 +01:00
namespace TagParser {
2018-01-15 00:14:53 +01:00
class MediaFileInfo;
class Tag;
class TagValue;
}
namespace Cli {
namespace Json {
struct TagValue : ReflectiveRapidJSON::JsonSerializable<TagValue> {
2018-03-06 23:10:13 +01:00
TagValue(const TagParser::TagValue &tagValue, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
2018-01-15 00:14:53 +01:00
const char *kind = "undefined";
const std::string mimeType;
struct ValueAllowedToMove : RAPIDJSON_NAMESPACE::Value {
} value;
};
2018-01-19 23:43:54 +01:00
struct TargetInfo : ReflectiveRapidJSON::JsonSerializable<TargetInfo> {
2018-03-06 23:10:13 +01:00
using IdContainerType = TagParser::TagTarget::IdContainerType;
TargetInfo(const TagParser::TagTarget &tagTarget, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
2018-01-19 23:43:54 +01:00
2019-03-13 19:07:51 +01:00
std::uint64_t level;
2018-01-19 23:43:54 +01:00
std::string levelName;
IdContainerType tracks;
IdContainerType chapters;
IdContainerType editions;
IdContainerType attachments;
};
2018-01-15 00:14:53 +01:00
struct TagInfo : ReflectiveRapidJSON::JsonSerializable<TagInfo> {
2018-03-06 23:10:13 +01:00
TagInfo(const TagParser::Tag &tag, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
2018-01-15 00:14:53 +01:00
2021-01-30 21:57:09 +01:00
std::string_view format;
2018-01-19 23:43:54 +01:00
TargetInfo target;
2018-01-15 00:14:53 +01:00
std::unordered_map<std::string, std::vector<TagValue>> fields;
};
struct FileInfo : ReflectiveRapidJSON::JsonSerializable<FileInfo> {
2018-03-06 23:10:13 +01:00
FileInfo(const TagParser::MediaFileInfo &mediaFileInfo, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
2018-01-15 00:14:53 +01:00
std::string fileName;
std::size_t size;
2021-01-30 21:57:09 +01:00
std::string_view mimeType;
2018-01-15 00:14:53 +01:00
std::vector<TagInfo> tags;
std::string formatSummary;
2019-06-10 22:49:46 +02:00
CppUtilities::TimeSpan duration;
2018-01-15 00:14:53 +01:00
};
}
}
#endif // CLI_JSON