Skip to content

Commit

Permalink
HaikuDepot: Added DepotInfo class
Browse files Browse the repository at this point in the history
  • Loading branch information
stippi committed Jul 28, 2013
1 parent 82bdec5 commit f34f805
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/apps/haiku-depot/PackageInfo.cpp
Expand Up @@ -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);
}
27 changes: 27 additions & 0 deletions src/apps/haiku-depot/PackageInfo.h
Expand Up @@ -96,4 +96,31 @@ class PackageInfo {
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

0 comments on commit f34f805

Please sign in to comment.