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, see <https://www.gnu.org/licenses/>. *
16
**************************************************************************/
17
24
25
#ifndef CATALOG_PARSER_H_
26
#define CATALOG_PARSER_H_
27
28
#include <string>
29
#include <vector>
30
32
struct
CatalogData {
33
std::string version;
34
std::string date;
35
bool
undef;
36
CatalogData() : undef(
true
) {}
37
};
38
40
struct
PluginMetadata {
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
74
PluginMetadata()
75
: is_imported(false),
76
is_orphan(false),
77
openSource(true),
78
readonly
(true),
79
ix
(-1) {}
80
};
81
85
struct
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
103
bool
ParseCatalog(
const
std::string xml,
CatalogCtx
* ctx);
104
105
bool
ParsePlugin(
const
std::string& xml,
PluginMetadata
& metadata);
106
107
#endif
// CATALOG_PARSER_H_
CatalogCtx
The result from parsing the xml catalog i.
Definition
catalog_parser.h:85
PluginMetadata
Plugin metadata, reflects the xml format directly.
Definition
catalog_parser.h:40
PluginMetadata::to_string
std::string to_string()
Return printable XML representation.
Definition
catalog_parser.cpp:44
PluginMetadata::ix
int ix
Index in list of installed or available.
Definition
catalog_parser.h:66
PluginMetadata::readonly
bool readonly
Can plugin be removed?
Definition
catalog_parser.h:65
model
include
model
catalog_parser.h
Generated on
for OpenCPN Partial API docs by
1.15.0