From 04ed91ac9c2b281050bcdb7b571b31060e8907b1 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 28 Jul 2007 14:56:02 +0000 Subject: [PATCH] Added copy constructor and assignment operator. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21729 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/storage/DiskSystem.h | 3 +++ src/kits/storage/DiskSystem.cpp | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/headers/private/storage/DiskSystem.h b/headers/private/storage/DiskSystem.h index 3954c2bf99..1b5e95b8c6 100644 --- a/headers/private/storage/DiskSystem.h +++ b/headers/private/storage/DiskSystem.h @@ -15,6 +15,7 @@ struct user_disk_system_info; class BDiskSystem { public: BDiskSystem(); + BDiskSystem(const BDiskSystem& other); ~BDiskSystem(); status_t InitCheck() const; @@ -47,6 +48,8 @@ public: bool IsFileSystem() const; bool IsSubSystemFor(BPartition *parent) const; + BDiskSystem& operator=(const BDiskSystem& other); + private: status_t _SetTo(disk_system_id id); status_t _SetTo(user_disk_system_info *info); diff --git a/src/kits/storage/DiskSystem.cpp b/src/kits/storage/DiskSystem.cpp index d845cd3ca9..1c5056324f 100644 --- a/src/kits/storage/DiskSystem.cpp +++ b/src/kits/storage/DiskSystem.cpp @@ -18,6 +18,15 @@ BDiskSystem::BDiskSystem() { } +// copy constructor +BDiskSystem::BDiskSystem(const BDiskSystem& other) + : fID(other.fID), + fName(other.fName), + fPrettyName(other.fPrettyName), + fFlags(other.fFlags) +{ +} + // destructor BDiskSystem::~BDiskSystem() { @@ -267,6 +276,18 @@ BDiskSystem::IsSubSystemFor(BPartition *parent) const parent->_ChangeCounter())); } +// = +BDiskSystem& +BDiskSystem::operator=(const BDiskSystem& other) +{ + fID = other.fID; + fName = other.fName; + fPrettyName = other.fPrettyName; + fFlags = other.fFlags; + + return *this; +} + // _SetTo status_t BDiskSystem::_SetTo(disk_system_id id)