mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-16 21:58:08 +00:00
Serialize cacheFormat as string literal
This commit is contained in:
parent
c0a9b7189f
commit
a7bf90f50b
@ -201,6 +201,22 @@ void Reflect(TVisitor& visitor, IndexFile& value) {
|
|||||||
REFLECT_MEMBER_END();
|
REFLECT_MEMBER_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Reflect(Reader& visitor, SerializeFormat& value) {
|
||||||
|
std::string fmt = visitor.GetString();
|
||||||
|
value = fmt[0] == 'm' ? SerializeFormat::MessagePack : SerializeFormat::Json;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reflect(Writer& visitor, SerializeFormat& value) {
|
||||||
|
switch (value) {
|
||||||
|
case SerializeFormat::Json:
|
||||||
|
visitor.String("json");
|
||||||
|
break;
|
||||||
|
case SerializeFormat::MessagePack:
|
||||||
|
visitor.String("msgpack");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Serialize(SerializeFormat format, IndexFile& file) {
|
std::string Serialize(SerializeFormat format, IndexFile& file) {
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
@ -253,7 +253,12 @@ void ReflectMember(Reader& visitor, const char* name, T& value) {
|
|||||||
visitor.DoMember(name, [&](Reader& child) { Reflect(child, value); });
|
visitor.DoMember(name, [&](Reader& child) { Reflect(child, value); });
|
||||||
}
|
}
|
||||||
|
|
||||||
MAKE_REFLECT_TYPE_PROXY(SerializeFormat, int)
|
// Specializations
|
||||||
|
|
||||||
|
void Reflect(Reader& visitor, SerializeFormat& value);
|
||||||
|
void Reflect(Writer& visitor, SerializeFormat& value);
|
||||||
|
|
||||||
|
// API
|
||||||
|
|
||||||
std::string Serialize(SerializeFormat format, IndexFile& file);
|
std::string Serialize(SerializeFormat format, IndexFile& file);
|
||||||
std::unique_ptr<IndexFile> Deserialize(SerializeFormat format,
|
std::unique_ptr<IndexFile> Deserialize(SerializeFormat format,
|
||||||
|
Loading…
Reference in New Issue
Block a user