Audacity 3.2.0
UpdateDataParser.h
Go to the documentation of this file.
1/*!********************************************************************
2 Audacity: A Digital Audio Editor
3
4 @file UpdateDataParser.h
5 @brief Declare a class that parses update server data format.
6
7 Anton Gerasimov
8 **********************************************************************/
9#pragma once
10
11#include "VersionPatch.h"
12
13#include "XMLTagHandler.h"
14
15#include <wx/arrstr.h>
16#include <map>
17
19class UpdateDataParser final : public XMLTagHandler
20{
21public:
24
26
31 bool Parse(const VersionPatch::UpdateDataFormat& updateData, VersionPatch* versionPatch);
32
33private:
34 enum class XmlParsedTags : int {
35 kNotUsedTag,
36 kUpdateTag,
37 kDescriptionTag,
38 kOsTag,
39 kWin32Tag,
40 kWin64Tag,
41 kMacosTag,
42 kLinuxTag,
43 kVersionTag,
44 kLinkTag
45 };
47
48 std::map<XmlParsedTags, const char*> mXmlTagNames{
49 { XmlParsedTags::kUpdateTag, "Updates" },
50 { XmlParsedTags::kDescriptionTag, "Description" },
51 { XmlParsedTags::kOsTag, "OS" },
52 { XmlParsedTags::kWin32Tag, "Win32" },
53 { XmlParsedTags::kWin64Tag, "Win64" },
54 { XmlParsedTags::kMacosTag, "Macos" },
55 { XmlParsedTags::kLinuxTag, "Linux" },
56 { XmlParsedTags::kVersionTag, "Version" },
57 { XmlParsedTags::kLinkTag, "Link" },
58 };
59
60 bool HandleXMLTag(
61 const std::string_view& tag, const AttributesList& attrs) override;
62 void HandleXMLEndTag(const std::string_view& tag) override;
63 void HandleXMLContent(const std::string_view& content) override;
64 XMLTagHandler* HandleXMLChild(const std::string_view& tag) override;
65
66 wxArrayString SplitChangelogSentences(const wxString& changelogContent);
67
69};
Declare a structure that describes patch fields.
std::vector< Attribute > AttributesList
Definition: XMLTagHandler.h:40
A class that parses update server data format.
bool Parse(const VersionPatch::UpdateDataFormat &updateData, VersionPatch *versionPatch)
Parsing from update data format to VersionPatch fields.
std::map< XmlParsedTags, const char * > mXmlTagNames
bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs) override
void HandleXMLEndTag(const std::string_view &tag) override
XMLTagHandler * HandleXMLChild(const std::string_view &tag) override
VersionPatch * mVersionPatch
XmlParsedTags mXmlParsingState
void HandleXMLContent(const std::string_view &content) override
wxArrayString SplitChangelogSentences(const wxString &changelogContent)
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:42
A structure that describes patch fields.
Definition: VersionPatch.h:15
std::string UpdateDataFormat
Definition: VersionPatch.h:16