Pol  Revision:f37d500
pkg.h
Go to the documentation of this file.
1 
7 #ifndef PKG_H
8 #define PKG_H
9 
10 #include <string>
11 #include <vector>
12 
13 namespace Pol
14 {
15 namespace Clib
16 {
17 class ConfigElem;
18 }
19 
24 namespace Plib
25 {
27 {
28 private:
29  friend class Package;
30  PackageList( Clib::ConfigElem& elem, const char* tag );
31  size_t sizeEstimate() const;
32  struct Elem
33  {
34  std::string pkgname;
35  std::string version;
36  };
37 
38  std::vector<Elem> elems;
39 };
40 
41 class Package
42 {
43 public:
44  Package( const std::string& pkg_dir, Clib::ConfigElem& elem );
45 
46  const std::string& dir() const;
47  const std::string& name() const;
48  const std::string& version() const;
49  std::string desc() const;
50  bool provides_system_home_page() const;
51 
52  bool check_replacements() const;
53  void check_dependencies() const;
54  void check_conflicts() const;
55 
56  size_t estimateSize() const;
57 
58 private:
59  std::string dir_;
60  std::string name_;
61  std::string version_;
62 
63  // only one of these two will be set.
64  unsigned short core_required_;
66 
70 
72 
73 private: // not implemented:
74  Package( const Package& );
75  Package& operator=( const Package& );
76 };
77 
78 
79 inline const std::string& Package::dir() const
80 {
81  return dir_;
82 }
83 inline const std::string& Package::name() const
84 {
85  return name_;
86 }
87 inline const std::string& Package::version() const
88 {
89  return version_;
90 }
91 Package* find_package( const std::string& pkgname );
92 
93 bool pkgdef_split( const std::string& spec, const Package* inpkg, const Package** outpkg,
94  std::string* path );
95 
96 void load_packaged_cfgs( const char* cfgname, const char* taglist,
97  void ( *loadentry )( const Package*, Clib::ConfigElem& ) );
98 void load_all_cfgs( const char* cfgname, const char* taglist,
99  void ( *loadentry )( const Package*, Clib::ConfigElem& ) );
100 
101 void load_packages( bool quiet = false );
102 void load_packages( const std::string& basedir, bool quiet = false );
103 void replace_packages();
104 void check_package_deps();
105 std::string GetPackageCfgPath( const Package* pkg, const std::string& filename );
106 }
107 }
108 #endif
std::string core_versionstring_required_
Definition: pkg.h:65
bool provides_system_home_page_
Definition: pkg.h:71
void load_packaged_cfgs(const char *cfgname, const char *taglist, void(*loadentry)(const Package *, Clib::ConfigElem &))
Definition: pkg.cpp:454
std::string version
Definition: pkg.h:35
void check_package_deps()
Definition: pkg.cpp:377
unsigned short core_required_
Definition: pkg.h:64
Package * find_package(const std::string &pkgname)
Definition: pkg.cpp:33
std::string name_
Definition: pkg.h:60
std::string version_
Definition: pkg.h:61
bool pkgdef_split(const std::string &spec, const Package *inpkg, const Package **outpkg, std::string *path)
Definition: pkg.cpp:410
PackageList replaces_
Definition: pkg.h:69
void load_all_cfgs(const char *cfgname, const char *taglist, void(*loadentry)(const Package *, Clib::ConfigElem &))
Definition: pkg.cpp:473
std::string pkgname
Definition: pkg.h:34
void replace_packages()
Definition: pkg.cpp:357
std::vector< Elem > elems
Definition: pkg.h:38
std::string name
Definition: osmod.cpp:943
std::string dir_
Definition: pkg.h:59
std::string GetPackageCfgPath(const Package *pkg, const std::string &filename)
Definition: pkg.cpp:491
PackageList conflicts_
Definition: pkg.h:68
PackageList requires_
Definition: pkg.h:67
Definition: berror.cpp:12
void load_packages(const std::string &basedir, bool quiet)
Definition: pkg.cpp:312