1 // Copyright (C) 2013 James Turner - zakalawe@mac.com
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Library General Public
5 // License as published by the Free Software Foundation; either
6 // version 2 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Library General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 #ifndef SG_PACKAGE_PACKAGE_HXX
19 #define SG_PACKAGE_PACKAGE_HXX
24 #include <simgear/props/props.hxx>
25 #include <simgear/misc/strutils.hxx>
27 typedef std::set<std::string> string_set;
40 typedef std::vector<Package*> PackageList;
46 * get or create an install for the package
50 bool isInstalled() const;
52 std::string id() const;
55 * human-readable name - note this is probably not localised,
56 * although this is not ruled out for the future.
58 std::string name() const;
61 * syntactic sugar to get the localised description
63 std::string description() const;
66 * access the raw property data in the package
68 SGPropertyNode* properties() const;
71 * hex-encoded MD5 sum of the download files
73 std::string md5() const;
75 std::string getLocalisedProp(const std::string& aName) const;
77 unsigned int revision() const;
79 Catalog* catalog() const
82 bool matches(const SGPropertyNode* aFilter) const;
85 * download URLs for the package
87 string_list downloadUrls() const;
89 string_list thumbnailUrls() const;
92 * Packages we depend upon.
93 * If the dependency list cannot be satisifed for some reason,
94 * this will raise an sg_exception.
96 PackageList dependencies() const;
100 Package(const SGPropertyNode* aProps, Catalog* aCatalog);
102 void initWithProps(const SGPropertyNode* aProps);
104 std::string getLocalisedString(const SGPropertyNode* aRoot, const char* aName) const;
106 SGPropertyNode_ptr m_props;
114 } // of namespace pkg
116 } // of namespace simgear
118 #endif // of SG_PACKAGE_PACKAGE_HXX