27 #ifndef __SBPROPERTYUNITCONVERTER_H__
28 #define __SBPROPERTYUNITCONVERTER_H__
30 #include "sbIPropertyUnitConverter.h"
31 #include "sbIPropertyManager.h"
32 #include <nsIStringBundle.h>
33 #include <nsStringGlue.h>
34 #include <nsIWeakReference.h>
35 #include <nsIWeakReferenceUtils.h>
36 #include <nsCOMArray.h>
45 NS_DECL_SBIPROPERTYUNIT
49 const nsAString& aShortName,
50 const nsAString& aID);
53 NS_IMETHODIMP
Init(
const nsAString & aName,
54 const nsAString & aShortName,
55 const nsAString &aID);
70 NS_DECL_SBIPROPERTYUNITCONVERTER
77 const nsAString &aUnitExternalID,
78 const nsAString &aUnitName,
79 const nsAString &aUnitShortName,
80 PRBool isNative = PR_FALSE);
87 PRFloat64 &_retVal)=0;
90 PRFloat64 &_retVal)=0;
101 PRInt32 aMinDecimals,
102 PRInt32 aMaxDecimals);
126 nsresult
SscanfFloat64(
const nsAString &aValue, PRFloat64 &aOutValue);
127 nsresult
SprintfFloat64(
const PRFloat64 aValue, nsAString &aOutValue);
130 #endif // __SBPROPERTYUNITCONVERTER_H__
NS_DECL_ISUPPORTS NS_DECL_SBIPROPERTYUNIT sbPropertyUnit()
propertyUnitMapInternal mUnitsMapInternal
void ApplyDecimalLimits(nsAString &aValue, PRInt32 aMinDecimals, PRInt32 aMaxDecimals)
nsresult SprintfFloat64(const PRFloat64 aValue, nsAString &aOutValue)
Property unit interface This interface describes a property unit.
virtual ~sbPropertyUnitConverter()
nsresult SscanfFloat64(const nsAString &aValue, PRFloat64 &aOutValue)
NS_IMETHODIMP Init(const nsAString &aName, const nsAString &aShortName, const nsAString &aID)
nsCOMPtr< sbIPropertyUnit > mUnit
void ForceToNDecimals(nsAString &aValue, PRUint32 aDecimals)
nsCOMPtr< nsIWeakReference > mPropertyInfo
virtual ~sbPropertyUnit()
void RemoveTrailingZeroes(nsAString &aValue)
NS_IMETHOD ConvertFromUnitToNative(PRFloat64 aValue, PRUint32 aUnitID, PRFloat64 &_retVal)=0
propertyUnitMap mUnitsMap
void LimitToNDecimals(nsAString &aValue, PRUint32 aDecimals)
nsCOMPtr< nsIStringBundle > mStringBundleObject
virtual PRInt32 GetAutoUnit(PRFloat64 aValue)
Property unit converter interface This is an interface songbird property converter, used to convert a property value between its various units representations.
void RegisterUnit(PRUint32 aUnitInternalID, const nsAString &aUnitExternalID, const nsAString &aUnitName, const nsAString &aUnitShortName, PRBool isNative=PR_FALSE)
nsresult PerformConversion(PRFloat64 &aValue, PRUint32 aFromUnit, PRUint32 aToUnit)
NS_IMETHOD ConvertFromNativeToUnit(PRFloat64 aValue, PRUint32 aUnitID, PRFloat64 &_retVal)=0
NS_DECL_ISUPPORTS NS_DECL_SBIPROPERTYUNITCONVERTER sbPropertyUnitConverter()
void SetStringBundle(const nsAString &aStringBundle)
nsCOMPtr< nsIStringBundleService > mStringBundleService