OpenCPN Partial API docs
Loading...
Searching...
No Matches
catalog_parser.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2019 Alec Leamas *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 **************************************************************************/
19#ifndef CATALOG_PARSER_H__
20#define CATALOG_PARSER_H__
21
22#include <string>
23#include <vector>
24
33 std::string version;
34 std::string date;
35 bool undef;
36 CatalogData() : undef(true) {}
37};
38
41 std::string name;
42 std::string version;
43 std::string release;
44 std::string summary;
45
46 std::string api_version;
47 std::string author;
48 std::string description;
49 std::string git_commit;
50 std::string git_date;
51 std::string source;
52 std::string tarball_url;
53 std::string target;
54 std::string build_gtk;
55 std::string target_version;
56 std::string target_arch;
57 std::string info_url;
58 std::string meta_url;
59 std::string checksum;
60 bool is_imported;
61 bool is_orphan;
62
63 bool openSource;
64
65 bool readonly;
66 int ix;
67 void clear() { *this = PluginMetadata(); }
68 std::string key() const {
69 return name + version + release + target + target_version;
70 }
71
72 std::string to_string();
73
75 : is_imported(false),
76 is_orphan(false),
77 openSource(true),
78 readonly(true),
79 ix(-1) {}
80};
81
85struct CatalogCtx {
86 // list of plugins parsed
87 std::vector<PluginMetadata> plugins;
88
89 // list meta-urls found when parsing last plugin.
90 std::vector<std::string> meta_urls;
91 std::vector<std::string> parsed_metas;
92
93 std::string version;
94 std::string date;
95
96 // Internal data used while parsing, undefined on exit.
97 std::string buff;
98 std::string meta_url;
99 int depth;
100 CatalogCtx() : depth(0) {}
101};
102
103bool ParseCatalog(const std::string xml, CatalogCtx* ctx);
104
105bool ParsePlugin(const std::string& xml, PluginMetadata& metadata);
106
107#endif // CATALOG_PARSER_H__
The result from parsing the xml catalog i.
Overall metadata for the set of plugins used.
Plugin metadata, reflects the xml format directly.
std::string to_string()
Return printable XML representation.
int ix
Index in list of installed or available.
bool readonly
Can plugin be removed?