[280] | 1 | /* rcacheactor.h |
---|
| 2 | * |
---|
| 3 | * Copyright (c) 2003 Michael Vogt <mvo@debian.org> |
---|
| 4 | * |
---|
| 5 | * Author: Michael Vogt <mvo@debian.org> |
---|
| 6 | * |
---|
| 7 | * This program is free software; you can redistribute it and/or |
---|
| 8 | * modify it under the terms of the GNU General Public License as |
---|
| 9 | * published by the Free Software Foundation; either version 2 of the |
---|
| 10 | * License, or (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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
| 20 | * USA |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | #ifndef RPACKAGELISTACTOR_H |
---|
| 24 | #define RPACKAGELISTACTOR_H |
---|
| 25 | |
---|
| 26 | #include "rpackagelister.h" |
---|
| 27 | #include <iostream> |
---|
| 28 | |
---|
| 29 | class RPackageListActor : public RPackageObserver { |
---|
| 30 | |
---|
| 31 | public: |
---|
| 32 | |
---|
| 33 | enum listEvent { |
---|
| 34 | PKG_ADDED, |
---|
| 35 | PKG_REMOVED |
---|
| 36 | }; |
---|
| 37 | |
---|
| 38 | protected: |
---|
| 39 | |
---|
| 40 | RPackageLister *_lister; |
---|
| 41 | vector<RPackage *> _lastDisplayList; |
---|
| 42 | |
---|
| 43 | public: |
---|
| 44 | |
---|
| 45 | virtual void run(vector<RPackage *> &List, int listEvent) = 0; |
---|
| 46 | |
---|
| 47 | virtual void notifyPreFilteredChange() { |
---|
| 48 | updateState(); |
---|
| 49 | }; |
---|
| 50 | |
---|
| 51 | virtual void notifyPostFilteredChange(); |
---|
| 52 | virtual void notifyChange(RPackage *pkg) {}; |
---|
| 53 | |
---|
| 54 | virtual void updateState() { |
---|
| 55 | _lastDisplayList = _lister->getPackages(); |
---|
| 56 | }; |
---|
| 57 | |
---|
| 58 | RPackageListActor(RPackageLister *lister) |
---|
| 59 | : _lister(lister) { |
---|
| 60 | _lister->registerObserver(this); |
---|
| 61 | }; |
---|
| 62 | |
---|
| 63 | virtual ~RPackageListActor() { |
---|
| 64 | _lister->unregisterObserver(this); |
---|
| 65 | }; |
---|
| 66 | }; |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | #endif |
---|
| 70 | |
---|
| 71 | // vim:sts=3:sw=3 |
---|