LiveSupport::Core::RdsItem Class Reference

#include <RdsItem.h>

Inheritance diagram for LiveSupport::Core::RdsItem:

[legend]
Collaboration diagram for LiveSupport::Core::RdsItem:

[legend]
List of all members.

Detailed Description

A class for representing an RDS key - value pair.

This object has to be configured with an XML configuration element called rdsItem. This may look like the following:


  <rdsItem     key     = "PS"
                  value   = "BBC Four"
                  enabled = "1" />
  

The possible key values are PS, PI, RT, etc (see http://en.wikipedia.org/wiki/Radio_Data_System).

There value attribute can be any string.

The enabled attribute is either 0 (disabled) or 1 (enabled).

The DTD for the expected XML element looks like the following:


  <!ELEMENT rdsItem   EMPTY >
  <!ATTLIST rdsItem   key      CDATA   REQUIRED >
  <!ATTLIST rdsItem   value    CDATA   REQUIRED >
  <!ATTLIST rdsItem   enabled  CDATA   REQUIRED >
  

Author:
Author
fgerlits
Version:
Revision
3185
See also:
RdsItemContainer

Definition at line 95 of file RdsItem.h.

Public Member Functions

 RdsItem () throw ()
 Default constructor.
 RdsItem (Ptr< const Glib::ustring >::Ref key, Ptr< const Glib::ustring >::Ref value, bool enabled=false) throw ()
 Constructor which sets the variables.
virtual ~RdsItem (void) throw ()
 A virtual destructor, as this class has virtual functions.
virtual void configure (const xmlpp::Element &element) throw (std::invalid_argument)
 Configure the object based on an XML configuration element.
Ptr< const Glib::ustring
>::Ref 
getKey (void) throw ()
 Get the key.
Ptr< const Glib::ustring
>::Ref 
getValue (void) throw ()
 Get the value.
void setValue (Ptr< const Glib::ustring >::Ref value) throw ()
 Set the value.
bool getEnabled (void) throw ()
 Get the enabled/disabled flag.
void setEnabled (bool enabled) throw ()
 Set the enabled/disabled flag.
Ptr< Glib::ustring >::Ref toString (void) throw ()
 Convert the object to a string.
const xmlpp::Element * toXmlElement (void) throw ()
 Convert the object to XML.
bool isTouched (void) throw ()
 Tells you whether the object has been touched since the last save.

Static Public Member Functions

static const std::string getConfigElementName (void) throw ()
 Return the name of the XML element this object expects to be sent to a call to configure().


Constructor & Destructor Documentation

LiveSupport::Core::RdsItem::RdsItem (  )  throw () [inline]

Default constructor.

Definition at line 133 of file RdsItem.h.

LiveSupport::Core::RdsItem::RdsItem ( Ptr< const Glib::ustring >::Ref  key,
Ptr< const Glib::ustring >::Ref  value,
bool  enabled = false 
) throw () [inline]

Constructor which sets the variables.

Definition at line 142 of file RdsItem.h.

virtual LiveSupport::Core::RdsItem::~RdsItem ( void   )  throw () [inline, virtual]

A virtual destructor, as this class has virtual functions.

Definition at line 156 of file RdsItem.h.


Member Function Documentation

void RdsItem::configure ( const xmlpp::Element &  element  )  throw (std::invalid_argument) [virtual]

Configure the object based on an XML configuration element.

Parameters:
element the XML configuration element.
Exceptions:
std::invalid_argument if the supplied XML element contains bad configuration information

Implements LiveSupport::Core::Configurable.

Definition at line 80 of file RdsItem.cxx.

References enabledAttributeName, keyAttributeName, and valueAttributeName.

static const std::string LiveSupport::Core::RdsItem::getConfigElementName ( void   )  throw () [inline, static]

Return the name of the XML element this object expects to be sent to a call to configure().

Returns:
the name of the expected XML configuration element.

Definition at line 167 of file RdsItem.h.

bool LiveSupport::Core::RdsItem::getEnabled ( void   )  throw () [inline]

Get the enabled/disabled flag.

Returns:
true if the RDS item is enabled, false if not.

Definition at line 227 of file RdsItem.h.

Ptr<const Glib::ustring>::Ref LiveSupport::Core::RdsItem::getKey ( void   )  throw () [inline]

Get the key.

The key can be a 0 pointer if the object has not been configured yet.

Returns:
the key of this RDS item.

Definition at line 191 of file RdsItem.h.

Ptr<const Glib::ustring>::Ref LiveSupport::Core::RdsItem::getValue ( void   )  throw () [inline]

Get the value.

The value can be a 0 pointer if the object has not been configured yet.

Returns:
the key of this RDS item.

Definition at line 204 of file RdsItem.h.

bool LiveSupport::Core::RdsItem::isTouched ( void   )  throw () [inline]

Tells you whether the object has been touched since the last save.

Starts out false; set to true by setValue() and setEnabled(); set back to false by toXmlElement().

Returns:
whether the object has been touched.

Definition at line 269 of file RdsItem.h.

void LiveSupport::Core::RdsItem::setEnabled ( bool  enabled  )  throw () [inline]

Set the enabled/disabled flag.

Parameters:
enabled the new value of the flag.

Definition at line 238 of file RdsItem.h.

void LiveSupport::Core::RdsItem::setValue ( Ptr< const Glib::ustring >::Ref  value  )  throw () [inline]

Set the value.

Parameters:
value the new value of this RDS item.

Definition at line 215 of file RdsItem.h.

Ptr< Glib::ustring >::Ref RdsItem::toString ( void   )  throw ()

Convert the object to a string.

Returns:
a string which can be sent to the RDS encoder.

Definition at line 129 of file RdsItem.cxx.

const xmlpp::Element * RdsItem::toXmlElement ( void   )  throw ()

Convert the object to XML.

Returns:
an XML Element, which can be passed to configure() to create an object identical to this one.

Definition at line 148 of file RdsItem.cxx.

References enabledAttributeName, keyAttributeName, and valueAttributeName.


The documentation for this class was generated from the following files:
Generated on Sat Sep 22 02:00:38 2007 for Campcaster by  1.4.7