[kml] small formatting

This commit is contained in:
Arsentiy Milchakov 2020-09-29 18:44:37 +03:00 committed by jbenua
parent 5b946910a1
commit 801a27798d
4 changed files with 17 additions and 16 deletions

View file

@ -128,7 +128,7 @@ kml::FileData GenerateKmlFileData()
compilationData1.m_toponyms = {"8", "9"};
compilationData1.m_languageCodes = {1, 2, 8};
compilationData1.m_properties = {{"property1", "value1"}, {"property2", "value2"}};
result.m_compilationData.push_back(std::move(compilationData1));
result.m_compilationsData.push_back(std::move(compilationData1));
kml::CategoryData compilationData2;
compilationData2.m_compilationId = 4;
@ -151,7 +151,7 @@ kml::FileData GenerateKmlFileData()
compilationData2.m_toponyms = {"10", "11"};
compilationData2.m_languageCodes = {1, 2, 8};
compilationData2.m_properties = {{"property1", "value1"}, {"property2", "value2"}};
result.m_compilationData.push_back(std::move(compilationData2));
result.m_compilationsData.push_back(std::move(compilationData2));
return result;
}

View file

@ -629,7 +629,7 @@ void KmlWriter::Write(FileData const & fileData)
// Save category.
SaveCategoryData(m_writer, fileData.m_categoryData, fileData.m_serverId,
&fileData.m_compilationData);
&fileData.m_compilationsData);
// Save bookmarks.
for (auto const & bookmarkData : fileData.m_bookmarksData)
@ -926,7 +926,7 @@ void KmlParser::Pop(std::string const & tag)
}
else if (tag == kCompilation)
{
m_data.m_compilationData.push_back(std::move(m_compilationData));
m_data.m_compilationsData.push_back(std::move(m_compilationData));
m_categoryData = &m_data.m_categoryData;
}

View file

@ -110,7 +110,7 @@ public:
void SerializeCompilations(Sink & sink)
{
CategorySerializerVisitor<Sink> visitor(sink, kDoubleBits);
visitor(m_data.m_compilationData);
visitor(m_data.m_compilationsData);
}
// Serializes texts in a compressed storage with block access.
@ -128,13 +128,13 @@ private:
};
template <typename T, typename = void>
struct HasCompilationData : std::false_type
struct HasCompilationsData : std::false_type
{
};
template <typename T>
struct HasCompilationData<T, std::void_t<decltype(T::m_compilationData)>>
: std::is_same<decltype(T::m_compilationData), std::vector<CategoryData>>
struct HasCompilationsData<T, std::void_t<decltype(T::m_compilationsData)>>
: std::is_same<decltype(T::m_compilationsData), std::vector<CategoryData>>
{
};
@ -302,7 +302,7 @@ private:
DeserializeCategory(subReader, data);
DeserializeBookmarks(subReader, data);
DeserializeTracks(subReader, data);
if constexpr (HasCompilationData<FileDataType>::value)
if constexpr (HasCompilationsData<FileDataType>::value)
DeserializeCompilations(subReader, data);
DeserializeStrings(subReader, data);
}
@ -346,7 +346,7 @@ private:
auto compilationsSubReader = CreateCompilationsSubReader(*subReader);
NonOwningReaderSource src(*compilationsSubReader);
CategoryDeserializerVisitor<decltype(src)> visitor(src, m_doubleBits);
visitor(data.m_compilationData);
visitor(data.m_compilationsData);
}
template <typename FileDataType>

View file

@ -228,8 +228,8 @@ struct BookmarkData
visitor(m_boundTracks, "boundTracks"),
visitor(m_visible, "visible"),
visitor(m_nearestToponym, "nearestToponym"),
visitor(m_properties, "properties"),
visitor(m_compilations, "compilations"),
visitor(m_properties, "properties"),
VISITOR_COLLECTABLE)
DECLARE_COLLECTABLE(LocalizableStringIndex, m_name, m_description, m_customName,
@ -248,6 +248,7 @@ struct BookmarkData
m_boundTracks == data.m_boundTracks &&
m_visible == data.m_visible &&
m_nearestToponym == data.m_nearestToponym &&
m_compilations == data.m_compilations &&
m_properties == data.m_properties;
}
@ -280,10 +281,10 @@ struct BookmarkData
bool m_visible = true;
// Nearest toponym.
std::string m_nearestToponym;
// Key-value properties.
Properties m_properties;
// List of compilationIds.
std::vector<CompilationId> m_compilations;
// Key-value properties.
Properties m_properties;
};
// Note: any changes in binary format of this structure
@ -448,13 +449,13 @@ struct FileData
visitor(m_categoryData, "category"),
visitor(m_bookmarksData, "bookmarks"),
visitor(m_tracksData, "tracks"),
visitor(m_compilationData, "compilations"))
visitor(m_compilationsData, "compilations"))
bool operator==(FileData const & data) const
{
return m_serverId == data.m_serverId && m_categoryData == data.m_categoryData &&
m_bookmarksData == data.m_bookmarksData && m_tracksData == data.m_tracksData &&
m_compilationData == data.m_compilationData;
m_compilationsData == data.m_compilationsData;
}
bool operator!=(FileData const & data) const { return !operator==(data); }
@ -470,7 +471,7 @@ struct FileData
// Tracks collection.
std::vector<TrackData> m_tracksData;
// Compilation collection.
std::vector<CategoryData> m_compilationData;
std::vector<CategoryData> m_compilationsData;
};
inline std::string DebugPrint(BookmarkIcon icon)