HaikuDepot: Add interface for PackageInfoListener.
Also defines PackageInfoEvent.
This commit is contained in:
parent
779d8213e9
commit
9202a719e1
@ -38,6 +38,7 @@ Application HaikuDepot :
|
||||
MainWindow.cpp
|
||||
Model.cpp
|
||||
PackageInfo.cpp
|
||||
PackageInfoListener.cpp
|
||||
PackageInfoView.cpp
|
||||
PackageListView.cpp
|
||||
PackageManager.cpp
|
||||
|
84
src/apps/haiku-depot/PackageInfoListener.cpp
Normal file
84
src/apps/haiku-depot/PackageInfoListener.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright 2013, Stephan Aßmus <superstippi@gmx.de>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "PackageInfoListener.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
// #pragma mark - PackageInfoEvent
|
||||
|
||||
|
||||
PackageInfoEvent::PackageInfoEvent()
|
||||
:
|
||||
fPackage(),
|
||||
fChanges(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PackageInfoEvent::PackageInfoEvent(const PackageInfoRef& package,
|
||||
uint32 changes)
|
||||
:
|
||||
fPackage(package),
|
||||
fChanges(changes)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PackageInfoEvent::PackageInfoEvent(const PackageInfoEvent& other)
|
||||
:
|
||||
fPackage(other.fPackage),
|
||||
fChanges(other.fChanges)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PackageInfoEvent::~PackageInfoEvent()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PackageInfoEvent::operator==(const PackageInfoEvent& other)
|
||||
{
|
||||
if (this == &other)
|
||||
return true;
|
||||
|
||||
return fPackage == other.fPackage
|
||||
&& fChanges == other.fChanges;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PackageInfoEvent::operator!=(const PackageInfoEvent& other)
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
|
||||
PackageInfoEvent&
|
||||
PackageInfoEvent::operator=(const PackageInfoEvent& other)
|
||||
{
|
||||
if (this != &other) {
|
||||
fPackage = other.fPackage;
|
||||
fChanges = other.fChanges;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - PackageInfoListener
|
||||
|
||||
|
||||
PackageInfoListener::PackageInfoListener()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PackageInfoListener::~PackageInfoListener()
|
||||
{
|
||||
}
|
54
src/apps/haiku-depot/PackageInfoListener.h
Normal file
54
src/apps/haiku-depot/PackageInfoListener.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013, Stephan Aßmus <superstippi@gmx.de>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef PACKAGE_INFO_LISTENER_H
|
||||
#define PACKAGE_INFO_LISTENER_H
|
||||
|
||||
|
||||
#include "PackageInfo.h"
|
||||
|
||||
|
||||
enum {
|
||||
PKG_CHANGED_DESCRIPTION = 1 << 0,
|
||||
PKG_CHANGED_RATINGS = 1 << 1,
|
||||
PKG_CHANGED_SCREENSHOTS = 1 << 2,
|
||||
// ...
|
||||
};
|
||||
|
||||
|
||||
class PackageInfoEvent {
|
||||
public:
|
||||
PackageInfoEvent();
|
||||
PackageInfoEvent(const PackageInfoRef& package,
|
||||
uint32 changes);
|
||||
PackageInfoEvent(const PackageInfoEvent& other);
|
||||
virtual ~PackageInfoEvent();
|
||||
|
||||
bool operator==(const PackageInfoEvent& other);
|
||||
bool operator!=(const PackageInfoEvent& other);
|
||||
PackageInfoEvent& operator=(const PackageInfoEvent& other);
|
||||
|
||||
inline const PackageInfoRef& Package() const
|
||||
{ return fPackage; }
|
||||
|
||||
inline uint32 Changes() const
|
||||
{ return fChanges; }
|
||||
|
||||
private:
|
||||
PackageInfoRef fPackage;
|
||||
uint32 fChanges;
|
||||
};
|
||||
|
||||
|
||||
class PackageInfoListener {
|
||||
public:
|
||||
PackageInfoListener();
|
||||
virtual ~PackageInfoListener();
|
||||
|
||||
virtual void PackageChanged(
|
||||
const PackageInfoEvent& event) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // PACKAGE_INFO_LISTENER_H
|
Loading…
Reference in New Issue
Block a user