MagicSmoke  $VERSION$
MOCartVoucher Class Reference

Encapsulates vouchers as they are stored in the cart. Used by the client to tell the server about new orders. Used by the Web UI to actually store its cart. More...

#include <srcMOCartVoucher.h>

Inheritance diagram for MOCartVoucher:

Public Types

enum  ValidationState { Ok =0, InvalidValue =1, InvalidPrice =2 }
 

Public Member Functions

 MOCartVoucher ()
 default constructor: constructs an invalid instance of MOCartVoucher More...
 
 MOCartVoucher (const MOCartVoucher &)
 copy constructor: creates a (deep) copy of the object More...
 
 MOCartVoucher (const QDomElement &)
 special constructor: create from the XML representation, deserializing the object More...
 
virtual ~MOCartVoucher ()
 destructor: deletes this copy of the object More...
 
virtual Nullable< qint64 > amount () const
 
virtual Nullable< QString > cartid () const
 optional property that is used by the web user interface to identify the cart that is handled More...
 
virtual Nullable< qint64 > cartlineid () const
 optional property that can be used by the calling process to distinguish lines in the cart, the server must preserve it unchanged More...
 
MOCartVoucheroperator= (const MOCartVoucher &)
 copy assignment: creates a (deep) copy of the object More...
 
virtual Nullable< qint64 > price () const
 
 Q_ENUMS (ValidationState)
 
virtual void setamount (Nullable< qint64 > s)
 
virtual void setcartid (Nullable< QString > s)
 optional property that is used by the web user interface to identify the cart that is handled More...
 
virtual void setcartlineid (Nullable< qint64 > s)
 optional property that can be used by the calling process to distinguish lines in the cart, the server must preserve it unchanged More...
 
virtual void setprice (Nullable< qint64 > s)
 
virtual void setstatus (Nullable< ValidationState > s)
 
virtual void setvalue (Nullable< qint64 > s)
 
virtual Nullable< ValidationStatestatus () const
 
QString toString ()
 Serializes the object to XML and returns the string representation of that XML. More...
 
QDomElement toXml (QDomDocument &doc, QString name="CartVoucher")
 Transforms the object into its XML representation, the element node returned is not appended to the document - you have to do that yourself. More...
 
void toXml (QDomDocument &, QDomElement &)
 Serializes the object into the given element. More...
 
virtual Nullable< qint64 > value () const
 

Static Public Member Functions

static MOCartVoucher fromString (const QString &)
 create MOCartVoucher from XML formatted string (inverse of toString) More...
 
static MOCartVoucher fromXml (const QDomElement &)
 create MOCartVoucher from XML (inverse of toXml) More...
 
static ValidationState locstr2ValidationState (QString, bool *ok=0)
 Converts a localized string into the corresponding enum ValidationState value. More...
 
static ValidationState str2ValidationState (QString, bool *ok=0)
 Converts string into the corresponding enum ValidationState value. More...
 
static QString ValidationState2locstr (ValidationState)
 Converts enum ValidationState value into the corresponding localized string. More...
 
static QString ValidationState2str (ValidationState)
 Converts enum ValidationState value into the corresponding string. More...
 

Protected Attributes

Nullable< qint64 > mp_amount
 
Nullable< QString > mp_cartid
 
Nullable< qint64 > mp_cartlineid
 
Nullable< qint64 > mp_price
 
Nullable< ValidationStatemp_status
 
Nullable< qint64 > mp_value
 

Properties

Nullable< qint64 > amount
 
Nullable< QString > cartid
 optional property that is used by the web user interface to identify the cart that is handled More...
 
Nullable< qint64 > cartlineid
 optional property that can be used by the calling process to distinguish lines in the cart, the server must preserve it unchanged More...
 
Nullable< qint64 > price
 
Nullable< ValidationStatestatus
 
Nullable< qint64 > value
 

Detailed Description

Encapsulates vouchers as they are stored in the cart. Used by the client to tell the server about new orders. Used by the Web UI to actually store its cart.

Member Enumeration Documentation

Enumerator
Ok 

The voucher can be sold.

InvalidValue 

The value is not one of the allowed ones and you do not have the privilege to set an arbitrary one, or the value is negative or zero.

InvalidPrice 

The price is negative, the price property is ignored if you do not have the privilege to chose a price that differs from the value.

Constructor & Destructor Documentation

MOCartVoucher::MOCartVoucher ( )
inline

default constructor: constructs an invalid instance of MOCartVoucher

Referenced by fromString(), and fromXml().

MOCartVoucher::MOCartVoucher ( const MOCartVoucher o)

copy constructor: creates a (deep) copy of the object

References mp_amount, mp_cartid, mp_cartlineid, mp_price, mp_status, and mp_value.

MOCartVoucher::MOCartVoucher ( const QDomElement &  root)
explicit

special constructor: create from the XML representation, deserializing the object

References setamount(), setcartid(), setcartlineid(), setprice(), setstatus(), setvalue(), and str2ValidationState().

virtual MOCartVoucher::~MOCartVoucher ( )
inlinevirtual

destructor: deletes this copy of the object

Member Function Documentation

virtual Nullable<qint64> MOCartVoucher::amount ( ) const
inlinevirtual
virtual Nullable<QString> MOCartVoucher::cartid ( ) const
inlinevirtual

optional property that is used by the web user interface to identify the cart that is handled

virtual Nullable<qint64> MOCartVoucher::cartlineid ( ) const
inlinevirtual

optional property that can be used by the calling process to distinguish lines in the cart, the server must preserve it unchanged

MOCartVoucher MOCartVoucher::fromString ( const QString &  txt)
static

create MOCartVoucher from XML formatted string (inverse of toString)

References MOCartVoucher().

MOCartVoucher MOCartVoucher::fromXml ( const QDomElement &  root)
static

create MOCartVoucher from XML (inverse of toXml)

References MOCartVoucher().

MOCartVoucher::ValidationState MOCartVoucher::locstr2ValidationState ( QString  s,
bool *  ok = 0 
)
static

Converts a localized string into the corresponding enum ValidationState value.

References InvalidPrice, InvalidValue, and Ok.

MOCartVoucher & MOCartVoucher::operator= ( const MOCartVoucher o)

copy assignment: creates a (deep) copy of the object

References mp_amount, mp_cartid, mp_cartlineid, mp_price, mp_status, and mp_value.

virtual Nullable<qint64> MOCartVoucher::price ( ) const
inlinevirtual
MOCartVoucher::Q_ENUMS ( ValidationState  )
virtual void MOCartVoucher::setamount ( Nullable< qint64 >  s)
inlinevirtual

Referenced by MOCartVoucher().

virtual void MOCartVoucher::setcartid ( Nullable< QString >  s)
inlinevirtual

optional property that is used by the web user interface to identify the cart that is handled

Referenced by MOCartVoucher().

virtual void MOCartVoucher::setcartlineid ( Nullable< qint64 >  s)
inlinevirtual

optional property that can be used by the calling process to distinguish lines in the cart, the server must preserve it unchanged

Referenced by MOCartVoucher().

virtual void MOCartVoucher::setprice ( Nullable< qint64 >  s)
inlinevirtual

Referenced by MOCartVoucher().

virtual void MOCartVoucher::setstatus ( Nullable< ValidationState s)
inlinevirtual

Referenced by MOCartVoucher().

virtual void MOCartVoucher::setvalue ( Nullable< qint64 >  s)
inlinevirtual

Referenced by MOCartVoucher().

virtual Nullable<ValidationState> MOCartVoucher::status ( ) const
inlinevirtual
MOCartVoucher::ValidationState MOCartVoucher::str2ValidationState ( QString  s,
bool *  ok = 0 
)
static

Converts string into the corresponding enum ValidationState value.

References InvalidPrice, InvalidValue, and Ok.

Referenced by MOCartVoucher().

QString MOCartVoucher::toString ( )

Serializes the object to XML and returns the string representation of that XML.

References toXml().

QDomElement MOCartVoucher::toXml ( QDomDocument &  doc,
QString  name = "CartVoucher" 
)

Transforms the object into its XML representation, the element node returned is not appended to the document - you have to do that yourself.

Parameters
docthe DOM document node for which to generate the element
namethe name to give the generated element, per default "MOCartVoucher" is used

Referenced by toString().

void MOCartVoucher::toXml ( QDomDocument &  doc,
QDomElement &  r 
)

Serializes the object into the given element.

References mp_amount, mp_cartid, mp_cartlineid, mp_price, mp_status, and mp_value.

QString MOCartVoucher::ValidationState2locstr ( ValidationState  e)
static

Converts enum ValidationState value into the corresponding localized string.

References InvalidPrice, InvalidValue, and Ok.

QString MOCartVoucher::ValidationState2str ( ValidationState  e)
static

Converts enum ValidationState value into the corresponding string.

References InvalidPrice, InvalidValue, and Ok.

virtual Nullable<qint64> MOCartVoucher::value ( ) const
inlinevirtual

Member Data Documentation

Nullable<qint64> MOCartVoucher::mp_amount
protected

Referenced by MOCartVoucher(), operator=(), and toXml().

Nullable<QString> MOCartVoucher::mp_cartid
protected

Referenced by MOCartVoucher(), operator=(), and toXml().

Nullable<qint64> MOCartVoucher::mp_cartlineid
protected

Referenced by MOCartVoucher(), operator=(), and toXml().

Nullable<qint64> MOCartVoucher::mp_price
protected

Referenced by MOCartVoucher(), operator=(), and toXml().

Nullable<ValidationState> MOCartVoucher::mp_status
protected

Referenced by MOCartVoucher(), operator=(), and toXml().

Nullable<qint64> MOCartVoucher::mp_value
protected

Referenced by MOCartVoucher(), operator=(), and toXml().

Property Documentation

Nullable<qint64> MOCartVoucher::amount
readwrite
Nullable<QString> MOCartVoucher::cartid
readwrite

optional property that is used by the web user interface to identify the cart that is handled

Nullable<qint64> MOCartVoucher::cartlineid
readwrite

optional property that can be used by the calling process to distinguish lines in the cart, the server must preserve it unchanged

Nullable<qint64> MOCartVoucher::price
readwrite
Nullable<ValidationState> MOCartVoucher::status
readwrite
Nullable<qint64> MOCartVoucher::value
readwrite

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