Qualifier Class Reference

A ScaleUnit is defined by: A range for which the scaled value is between 0 & 1 A scaler which converts any value in its range to between 0 & 1 A qualifier which may be prefixed or suffixed onto the value NB: There are no base units as such. More...

#include <scunit.h>

Inheritance diagram for Qualifier:

NullQualifier PrefixQualifier SuffixQualifier List of all members.

Public Types

enum  QUALIFIER_SHOWN { IS_NOTSHOWN = 0, IS_SHOWN = 1 }
enum  QUALIFIER_AFFIX { SUFFIX = 0, PREFIX = 1, NONE = -1 }

Public Member Functions

 Qualifier ()
 Default constructor. Scope: public.
virtual ~Qualifier ()
Qualifieroperator= (const Qualifier &OtherQualifier)
 Assignment. Required for CC_CLASS_MEMDUMP Scope: public.
BOOL SetAttributes (const String_32 &NewToken, QUALIFIER_SHOWN WhetherShown)
 Sets the Qualifier string for the unit. This is an abbreviation for a unit. E.g. "%" specifies percentage. Only characters returning TRUE from Convert::IsCharUnitType() are permitted in the qualifier token.
String_32 GetToken () const
 To determine this Qualifier's representation in a string Scope: public.
BOOL IsShown () const
 Determine whether to display the token representing the qualifier Scope: public.
virtual BOOL MakeDisplayString (const StringBase &InString, StringBase *pOutString) const =0
virtual QUALIFIER_AFFIX GetAffix () const =0

Protected Attributes

String_32 m_Token
BOOL m_bShow

Private Member Functions

 CC_DECLARE_MEMDUMP (Qualifier)

Detailed Description

A ScaleUnit is defined by: A range for which the scaled value is between 0 & 1 A scaler which converts any value in its range to between 0 & 1 A qualifier which may be prefixed or suffixed onto the value NB: There are no base units as such.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/05/96

Definition at line 120 of file scunit.h.


Member Enumeration Documentation

enum Qualifier::QUALIFIER_AFFIX
 

Enumerator:
SUFFIX 
PREFIX 
NONE 

Definition at line 131 of file scunit.h.

00132     {
00133         SUFFIX = 0,
00134         PREFIX = 1,
00135         NONE = -1
00136     };

enum Qualifier::QUALIFIER_SHOWN
 

Enumerator:
IS_NOTSHOWN 
IS_SHOWN 

Definition at line 125 of file scunit.h.

00126     {
00127         IS_NOTSHOWN = 0,
00128         IS_SHOWN = 1
00129     };


Constructor & Destructor Documentation

Qualifier::Qualifier  ) 
 

Default constructor. Scope: public.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/05/96
See also:
class Qualifier

Definition at line 128 of file scunit.cpp.

00129 {
00130     m_bShow = FALSE;
00131 }

virtual Qualifier::~Qualifier  )  [inline, virtual]
 

Definition at line 139 of file scunit.h.

00139 { }


Member Function Documentation

Qualifier::CC_DECLARE_MEMDUMP Qualifier   )  [private]
 

virtual QUALIFIER_AFFIX Qualifier::GetAffix  )  const [pure virtual]
 

Implemented in PrefixQualifier, SuffixQualifier, and NullQualifier.

String_32 Qualifier::GetToken  )  const
 

To determine this Qualifier's representation in a string Scope: public.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/05/96
Returns:
The token represeting the qualifier in a string

Definition at line 229 of file scunit.cpp.

00230 {
00231     return m_Token;
00232 }

BOOL Qualifier::IsShown  )  const
 

Determine whether to display the token representing the qualifier Scope: public.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/05/96
Returns:
TRUE : If qualifier token should be shown in a display string FALSE : otherwise

Definition at line 248 of file scunit.cpp.

00249 {
00250 
00251     return (m_bShow == IS_SHOWN);
00252 }

virtual BOOL Qualifier::MakeDisplayString const StringBase InString,
StringBase pOutString
const [pure virtual]
 

Implemented in PrefixQualifier, SuffixQualifier, and NullQualifier.

Qualifier & Qualifier::operator= const Qualifier OtherQualifier  ) 
 

Assignment. Required for CC_CLASS_MEMDUMP Scope: public.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/05/96

Definition at line 144 of file scunit.cpp.

00145 {
00146     if (&OtherQualifier == this) return *this;
00147 
00148     m_bShow = OtherQualifier.m_bShow;
00149     m_Token = OtherQualifier.m_Token;
00150     return *this;
00151 }

BOOL Qualifier::SetAttributes const String_32 NewToken,
QUALIFIER_SHOWN  WhetherShown
 

Sets the Qualifier string for the unit. This is an abbreviation for a unit. E.g. "%" specifies percentage. Only characters returning TRUE from Convert::IsCharUnitType() are permitted in the qualifier token.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/05/96
Parameters:
ParseString : a string of the form "%sTOKEN" or "TOKEN%s" signifying the [INPUTS] position of the qualifier token (TOKEN) relative to the value it's qualifying (s). WhetherShown :either QUALIFIER_SHOWN::IS_SHOWN or QUALIFIER_SHOWN::IS_NOTSHOWN
Returns:
TRUE if set ok FALSE otherwise

Errors: Parameter validation Scope: public

See also:
ScaleUnit::GetQualifier()

Definition at line 177 of file scunit.cpp.

00178 {
00179     ERROR2IF(WhetherShown != IS_SHOWN && WhetherShown != IS_NOTSHOWN, FALSE, "Not a QUALIFIER_SHOWN");
00180 
00181     INT32 nTokenLength = NewToken.Length(); 
00182     if (nTokenLength == 0)
00183     {
00184         ERROR3("Qualifier::SetAttributes - token zero length");
00185         return FALSE;
00186     }
00187     // Check for the existence of possible clash characters in the token.
00188     for (INT32 i = 0; i < nTokenLength; ++i)
00189     {
00190         // Get the next character to be checked in the new specifier string
00191         if (!Convert::IsCharUnitType(NewToken[i]))
00192         {
00193             // We found a problem character so return this result to the caller
00194             ERROR3("Qualifier::SetAttributes - invalid char in token");
00195             return FALSE;
00196         }
00197     }
00198     m_Token = NewToken;
00199 
00200     switch (WhetherShown)
00201     {
00202         case IS_SHOWN:
00203             m_bShow = TRUE;
00204             break;
00205 
00206         case IS_NOTSHOWN:
00207             m_bShow = FALSE;
00208             break;
00209 
00210         default:        // should never happen
00211             return FALSE;
00212     }
00213     return TRUE;
00214 }


Member Data Documentation

BOOL Qualifier::m_bShow [protected]
 

Definition at line 155 of file scunit.h.

String_32 Qualifier::m_Token [protected]
 

Definition at line 153 of file scunit.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:13 2007 for Camelot by  doxygen 1.4.4