casa
$Rev:20696$
|
Class for generating labels based upon axes, units, etc. More...
#include <PlotMSLabelFormat.h>
Public Member Functions | |
PlotMSLabelFormat (const String &format="") | |
Non-Static //. | |
PlotMSLabelFormat (const PlotMSLabelFormat ©) | |
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 |
PlotMSLabelFormat & | operator= (const PlotMSLabelFormat ©) |
Copy operator. | |
Static Public Member Functions | |
static const String & | TAGSEPARATOR () |
Static //. | |
static const String & | TAG_AXIS () |
Tag for axes, both the single case and the double case. | |
static const String & | TAG_XAXIS () |
static const String & | TAG_YAXIS () |
static const String & | TAG_UNIT () |
Tag for axes units, both the single case and the double case. | |
static const String & | TAG_XUNIT () |
static const String & | TAG_YUNIT () |
static const String & | TAG_IF_UNIT () |
Tags for if/endif for axes units. | |
static const String & | TAG_IF_XUNIT () |
static const String & | TAG_IF_YUNIT () |
static const String & | TAG_ENDIF_UNIT () |
static const String & | TAG_ENDIF_XUNIT () |
static const String & | TAG_ENDIF_YUNIT () |
static const String & | TAG_REFVALUE () |
Tags for axis reference values, both the single case and the double case. | |
static const String & | TAG_XREFVALUE () |
static const String & | TAG_YREFVALUE () |
static const String & | TAG_IF_REFVALUE () |
Tags for if/endif for axis reference values. | |
static const String & | TAG_IF_XREFVALUE () |
static const String & | TAG_IF_YREFVALUE () |
static const String & | TAG_ENDIF_REFVALUE () |
static const String & | TAG_ENDIF_XREFVALUE () |
static const String & | TAG_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. |
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.
casa::PlotMSLabelFormat::PlotMSLabelFormat | ( | const String & | format = "" | ) |
Non-Static //.
Constructor which takes an optional starting format.
casa::PlotMSLabelFormat::PlotMSLabelFormat | ( | const PlotMSLabelFormat & | copy | ) |
Copy constructor.
See operator=().
Destructor.
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_REFVALUE | ( | ) | [static] |
static const String& casa::PlotMSLabelFormat::TAG_ENDIF_UNIT | ( | ) | [static] |
static const String& casa::PlotMSLabelFormat::TAG_ENDIF_XREFVALUE | ( | ) | [static] |
static const String& casa::PlotMSLabelFormat::TAG_ENDIF_XUNIT | ( | ) | [static] |
static const String& casa::PlotMSLabelFormat::TAG_ENDIF_YREFVALUE | ( | ) | [static] |
static const String& casa::PlotMSLabelFormat::TAG_ENDIF_YUNIT | ( | ) | [static] |
static const String& casa::PlotMSLabelFormat::TAG_IF_REFVALUE | ( | ) | [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_XREFVALUE | ( | ) | [static] |
static const String& casa::PlotMSLabelFormat::TAG_IF_XUNIT | ( | ) | [static] |
static const String& casa::PlotMSLabelFormat::TAG_IF_YREFVALUE | ( | ) | [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.
Format.
Definition at line 128 of file PlotMSLabelFormat.h.
const String casa::PlotMSLabelFormat::REFERENCE_DATE_FORMAT [static, private] |
Format for when reference values are dates.
Definition at line 169 of file PlotMSLabelFormat.h.