Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWDecimalPortable

Module:  Essential Tools Module   Group:  Traditional Collection Classes


RWDecimalPortable RWDecimalBase

Local Index

Members

Non-Members

Synopsis

#include <rw/tools/decport.h>

RWDecimalPortable dec;     // construct a decimal == 0
dec = "1.23";              // construct a decimal == 1.23

Description

RWDecimalPortable represents an arbitrary precision decimal fraction.

When constructing a RWDecimalPortable from a string, the constructor parses the initial characters of the string until the first non-digit, behaving similarly to C's strtod)( function. For example, a string "99E44"

If an RWDecimalPortable is provided an invalid string, either in the constructor or through assignment, it does not throw an exception. Use isNumber() to determine if the object is valid.

Note that:

Related Classes

RWDecimalBase contains the following enum, used by the round() method:

enum RoundingMethod { PLAIN = 0, UP = 1, DOWN = 2,
BANKERS = 3, TRUNCATE = 2 };

Public Constructors

RWDecimalPortable();
RWDecimalPortable(const char* input);
RWDecimalPortable(long intPart);

Public Member Functions

virtual RWspace
binaryStoreSize() const;
friend unsigned
hash() const;
bool
isNumber() const;

NOTE -- Note: In this instance, the mathematical rather than the RDBMS meaning of NULL is intended. Please see the entry for the RWDBNullIndicator class in the SourcePro DB Reference Guide.
RWCString
asString(const RWLocale&) const;
RWCString
asString() const;
friend void
restoreFrom(RWFile& file);
friend void
restoreFrom(RWvistream& vis);
friend void
saveOn(RWFile& file) const;
friend void
saveOn(RWvostream& vos) const;
void
trimZeros();

Related Global Functions

RWDecimalPortable
round(const RWDecimalPortable&,
      int digits,
      RoundingMethod = RWDecimalBase::PLAIN);
double
toDouble(const RWDecimalPortable&);

Related Global Operators

RWDecimalPortable 
operator-(const RWDecimalPortable&);
RWDecimalPortable 
operator+(const RWDecimalPortable&, const RWDecimalPortable&);
RWDecimalPortable 
operator-(const RWDecimalPortable&, const RWDecimalPortable&);
RWDecimalPortable 
operator*(const RWDecimalPortable&, const RWDecimalPortable&);
bool 
operator==(const RWDecimalPortable& x,
           const RWDecimalPortable& y);
bool 
operator>=(const RWDecimalPortable& x,
           const RWDecimalPortable& y);
bool 
operator!=(const RWDecimalPortable& x,
           const RWDecimalPortable& y);
bool 
operator<(const RWDecimalPortable& x,
          const RWDecimalPortable& y);
bool 
operator>(const RWDecimalPortable& x,
          const RWDecimalPortable& y);
bool 
operator<=(const RWDecimalPortable& x,
           const RWDecimalPortable& y);
ostream&
operator<<(ostream&, const RWDecimalPortable&);
ostream&
operator>>(istream&, RWDecimalPortable&);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.