Patch by Vasilis Kaoutsis:

* Update license and author information.
* Simplified operator==().
* Removed obsolete OpenBeOS namespace.
* Some style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25757 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-06-02 11:04:46 +00:00
parent 7bdf0e452a
commit b0f4256dcd
+34 -36
View File
@@ -1,16 +1,21 @@
// ---------------------------------------------------------------------- /*
// This software is part of the OpenBeOS distribution and is covered * Copyright 2002-2008, Haiku Inc. All rights reserved.
// by the OpenBeOS license. * Distributed under the terms of the MIT License.
// *
// File Name: Volume.cpp * Authors:
// * Tyler Dauwalder, [email protected]
// Description: BVolume class * Erik Jakowatz
// ---------------------------------------------------------------------- * shadow303
* Ingo Weinhold, [email protected]
*/
/*! /*!
\file Volume.h \file Volume.h
BVolume implementation. BVolume implementation.
*/ */
#include <Volume.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
@@ -18,14 +23,10 @@
#include <Directory.h> #include <Directory.h>
#include <Node.h> #include <Node.h>
#include <Path.h> #include <Path.h>
#include <Volume.h>
#include <storage_support.h> #include <storage_support.h>
#include <syscalls.h> #include <syscalls.h>
#ifdef USE_OPENBEOS_NAMESPACE
namespace OpenBeOS {
#endif
/*! /*!
\class BVolume \class BVolume
@@ -51,18 +52,19 @@ namespace OpenBeOS {
\brief The object's initialization status. \brief The object's initialization status.
*/ */
// constructor
/*! \brief Creates an uninitialized BVolume. /*! \brief Creates an uninitialized BVolume.
InitCheck() will return \c B_NO_INIT. InitCheck() will return \c B_NO_INIT.
*/ */
BVolume::BVolume() BVolume::BVolume()
: fDevice((dev_t)-1), :
fCStatus(B_NO_INIT) fDevice((dev_t)-1),
fCStatus(B_NO_INIT)
{ {
} }
// constructor
/*! \brief Creates a BVolume and initializes it to the volume specified /*! \brief Creates a BVolume and initializes it to the volume specified
by the supplied device ID. by the supplied device ID.
@@ -72,13 +74,14 @@ BVolume::BVolume()
\param device The device ID of the volume. \param device The device ID of the volume.
*/ */
BVolume::BVolume(dev_t device) BVolume::BVolume(dev_t device)
: fDevice((dev_t)-1), :
fCStatus(B_NO_INIT) fDevice((dev_t)-1),
fCStatus(B_NO_INIT)
{ {
SetTo(device); SetTo(device);
} }
// copy constructor
/*! \brief Creates a BVolume and makes it a clone of the supplied one. /*! \brief Creates a BVolume and makes it a clone of the supplied one.
Afterwards the object refers to the same device the supplied object Afterwards the object refers to the same device the supplied object
@@ -88,12 +91,13 @@ BVolume::BVolume(dev_t device)
\param volume The volume object to be cloned. \param volume The volume object to be cloned.
*/ */
BVolume::BVolume(const BVolume &volume) BVolume::BVolume(const BVolume &volume)
: fDevice(volume.fDevice), :
fCStatus(volume.fCStatus) fDevice(volume.fDevice),
fCStatus(volume.fCStatus)
{ {
} }
// destructor
/*! \brief Frees all resources associated with the object. /*! \brief Frees all resources associated with the object.
Does nothing. Does nothing.
@@ -102,7 +106,7 @@ BVolume::~BVolume()
{ {
} }
// InitCheck
/*! \brief Returns the result of the last initialization. /*! \brief Returns the result of the last initialization.
\return \return
- \c B_OK: The object is properly initialized. - \c B_OK: The object is properly initialized.
@@ -114,7 +118,7 @@ BVolume::InitCheck(void) const
return fCStatus; return fCStatus;
} }
// SetTo
/*! \brief Re-initializes the object to refer to the volume specified by /*! \brief Re-initializes the object to refer to the volume specified by
the supplied device ID. the supplied device ID.
\param device The device ID of the volume. \param device The device ID of the volume.
@@ -142,7 +146,7 @@ BVolume::SetTo(dev_t device)
return fCStatus; return fCStatus;
} }
// Unset
/*! \brief Uninitialized the BVolume. /*! \brief Uninitialized the BVolume.
*/ */
void void
@@ -152,7 +156,7 @@ BVolume::Unset()
fCStatus = B_NO_INIT; fCStatus = B_NO_INIT;
} }
// Device
/*! \brief Returns the device ID of the volume the object refers to. /*! \brief Returns the device ID of the volume the object refers to.
\return Returns the device ID of the volume the object refers to \return Returns the device ID of the volume the object refers to
or -1, if the object is not properly initialized. or -1, if the object is not properly initialized.
@@ -163,7 +167,7 @@ BVolume::Device() const
return fDevice; return fDevice;
} }
// ==
/*! \brief Returns whether two BVolume objects are equal. /*! \brief Returns whether two BVolume objects are equal.
Two volume objects are said to be equal, if they either are both Two volume objects are said to be equal, if they either are both
@@ -176,11 +180,10 @@ BVolume::Device() const
bool bool
BVolume::operator==(const BVolume &volume) const BVolume::operator==(const BVolume &volume) const
{ {
return (InitCheck() != B_OK && volume.InitCheck() != B_OK return fDevice == volume.fDevice;
|| fDevice == volume.fDevice);
} }
// !=
/*! \brief Returns whether two BVolume objects are unequal. /*! \brief Returns whether two BVolume objects are unequal.
Two volume objects are said to be equal, if they either are both Two volume objects are said to be equal, if they either are both
@@ -196,7 +199,7 @@ BVolume::operator!=(const BVolume &volume) const
return !(*this == volume); return !(*this == volume);
} }
// =
/*! \brief Assigns another BVolume object to this one. /*! \brief Assigns another BVolume object to this one.
This object is made an exact clone of the supplied one. This object is made an exact clone of the supplied one.
@@ -215,7 +218,6 @@ BVolume::operator=(const BVolume &volume)
} }
// FBC
void BVolume::_TurnUpTheVolume1() {} void BVolume::_TurnUpTheVolume1() {}
void BVolume::_TurnUpTheVolume2() {} void BVolume::_TurnUpTheVolume2() {}
void BVolume::_TurnUpTheVolume3() {} void BVolume::_TurnUpTheVolume3() {}
@@ -224,7 +226,3 @@ void BVolume::_TurnUpTheVolume5() {}
void BVolume::_TurnUpTheVolume6() {} void BVolume::_TurnUpTheVolume6() {}
void BVolume::_TurnUpTheVolume7() {} void BVolume::_TurnUpTheVolume7() {}
void BVolume::_TurnUpTheVolume8() {} void BVolume::_TurnUpTheVolume8() {}
#ifdef USE_OPENBEOS_NAMESPACE
}
#endif