CARDS 2.4.140
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 * Copyright 2017 - 2020 Thierry Nuttens <tnut@nutyx.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 * MA 02110-1301, USA.
21 *
22 *
23 */
24
25#ifndef CARDS_CLIENT_H
26#define CARDS_CLIENT_H
27
28#include <cstddef>
29
30#include <libcards.h>
31
32#include "cards_log.h"
33
34namespace cards
35{
36 using namespace std;
37
38 // Define Cards_wrapper singleton for friendship
39 class CWrapper;
40 class CClient;
41
42 // Abstract Class to enable events callbacks
44 {
45 friend CClient;
46 protected:
47 virtual void OnProgressInfo(int percent){}
48 };
49
57 class CClient : public Pkginst
58 {
59 // Only Cards_wrapper can own this class
60 friend CWrapper;
61
62 protected:
68 CClient ();
69
77 virtual ~CClient (){};
78
86 set<string> ListOfInstalledPackages();
87
93 void InstallPackages(const set<string>& pPackageList);
94
100 void RemovePackages(const set<string>& pPackageList);
106 void subscribeToEvents(CClientEvents* pCallBack);
107
113 void unsubscribeFromEvents(CClientEvents* pCallBack);
114
115 protected:
116 void progressInfo();
117
118 private:
119 CLogger* _log;
120 void getLocalePackagesList();
121 vector<CClientEvents*> _arrCallback;
122 };
123}
124#endif // CARDS_WRAPPER_H
Definition: libcards.h:1791
Definition: cards_client.h:44
Definition: cards_client.h:58
void InstallPackages(const set< string > &pPackageList)
Install a package list.
Definition: cards_client.cxx:51
virtual ~CClient()
Destructor.
Definition: cards_client.h:77
void RemovePackages(const set< string > &pPackageList)
Remove a package list.
Definition: cards_client.cxx:97
void unsubscribeFromEvents(CClientEvents *pCallBack)
Unsuscribe from CARDS Events.
Definition: cards_client.cxx:227
set< string > ListOfInstalledPackages()
Get list of installed package.
Definition: cards_client.cxx:38
CClient()
Constructor.
Definition: cards_client.cxx:30
void subscribeToEvents(CClientEvents *pCallBack)
Suscribe to CARDS events.
Definition: cards_client.cxx:220
Definition: cards_log.h:54
Definition: cards_wrapper.h:60