2012-07-16 09:38:18 -07: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-03 16:48:58 -07:00
|
|
|
#include "nsString.h"
|
2012-07-16 09:38:18 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace system {
|
|
|
|
|
2012-08-03 16:48:58 -07:00
|
|
|
class Volume;
|
|
|
|
|
2012-07-16 09:38:18 -07:00
|
|
|
class nsVolume : public nsIVolume
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIVOLUME
|
|
|
|
|
2012-08-03 16:48:58 -07:00
|
|
|
nsVolume(const Volume *aVolume);
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
nsVolume(const nsAString &aName, const nsAString &aMountPoint, const int32_t &aState)
|
2012-08-03 16:48:58 -07:00
|
|
|
: mName(aName), mMountPoint(aMountPoint), mState(aState)
|
2012-07-16 09:38:18 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsVolume(const nsAString &aName)
|
|
|
|
: mName(aName),
|
|
|
|
mState(STATE_INIT)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Equals(const nsVolume *aVolume)
|
|
|
|
{
|
|
|
|
return mName.Equals(aVolume->mName)
|
|
|
|
&& mMountPoint.Equals(aVolume->mMountPoint)
|
|
|
|
&& (mState == aVolume->mState);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Set(const nsVolume *aVolume)
|
|
|
|
{
|
|
|
|
mName = aVolume->mName;
|
|
|
|
mMountPoint = aVolume->mMountPoint;
|
|
|
|
mState = aVolume->mState;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsString &Name() const { return mName; }
|
|
|
|
const char *NameStr() const { return NS_LossyConvertUTF16toASCII(mName).get(); }
|
|
|
|
|
|
|
|
const nsString &MountPoint() const { return mMountPoint; }
|
|
|
|
const char *MountPointStr() const { return NS_LossyConvertUTF16toASCII(mMountPoint).get(); }
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t State() const { return mState; }
|
2012-08-03 16:48:58 -07:00
|
|
|
const char *StateStr() const { return NS_VolumeStateStr(mState); }
|
2012-07-16 09:38:18 -07:00
|
|
|
|
|
|
|
typedef nsTArray<nsRefPtr<nsVolume> > Array;
|
|
|
|
|
|
|
|
private:
|
|
|
|
~nsVolume() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsString mName;
|
|
|
|
nsString mMountPoint;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mState;
|
2012-07-16 09:38:18 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // system
|
|
|
|
} // mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_system_nsvolume_h__
|