]> git.mxchange.org Git - simgear.git/blob - simgear/package/Install.hxx
LGPL license on package files.
[simgear.git] / simgear / package / Install.hxx
1 // Copyright (C) 2013  James Turner - zakalawe@mac.com
2 //
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.
7 //
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.
12 //
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.
16 //
17
18 #ifndef SG_PACKAGE_INSTALL_HXX
19 #define SG_PACKAGE_INSTALL_HXX
20
21 #include <vector>
22
23 #include <simgear/misc/sg_path.hxx>
24
25 namespace simgear
26 {
27     
28 namespace pkg
29 {
30
31 // forward decls
32 class Package;
33 class Catalog;
34     
35 /**
36  *
37  */
38 class Install
39 {
40 public:
41     /**
42      * create from a directory on disk, or fail.
43      */
44     static Install* createFromPath(const SGPath& aPath, Catalog* aCat);
45     
46     unsigned int revsion() const
47         { return m_revision; }
48     
49     Package* package() const
50         { return m_package; } 
51     
52     SGPath path() const
53         { return m_path; }
54     
55     bool hasUpdate() const;
56     
57     void startUpdate();
58     
59     void uninstall();
60     
61 // boost signals time?
62     // failure
63     // progress
64     // completed
65     
66 private:
67     friend class Package;
68     
69     class PackageArchiveDownloader;
70     friend class PackageArchiveDownloader;
71     
72     Install(Package* aPkg, const SGPath& aPath);
73     
74     void parseRevision();
75     void writeRevisionFile();
76     
77     Package* m_package;
78     unsigned int m_revision; ///< revision on disk
79     SGPath m_path; ///< installation point on disk
80     
81     PackageArchiveDownloader* m_download;
82 };
83     
84     
85 } // of namespace pkg
86
87 } // of namespace simgear
88
89 #endif // of SG_PACKAGE_CATALOG_HXX