casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Member Functions | Static Private Attributes
casa::PlotMSLabelFormat Class Reference

Class for generating labels based upon axes, units, etc. More...

#include <PlotMSLabelFormat.h>

List of all members.

Public Member Functions

 PlotMSLabelFormat (const String &format="")
 Non-Static //.
 PlotMSLabelFormat (const PlotMSLabelFormat &copy)
 Copy constructor.
 ~PlotMSLabelFormat ()
 Destructor.
String getLabel (PMS::Axis axis, bool refValueSet=false, double refValue=0) const
 Generates a label, using the given single axis and reference value.
String getLabel (PMS::Axis xAxis, PMS::Axis yAxis, bool xRefValueSet=false, double xRefValue=0, bool yRefValueSet=false, double yRefValue=0) const
 Generates a label, using the given double axes and reference values.
bool operator== (const PlotMSLabelFormat &other) const
 Equality operators.
bool operator!= (const PlotMSLabelFormat &other) const
PlotMSLabelFormatoperator= (const PlotMSLabelFormat &copy)
 Copy operator.

Static Public Member Functions

static const StringTAGSEPARATOR ()
 Static //.
static const StringTAG_AXIS ()
 Tag for axes, both the single case and the double case.
static const StringTAG_XAXIS ()
static const StringTAG_YAXIS ()
static const StringTAG_UNIT ()
 Tag for axes units, both the single case and the double case.
static const StringTAG_XUNIT ()
static const StringTAG_YUNIT ()
static const StringTAG_IF_UNIT ()
 Tags for if/endif for axes units.
static const StringTAG_IF_XUNIT ()
static const StringTAG_IF_YUNIT ()
static const StringTAG_ENDIF_UNIT ()
static const StringTAG_ENDIF_XUNIT ()
static const StringTAG_ENDIF_YUNIT ()
static const StringTAG_REFVALUE ()
 Tags for axis reference values, both the single case and the double case.
static const StringTAG_XREFVALUE ()
static const StringTAG_YREFVALUE ()
static const StringTAG_IF_REFVALUE ()
 Tags for if/endif for axis reference values.
static const StringTAG_IF_XREFVALUE ()
static const StringTAG_IF_YREFVALUE ()
static const StringTAG_ENDIF_REFVALUE ()
static const StringTAG_ENDIF_XREFVALUE ()
static const StringTAG_ENDIF_YREFVALUE ()
static String TAG (const String &tag)
 Convenience method to surround the given tag with the separator.

Public Attributes

String format
 Format.

Static Private Member Functions

static String getLabel (const String &format, PMS::Axis axis, PMS::Axis xAxis, PMS::Axis yAxis, bool refValueSet, double refValue, bool xRefValueSet, double xRefValue, bool yRefValueSet, double yRefValue)
 Generates a label using the given format, single axis, and double axes.
static bool nextToken (String &format, String &token, bool &tokenWasTag)
 Helper method for getLabel() which gets the next token in the format.

Static Private Attributes

static const String REFERENCE_DATE_FORMAT
 Format for when reference values are dates.

Detailed Description

Class for generating labels based upon axes, units, etc.

A format is a String that consists of tags and non-tags. Tags are special substrings differentiated by being surrounded by a separator; tags are replaced with given values when the label is built. For example: the %axis%% tag is replaced with the name of the Axis that is passed in when generating the String. Non-tags are copied exactly into the label. An example of a format is: "%%xaxis%% vs. %%yaxis%%", when passed in the axes TIME and AMP, would return the label "time vs. amp". Currently, labels can either be single axis (like for an axis label) or double axes (like for a plot title).

Definition at line 49 of file PlotMSLabelFormat.h.


Constructor & Destructor Documentation

Non-Static //.

Constructor which takes an optional starting format.

Copy constructor.

See operator=().

Destructor.


Member Function Documentation

String casa::PlotMSLabelFormat::getLabel ( PMS::Axis  axis,
bool  refValueSet = false,
double  refValue = 0 
) const

Generates a label, using the given single axis and reference value.

If any double axes tags are in the format, the given axis will be used for them.

String casa::PlotMSLabelFormat::getLabel ( PMS::Axis  xAxis,
PMS::Axis  yAxis,
bool  xRefValueSet = false,
double  xRefValue = 0,
bool  yRefValueSet = false,
double  yRefValue = 0 
) const

Generates a label, using the given double axes and reference values.

If any single axes tags are in the format, the x axis will be used for it.

static String casa::PlotMSLabelFormat::getLabel ( const String format,
PMS::Axis  axis,
PMS::Axis  xAxis,
PMS::Axis  yAxis,
bool  refValueSet,
double  refValue,
bool  xRefValueSet,
double  xRefValue,
bool  yRefValueSet,
double  yRefValue 
) [static, private]

Generates a label using the given format, single axis, and double axes.

static bool casa::PlotMSLabelFormat::nextToken ( String format,
String token,
bool &  tokenWasTag 
) [static, private]

Helper method for getLabel() which gets the next token in the format.

Returns true if a token was returned; false if the end of the format was reached. The given format will be automatically shortened as tokens are taken out. The next token is put in the token parameter, and the tokenWasTag parameter is set to true if the token was a tag, false otherwise.

bool casa::PlotMSLabelFormat::operator!= ( const PlotMSLabelFormat other) const [inline]

Definition at line 146 of file PlotMSLabelFormat.h.

References operator==().

PlotMSLabelFormat& casa::PlotMSLabelFormat::operator= ( const PlotMSLabelFormat copy)

Copy operator.

bool casa::PlotMSLabelFormat::operator== ( const PlotMSLabelFormat other) const

Equality operators.

Referenced by operator!=().

static String casa::PlotMSLabelFormat::TAG ( const String tag) [static]

Convenience method to surround the given tag with the separator.

static const String& casa::PlotMSLabelFormat::TAG_AXIS ( ) [static]

Tag for axes, both the single case and the double case.

This tag is replaced with the axis name (see PMS::axis()) during generation.

static const String& casa::PlotMSLabelFormat::TAG_ENDIF_UNIT ( ) [static]

Tags for if/endif for axis reference values.

Parts of the format that are surrounded with an IF at the beginning and ENDIF at the end are only copied to the label if the given axis has a reference value set. For example, "TAG_IF_REFVALUE(sample text)TAG_ENDIF_REFVALUE" would copy over "(sample text)" only if the given axis had a set reference value.

static const String& casa::PlotMSLabelFormat::TAG_IF_UNIT ( ) [static]

Tags for if/endif for axes units.

Parts of the format that are surrounded with an IF at the beginning and ENDIF at the end are only copied to the label if the given unit is NOT PMS::UNONE. For example, "TAG_IF_UNIT(sample text)TAG_ENDIF_UNIT" would copy over "(sample text)" only if the given unit was NOT PMS::UNONE.

static const String& casa::PlotMSLabelFormat::TAG_IF_XUNIT ( ) [static]
static const String& casa::PlotMSLabelFormat::TAG_IF_YUNIT ( ) [static]
static const String& casa::PlotMSLabelFormat::TAG_REFVALUE ( ) [static]

Tags for axis reference values, both the single case and the double case.

This tag is replaced with the reference value for the given axis, if there is one, during generation. Note: if the associated axis is a date, the value will be in date format.

static const String& casa::PlotMSLabelFormat::TAG_UNIT ( ) [static]

Tag for axes units, both the single case and the double case.

This tag is replaced with the axis unit name (see PMS::axisUnit()) during generation.

static const String& casa::PlotMSLabelFormat::TAG_XAXIS ( ) [static]
static const String& casa::PlotMSLabelFormat::TAG_XREFVALUE ( ) [static]
static const String& casa::PlotMSLabelFormat::TAG_XUNIT ( ) [static]
static const String& casa::PlotMSLabelFormat::TAG_YAXIS ( ) [static]
static const String& casa::PlotMSLabelFormat::TAG_YREFVALUE ( ) [static]
static const String& casa::PlotMSLabelFormat::TAG_YUNIT ( ) [static]
static const String& casa::PlotMSLabelFormat::TAGSEPARATOR ( ) [static]

Static //.

Separator that goes before and after tags.


Member Data Documentation

Format.

Definition at line 128 of file PlotMSLabelFormat.h.

Format for when reference values are dates.

Definition at line 169 of file PlotMSLabelFormat.h.


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