2012-07-16 20:38:18 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_system_nsvolume_h__
|
|
|
|
#define mozilla_system_nsvolume_h__
|
|
|
|
|
|
|
|
#include "nsIVolume.h"
|
2012-08-04 03:48:58 +04:00
|
|
|
#include "nsString.h"
|
2012-07-16 20:38:18 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace system {
|
|
|
|
|
2012-08-04 03:48:58 +04:00
|
|
|
class Volume;
|
|
|
|
|
2012-07-16 20:38:18 +04:00
|
|
|
class nsVolume : public nsIVolume
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIVOLUME
|
|
|
|
|
2013-01-08 10:59:32 +04:00
|
|
|
nsVolume(const Volume *aVolume);
|
2012-08-04 03:48:58 +04:00
|
|
|
|
2013-01-08 10:59:32 +04:00
|
|
|
nsVolume(const nsAString &aName, const nsAString &aMountPoint, const int32_t &aState)
|
|
|
|
: mName(aName), mMountPoint(aMountPoint), mState(aState)
|
2012-07-16 20:38:18 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-01-08 10:59:32 +04:00
|
|
|
nsVolume(const nsAString &aName)
|
2012-07-16 20:38:18 +04:00
|
|
|
: mName(aName),
|
2013-01-08 10:59:32 +04:00
|
|
|
mState(STATE_INIT)
|
2012-07-16 20:38:18 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-01-08 10:59:32 +04:00
|
|
|
bool Equals(const nsVolume *aVolume)
|
2012-07-16 20:38:18 +04:00
|
|
|
{
|
|
|
|
return mName.Equals(aVolume->mName)
|
|
|
|
&& mMountPoint.Equals(aVolume->mMountPoint)
|
2013-01-08 10:59:32 +04:00
|
|
|
&& (mState == aVolume->mState);
|
2012-07-16 20:38:18 +04:00
|
|
|
}
|
|
|
|
|
2013-01-08 10:59:32 +04:00
|
|
|
void Set(const nsVolume *aVolume)
|
|
|
|
{
|
|
|
|
mName = aVolume->mName;
|
|
|
|
mMountPoint = aVolume->mMountPoint;
|
|
|
|
mState = aVolume->mState;
|
|
|
|
}
|
2012-07-16 20:38:18 +04:00
|
|
|
|
2013-01-08 10:59:32 +04:00
|
|
|
const nsString &Name() const { return mName; }
|
|
|
|
const char *NameStr() const { return NS_LossyConvertUTF16toASCII(mName).get(); }
|
2012-12-15 04:01:34 +04:00
|
|
|
|
2013-01-08 10:59:32 +04:00
|
|
|
const nsString &MountPoint() const { return mMountPoint; }
|
|
|
|
const char *MountPointStr() const { return NS_LossyConvertUTF16toASCII(mMountPoint).get(); }
|
2012-07-16 20:38:18 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t State() const { return mState; }
|
2013-01-08 10:59:32 +04:00
|
|
|
const char *StateStr() const { return NS_VolumeStateStr(mState); }
|
2012-07-16 20:38:18 +04:00
|
|
|
|
|
|
|
typedef nsTArray<nsRefPtr<nsVolume> > Array;
|
|
|
|
|
|
|
|
private:
|
|
|
|
~nsVolume() {}
|
|
|
|
|
2013-01-08 10:59:32 +04:00
|
|
|
protected:
|
2012-07-16 20:38:18 +04:00
|
|
|
nsString mName;
|
|
|
|
nsString mMountPoint;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mState;
|
2012-07-16 20:38:18 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // system
|
|
|
|
} // mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_system_nsvolume_h__
|