CARDS 2.4.87
Package manager for the NuTyX GNU/Linux distribution
cards_client.h
1 /*
2  * cards_client.h
3  *
4  * Copyright 2017 Gianni Peschiutta <artemia@nutyx.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  *
22  */
23 
24 #ifndef CARDS_CLIENT_H
25 #define CARDS_CLIENT_H
26 
27 #include <cstddef>
28 
29 #include <libcards.h>
30 
31 #include "cards_log.h"
32 
33 namespace cards
34 {
35  using namespace std;
36 
37  // Define Cards_wrapper singleton for friendship
38  class CWrapper;
39  class CClient;
40 
41  // Abstract Class to enable events callbacks
43  {
44  friend CClient;
45  protected:
46  virtual void OnProgressInfo(int percent){}
47  };
48 
56  class CClient : public Pkginst
57  {
58  // Only Cards_wrapper can own this class
59  friend CWrapper;
60 
61  protected:
67  CClient ();
68 
76  virtual ~CClient (){};
77 
85  set<string> ListOfInstalledPackages();
86 
92  void InstallPackages(const set<string>& pPackageList);
93 
99  void RemovePackages(const set<string>& pPackageList);
105  void subscribeToEvents(CClientEvents* pCallBack);
106 
112  void unsubscribeFromEvents(CClientEvents* pCallBack);
113 
114  protected:
115  void progressInfo();
116 
117  private:
118  CLogger* _log;
119  void getLocalePackagesList();
120  vector<CClientEvents*> _arrCallback;
121  };
122 }
123 #endif // CARDS_WRAPPER_H
Definition: cards_client.h:56
Definition: cards_wrapper.h:58
Definition: cards_log.h:52
Definition: cards_client.cxx:26
Definition: cards_client.h:42
virtual ~CClient()
Destructor.
Definition: cards_client.h:76
Definition: libcards.h:1737