HaikuDepot: Added DepotInfo class
This commit is contained in:
@@ -189,3 +189,61 @@ PackageInfo::AddUserRating(const UserRating& rating)
|
||||
{
|
||||
return fUserRatings.Add(rating);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
DepotInfo::DepotInfo()
|
||||
:
|
||||
fTitle(),
|
||||
fPackages()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DepotInfo::DepotInfo(const BString& title)
|
||||
:
|
||||
fTitle(title),
|
||||
fPackages()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DepotInfo::DepotInfo(const DepotInfo& other)
|
||||
:
|
||||
fTitle(other.fTitle),
|
||||
fPackages(other.fPackages)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DepotInfo&
|
||||
DepotInfo::operator=(const DepotInfo& other)
|
||||
{
|
||||
fTitle = other.fTitle;
|
||||
fPackages = other.fPackages;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DepotInfo::operator==(const DepotInfo& other) const
|
||||
{
|
||||
return fTitle == other.fTitle
|
||||
&& fPackages == other.fPackages;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DepotInfo::operator!=(const DepotInfo& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DepotInfo::AddPackage(const PackageInfo& package)
|
||||
{
|
||||
return fPackages.Add(package);
|
||||
}
|
||||
|
||||
@@ -96,4 +96,31 @@ private:
|
||||
typedef List<PackageInfo, false> PackageInfoList;
|
||||
|
||||
|
||||
class DepotInfo {
|
||||
public:
|
||||
DepotInfo();
|
||||
DepotInfo(const BString& title);
|
||||
DepotInfo(const DepotInfo& other);
|
||||
|
||||
DepotInfo& operator=(const DepotInfo& other);
|
||||
bool operator==(const DepotInfo& other) const;
|
||||
bool operator!=(const DepotInfo& other) const;
|
||||
|
||||
const BString& Title() const
|
||||
{ return fTitle; }
|
||||
|
||||
const PackageInfoList& PackageList() const
|
||||
{ return fPackages; }
|
||||
|
||||
bool AddPackage(const PackageInfo& package);
|
||||
|
||||
private:
|
||||
BString fTitle;
|
||||
PackageInfoList fPackages;
|
||||
};
|
||||
|
||||
|
||||
typedef List<DepotInfo, false> DepotInfoList;
|
||||
|
||||
|
||||
#endif // PACKAGE_INFO_H
|
||||
|
||||
Reference in New Issue
Block a user