Skip to content

Commit

Permalink
libdoomsday|libcore: Constructing profile duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Mar 27, 2016
1 parent 1f5513b commit e937108
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions doomsday/apps/libdoomsday/include/doomsday/gameprofiles.h
Expand Up @@ -38,6 +38,7 @@ class LIBDOOMSDAY_PUBLIC GameProfiles : public de::Profiles
{
public:
Profile(de::String const &name = "");
Profile(Profile const &other);

void setGame(de::String const &id);
void setPackages(de::StringList const &packagesInOrder);
Expand Down
16 changes: 15 additions & 1 deletion doomsday/apps/libdoomsday/src/gameprofiles.cpp
Expand Up @@ -99,13 +99,27 @@ DENG2_PIMPL_NOREF(GameProfiles::Profile)
String gameId;
StringList packages;
bool userCreated = false;

Instance() {}

Instance(Instance const &other)
: gameId (other.gameId)
, packages (other.packages)
, userCreated(other.userCreated)
{}
};

GameProfiles::Profile::Profile(String const &name) : d(new Instance)
GameProfiles::Profile::Profile(String const &name)
: d(new Instance)
{
setName(name);
}

GameProfiles::Profile::Profile(Profile const &other)
: AbstractProfile(other)
, d(new Instance(*other.d))
{}

void GameProfiles::Profile::setGame(String const &id)
{
d->gameId = id;
Expand Down
1 change: 1 addition & 0 deletions doomsday/sdk/libcore/include/de/data/profiles.h
Expand Up @@ -47,6 +47,7 @@ class DENG2_PUBLIC Profiles
{
public:
AbstractProfile();
AbstractProfile(AbstractProfile const &profile);

virtual ~AbstractProfile();

Expand Down
7 changes: 7 additions & 0 deletions doomsday/sdk/libcore/src/data/profiles.cpp
Expand Up @@ -346,6 +346,13 @@ Profiles::AbstractProfile::AbstractProfile()
: d(new Instance(this))
{}

Profiles::AbstractProfile::AbstractProfile(AbstractProfile const &profile)
: d(new Instance(this))
{
d->name = profile.name();
d->readOnly = profile.isReadOnly();
}

Profiles::AbstractProfile::~AbstractProfile()
{}

Expand Down

0 comments on commit e937108

Please sign in to comment.