sbStoragePropertyUnitConverter Class Reference

#include <sbStoragePropertyUnitConverter.h>

Inheritance diagram for sbStoragePropertyUnitConverter:
[legend]
Collaboration diagram for sbStoragePropertyUnitConverter:
[legend]

Public Types

enum  {
  STORAGE_UNIT_BYTE, STORAGE_UNIT_KILOBYTE, STORAGE_UNIT_MEGABYTE, STORAGE_UNIT_GIGABYTE,
  STORAGE_UNIT_TERABYTE, STORAGE_UNIT_PETABYTE, STORAGE_UNIT_EXABYTE
}
 

Public Member Functions

 sbStoragePropertyUnitConverter ()
 
virtual ~sbStoragePropertyUnitConverter ()
 
virtual PRInt32 GetAutoUnit (PRFloat64 aValue)
 
- Public Member Functions inherited from sbPropertyUnitConverter
NS_DECL_ISUPPORTS
NS_DECL_SBIPROPERTYUNITCONVERTER 
sbPropertyUnitConverter ()
 
virtual ~sbPropertyUnitConverter ()
 
- Public Member Functions inherited from sbIPropertyUnitConverter
AString convert (in AString aValue, in AString aFromUnitID, in AString aToUnitID, in long aMinDecimals, in long aMaxDecimals)
 Convert a value to a different unit. Use -1 for aMinDecimals and aMaxDecimals if you do not wish to set any limits on the number of decimals in the returned value. More...
 
AString autoFormat (in AString aValue, in long aMinDecimals, in long aMaxDecimals)
 Formats a value using the most suitable unit. Use -1 for aMinDecimals and aMaxDecimals if you do not wish to set any limits on the number of decimals in the returned value. More...
 

Protected Member Functions

NS_IMETHOD ConvertFromNativeToUnit (PRFloat64 aValue, PRUint32 aUnitID, PRFloat64 &_retVal)
 
NS_IMETHOD ConvertFromUnitToNative (PRFloat64 aValue, PRUint32 aUnitID, PRFloat64 &_retVal)
 
- Protected Member Functions inherited from sbPropertyUnitConverter
void RegisterUnit (PRUint32 aUnitInternalID, const nsAString &aUnitExternalID, const nsAString &aUnitName, const nsAString &aUnitShortName, PRBool isNative=PR_FALSE)
 
void SetStringBundle (const nsAString &aStringBundle)
 
nsresult PerformConversion (PRFloat64 &aValue, PRUint32 aFromUnit, PRUint32 aToUnit)
 
void RemoveTrailingZeroes (nsAString &aValue)
 
void LimitToNDecimals (nsAString &aValue, PRUint32 aDecimals)
 
void ForceToNDecimals (nsAString &aValue, PRUint32 aDecimals)
 
void ApplyDecimalLimits (nsAString &aValue, PRInt32 aMinDecimals, PRInt32 aMaxDecimals)
 
nsresult SscanfFloat64 (const nsAString &aValue, PRFloat64 &aOutValue)
 
nsresult SprintfFloat64 (const PRFloat64 aValue, nsAString &aOutValue)
 

Additional Inherited Members

- Public Attributes inherited from sbIPropertyUnitConverter
readonly attribute
nsISimpleEnumerator 
units
 The list of available units for this property. More...
 
readonly attribute AString nativeUnitId
 The native unit for this property. This is the unit used for storage in the database, and that is implied when getting and setting the property. More...
 
readonly attribute AString stringBundle
 The url to the string bundle used to localize partial entities. More...
 
attribute sbIPropertyInfo propertyInfo
 The sbIPropertyInfo this converter is associated with. This attribute will be set automatically by the propertyinfo object when its converter is assigned. More...
 
- Protected Attributes inherited from sbPropertyUnitConverter
PRLock * mLock
 
nsString mNative
 
PRUint32 mNativeInternal
 
nsString mStringBundle
 
nsCOMPtr< nsIStringBundleService > mStringBundleService
 
nsCOMPtr< nsIStringBundle > mStringBundleObject
 
propertyUnitMap mUnitsMap
 
propertyUnitMapInternal mUnitsMapInternal
 
propertyUnitList mUnits
 
PRUnichar mDecimalPoint
 
nsCOMPtr< nsIWeakReference > mPropertyInfo
 

Detailed Description

Definition at line 30 of file sbStoragePropertyUnitConverter.h.

Member Enumeration Documentation

anonymous enum
Enumerator
STORAGE_UNIT_BYTE 
STORAGE_UNIT_KILOBYTE 
STORAGE_UNIT_MEGABYTE 
STORAGE_UNIT_GIGABYTE 
STORAGE_UNIT_TERABYTE 
STORAGE_UNIT_PETABYTE 
STORAGE_UNIT_EXABYTE 

Definition at line 35 of file sbStoragePropertyUnitConverter.h.

Constructor & Destructor Documentation

sbStoragePropertyUnitConverter::sbStoragePropertyUnitConverter ( )

Definition at line 33 of file sbStoragePropertyUnitConverter.cpp.

Here is the call graph for this function:

sbStoragePropertyUnitConverter::~sbStoragePropertyUnitConverter ( )
virtual

Definition at line 68 of file sbStoragePropertyUnitConverter.cpp.

Member Function Documentation

NS_IMETHODIMP sbStoragePropertyUnitConverter::ConvertFromNativeToUnit ( PRFloat64  aValue,
PRUint32  aUnitID,
PRFloat64 &  _retVal 
)
protectedvirtual

Implements sbPropertyUnitConverter.

Definition at line 74 of file sbStoragePropertyUnitConverter.cpp.

NS_IMETHODIMP sbStoragePropertyUnitConverter::ConvertFromUnitToNative ( PRFloat64  aValue,
PRUint32  aUnitID,
PRFloat64 &  _retVal 
)
protectedvirtual

Implements sbPropertyUnitConverter.

Definition at line 109 of file sbStoragePropertyUnitConverter.cpp.

PRInt32 sbStoragePropertyUnitConverter::GetAutoUnit ( PRFloat64  aValue)
virtual

Reimplemented from sbPropertyUnitConverter.

Definition at line 142 of file sbStoragePropertyUnitConverter.cpp.

Here is the call graph for this function:


The documentation for this class was generated from the following files: