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