add method to determine if a capacity is valid

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=887292
This commit is contained in:
Volker Lanz 2008-11-21 13:56:39 +00:00
parent 0f917174a5
commit 2c6d5c97ee
2 changed files with 10 additions and 0 deletions

View File

@ -171,6 +171,14 @@ QString Capacity::unitName(Unit u)
return unitNames[u];
}
/** Determine if the capacity is valid.
@return true if it is valid
*/
bool Capacity::isValid() const
{
return m_Size >= 0;
}
QString Capacity::toStringInternal(qint64 unitSize) const
{
if (m_Size < 0)

View File

@ -65,6 +65,8 @@ class Capacity
QString unitName() const;
Unit bestUnit() const;
bool isValid() const;
static const QString& invalidString() { return m_InvalidString; } /**< @return string representing an invalid capacity */
static QString unitName(Unit u);
static qint64 unitFactor(Unit from, Unit to);