MyMoneyMoney Class Reference

#include <mymoneymoney.h>

Inheritance diagram for MyMoneyMoney:

reports::PivotCell
Collaboration diagram for MyMoneyMoney:

Collaboration graph
[legend]

List of all members.

Public Types

enum  fileVersionE { FILE_4_BYTE_VALUE = 0, FILE_8_BYTE_VALUE }
enum  signPosition {
  ParensAround = 0, BeforeQuantityMoney = 1, AfterQuantityMoney = 2, BeforeMoney = 3,
  AfterMoney = 4
}
enum  roundingMethod {
  RndNever = 0, RndFloor, RndCeil, RndTrunc,
  RndPromote, RndHalfDown, RndHalfUp, RndRound
}

Public Member Functions

 MyMoneyMoney ()
 MyMoneyMoney (const int iAmount, const signed64 denom=100)
 MyMoneyMoney (const QString &pszAmount)
 MyMoneyMoney (const signed64 Amount, const signed64 denom=100)
 MyMoneyMoney (const double dAmount, const signed64 denom=100)
 MyMoneyMoney (const MyMoneyMoney &AmountInPence)
const MyMoneyMoney abs (void) const
QString formatMoney (const QString &currency, const int prec, bool showThousandSeparator=true) const
QString formatMoney (const MyMoneyAccount &acc, const MyMoneySecurity &sec, bool showThousandSeparator=true) const
QString formatMoney (const MyMoneySecurity &sec, bool showThousandSeparator=true) const
QString formatMoney (int denom, bool showThousandSeparator=true) const
const QString toString (void) const
const MyMoneyMoney convert (const signed64 denom=100, const roundingMethod how=RndRound) const
double toDouble (void) const
const MyMoneyMoneyoperator= (const MyMoneyMoney &Amount)
const MyMoneyMoneyoperator= (const QString &pszAmount)
bool operator== (const MyMoneyMoney &Amount) const
bool operator!= (const MyMoneyMoney &Amount) const
bool operator< (const MyMoneyMoney &Amount) const
bool operator> (const MyMoneyMoney &Amount) const
bool operator<= (const MyMoneyMoney &Amount) const
bool operator>= (const MyMoneyMoney &Amount) const
bool operator== (const QString &pszAmount) const
bool operator!= (const QString &pszAmount) const
bool operator< (const QString &pszAmount) const
bool operator> (const QString &pszAmount) const
bool operator<= (const QString &pszAmount) const
bool operator>= (const QString &pszAmount) const
MyMoneyMoney operator+ (const MyMoneyMoney &Amount) const
MyMoneyMoney operator- (const MyMoneyMoney &Amount) const
MyMoneyMoney operator- () const
MyMoneyMoney operator* (const MyMoneyMoney &factor) const
MyMoneyMoney operator* (int factor) const
MyMoneyMoney operator* (signed64 factor) const
MyMoneyMoney operator/ (const MyMoneyMoney &Amount) const
MyMoneyMoneyoperator+= (const MyMoneyMoney &Amount)
MyMoneyMoneyoperator-= (const MyMoneyMoney &Amount)
MyMoneyMoneyoperator/= (const MyMoneyMoney &Amount)
 operator int () const
bool isNegative () const
bool isPositive () const
bool isZero () const
bool isAutoCalc (void) const
const MyMoneyMoney reduce (void) const

Static Public Member Functions

static int denomToPrec (signed64 fract)
static signed64 precToDenom (int prec)
static void setThousandSeparator (const unsigned char)
static void setDecimalSeparator (const unsigned char)
static void setNegativeMonetarySignPosition (const signPosition pos)
static void setPositiveMonetarySignPosition (const signPosition pos)
static void setNegativePrefixCurrencySymbol (const bool flags)
static void setPositivePrefixCurrencySymbol (const bool flags)
static unsigned char thousandSeparator (void)
static unsigned char decimalSeparator (void)
static signPosition negativeMonetarySignPosition (void)
static signPosition positiveMonetarySignPosition (void)
static void setFileVersion (const fileVersionE version)

Static Public Attributes

static MyMoneyMoney maxValue
static MyMoneyMoney minValue
static MyMoneyMoney autoCalc

Private Member Functions

signed64 getLcd (const MyMoneyMoney &b) const

Private Attributes

signed64 m_num
signed64 m_denom

Static Private Attributes

static unsigned char _thousandSeparator
static unsigned char _decimalSeparator
static signPosition _negativeMonetarySignPosition
static signPosition _positiveMonetarySignPosition
static bool _negativePrefixCurrencySymbol
static bool _positivePrefixCurrencySymbol
static MyMoneyMoney::fileVersionE _fileVersion

Friends

KMYMONEY_EXPORT friend
QDataStream & 
operator<< (QDataStream &, const MyMoneyMoney &)
KMYMONEY_EXPORT friend
QDataStream & 
operator>> (QDataStream &, MyMoneyMoney &)


Detailed Description

This class represents a value within the MyMoney Engine

Author:
Michael Edwardes

Member Enumeration Documentation

Enumerator:
FILE_4_BYTE_VALUE 
FILE_8_BYTE_VALUE 

Enumerator:
ParensAround 
BeforeQuantityMoney 
AfterQuantityMoney 
BeforeMoney 
AfterMoney 

Enumerator:
RndNever 
RndFloor 
RndCeil 
RndTrunc 
RndPromote 
RndHalfDown 
RndHalfUp 
RndRound 


Constructor & Destructor Documentation

MyMoneyMoney::MyMoneyMoney (  )  [inline]

MyMoneyMoney::MyMoneyMoney ( const int  iAmount,
const signed64  denom = 100 
) [inline]

MyMoneyMoney::MyMoneyMoney ( const QString &  pszAmount  ) 

MyMoneyMoney::MyMoneyMoney ( const signed64  Amount,
const signed64  denom = 100 
) [inline]

MyMoneyMoney::MyMoneyMoney ( const double  dAmount,
const signed64  denom = 100 
) [inline]

MyMoneyMoney::MyMoneyMoney ( const MyMoneyMoney AmountInPence  )  [inline]


Member Function Documentation

const MyMoneyMoney MyMoneyMoney::abs ( void   )  const [inline]

QString MyMoneyMoney::formatMoney ( const QString &  currency,
const int  prec,
bool  showThousandSeparator = true 
) const

This method returns a formatted string according to the settings of _thousandSeparator, _decimalSeparator, _negativeMonetarySignPosition, _positiveMonetaryPosition, _negativePrefixCurrencySymbol and _positivePrefixCurrencySymbol. Those values can be modified using the appropriate set-methods.

Parameters:
currency The currency symbol
prec The number of fractional digits
showThousandSeparator should the thousandSeparator symbol be inserted (true) or not (false) (default true)

Reimplemented in reports::PivotCell.

QString MyMoneyMoney::formatMoney ( const MyMoneyAccount acc,
const MyMoneySecurity sec,
bool  showThousandSeparator = true 
) const

This is a convenience method. It behaves exactly as the above one, but takes the information about currency symbol and precision out of the MyMoneySecurity and MyMoneyAccount objects acc and sec.

QString MyMoneyMoney::formatMoney ( const MyMoneySecurity sec,
bool  showThousandSeparator = true 
) const

This is a convenience method. It behaves exactly as the above one, but takes the information about currency symbol and precision out of the MyMoneySecurity object sec.

QString MyMoneyMoney::formatMoney ( int  denom,
bool  showThousandSeparator = true 
) const

This is a convenience method. It behaves exactly as the above one, but takes the information about precision out of the denomination denom. No currency symbol is shown. If you want to see a currency symbol, please use formatMoney(const MyMoneyAccount& acc, const MyMoneySecurity& sec, bool showThousandSeparator) instead.

Note:
denom is often set to account.fraction(security).

Reimplemented in reports::PivotCell.

static int MyMoneyMoney::denomToPrec ( signed64  fract  )  [static]

This method is used to convert the smallest fraction information into the corresponding number of digits used for precision.

Parameters:
fract smallest fractional part (e.g. 100 for cents)
Returns:
number of precision digits (e.g. 2 for cents)

const QString MyMoneyMoney::toString ( void   )  const

const MyMoneyMoney MyMoneyMoney::convert ( const signed64  denom = 100,
const roundingMethod  how = RndRound 
) const

static signed64 MyMoneyMoney::precToDenom ( int  prec  )  [static]

double MyMoneyMoney::toDouble ( void   )  const

static void MyMoneyMoney::setThousandSeparator ( const unsigned  char  )  [static]

static void MyMoneyMoney::setDecimalSeparator ( const unsigned  char  )  [static]

static void MyMoneyMoney::setNegativeMonetarySignPosition ( const signPosition  pos  )  [static]

static void MyMoneyMoney::setPositiveMonetarySignPosition ( const signPosition  pos  )  [static]

static void MyMoneyMoney::setNegativePrefixCurrencySymbol ( const bool  flags  )  [static]

static void MyMoneyMoney::setPositivePrefixCurrencySymbol ( const bool  flags  )  [static]

static unsigned char MyMoneyMoney::thousandSeparator ( void   )  [static]

static unsigned char MyMoneyMoney::decimalSeparator ( void   )  [static]

static signPosition MyMoneyMoney::negativeMonetarySignPosition ( void   )  [static]

static signPosition MyMoneyMoney::positiveMonetarySignPosition ( void   )  [static]

static void MyMoneyMoney::setFileVersion ( const fileVersionE  version  )  [static]

const MyMoneyMoney & MyMoneyMoney::operator= ( const MyMoneyMoney Amount  )  [inline]

const MyMoneyMoney & MyMoneyMoney::operator= ( const QString &  pszAmount  )  [inline]

bool MyMoneyMoney::operator== ( const MyMoneyMoney Amount  )  const [inline]

bool MyMoneyMoney::operator!= ( const MyMoneyMoney Amount  )  const [inline]

bool MyMoneyMoney::operator< ( const MyMoneyMoney Amount  )  const [inline]

bool MyMoneyMoney::operator> ( const MyMoneyMoney Amount  )  const [inline]

bool MyMoneyMoney::operator<= ( const MyMoneyMoney Amount  )  const [inline]

bool MyMoneyMoney::operator>= ( const MyMoneyMoney Amount  )  const [inline]

bool MyMoneyMoney::operator== ( const QString &  pszAmount  )  const [inline]

bool MyMoneyMoney::operator!= ( const QString &  pszAmount  )  const [inline]

bool MyMoneyMoney::operator< ( const QString &  pszAmount  )  const

bool MyMoneyMoney::operator> ( const QString &  pszAmount  )  const

bool MyMoneyMoney::operator<= ( const QString &  pszAmount  )  const

bool MyMoneyMoney::operator>= ( const QString &  pszAmount  )  const

MyMoneyMoney MyMoneyMoney::operator+ ( const MyMoneyMoney Amount  )  const

MyMoneyMoney MyMoneyMoney::operator- ( const MyMoneyMoney Amount  )  const

MyMoneyMoney MyMoneyMoney::operator- (  )  const [inline]

MyMoneyMoney MyMoneyMoney::operator* ( const MyMoneyMoney factor  )  const

MyMoneyMoney MyMoneyMoney::operator* ( int  factor  )  const [inline]

MyMoneyMoney MyMoneyMoney::operator* ( signed64  factor  )  const [inline]

MyMoneyMoney MyMoneyMoney::operator/ ( const MyMoneyMoney Amount  )  const

MyMoneyMoney & MyMoneyMoney::operator+= ( const MyMoneyMoney Amount  )  [inline]

Reimplemented in reports::PivotCell.

MyMoneyMoney & MyMoneyMoney::operator-= ( const MyMoneyMoney Amount  )  [inline]

MyMoneyMoney & MyMoneyMoney::operator/= ( const MyMoneyMoney Amount  )  [inline]

MyMoneyMoney::operator int (  )  const

bool MyMoneyMoney::isNegative (  )  const [inline]

bool MyMoneyMoney::isPositive (  )  const [inline]

bool MyMoneyMoney::isZero (  )  const [inline]

bool MyMoneyMoney::isAutoCalc ( void   )  const [inline]

const MyMoneyMoney MyMoneyMoney::reduce ( void   )  const

signed64 MyMoneyMoney::getLcd ( const MyMoneyMoney b  )  const [private]


Friends And Related Function Documentation

KMYMONEY_EXPORT friend QDataStream& operator<< ( QDataStream &  ,
const MyMoneyMoney  
) [friend]

KMYMONEY_EXPORT friend QDataStream& operator>> ( QDataStream &  ,
MyMoneyMoney  
) [friend]


Member Data Documentation

unsigned char MyMoneyMoney::_thousandSeparator [static, private]

unsigned char MyMoneyMoney::_decimalSeparator [static, private]


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

Generated on Wed Jan 26 13:09:17 2011 for KMyMoney by  doxygen 1.5.6