HaikuDepot: Added DepotInfo class

This commit is contained in:
Stephan Aßmus
2013-07-28 12:20:00 +02:00
parent 82bdec56d4
commit f34f805b1a
2 changed files with 85 additions and 0 deletions
+58
View File
@@ -189,3 +189,61 @@ PackageInfo::AddUserRating(const UserRating& rating)
{ {
return fUserRatings.Add(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);
}
+27
View File
@@ -96,4 +96,31 @@ private:
typedef List<PackageInfo, false> PackageInfoList; 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 #endif // PACKAGE_INFO_H