libRocket
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | List of all members
Rocket::Controls::DataSource Class Referenceabstract

#include <DataSource.h>

Public Member Functions

 DataSource (const Rocket::Core::String &name="")
 
virtual ~DataSource ()
 
const Rocket::Core::String & GetDataSourceName ()
 
virtual void GetRow (Rocket::Core::StringList &row, const Rocket::Core::String &table, int row_index, const Rocket::Core::StringList &columns)=0
 
virtual int GetNumRows (const Rocket::Core::String &table)=0
 
void AttachListener (DataSourceListener *listener)
 
void DetachListener (DataSourceListener *listener)
 
virtual void * GetScriptObject () const
 

Static Public Member Functions

static DataSource * GetDataSource (const Rocket::Core::String &data_source_name)
 

Static Public Attributes

static const Rocket::Core::String CHILD_SOURCE
 
static const Rocket::Core::String DEPTH
 
static const Rocket::Core::String NUM_CHILDREN
 

Protected Types

typedef std::map
< Rocket::Core::String,
Rocket::Core::String > 
RowMap
 Helper function for building a result set. More...
 

Protected Member Functions

void NotifyRowAdd (const Rocket::Core::String &table, int first_row_added, int num_rows_added)
 
void NotifyRowRemove (const Rocket::Core::String &table, int first_row_removed, int num_rows_removed)
 
void NotifyRowChange (const Rocket::Core::String &table, int first_row_changed, int num_rows_changed)
 
void NotifyRowChange (const Rocket::Core::String &table)
 
void BuildRowEntries (Rocket::Core::StringList &row, const RowMap &row_map, const Rocket::Core::StringList &columns)
 

Detailed Description

Generic object that provides a database-like interface for requesting rows from a table.

Author
Robert Curry

Member Typedef Documentation

Helper function for building a result set.

Constructor & Destructor Documentation

Rocket::Controls::DataSource::DataSource ( const Rocket::Core::String &  name = "")
virtual Rocket::Controls::DataSource::~DataSource ( )
virtual

Member Function Documentation

void Rocket::Controls::DataSource::AttachListener ( DataSourceListener *  listener)
void Rocket::Controls::DataSource::BuildRowEntries ( Rocket::Core::StringList &  row,
const RowMap &  row_map,
const Rocket::Core::StringList &  columns 
)
protected
void Rocket::Controls::DataSource::DetachListener ( DataSourceListener *  listener)
static DataSource* Rocket::Controls::DataSource::GetDataSource ( const Rocket::Core::String &  data_source_name)
static
const Rocket::Core::String& Rocket::Controls::DataSource::GetDataSourceName ( )
virtual int Rocket::Controls::DataSource::GetNumRows ( const Rocket::Core::String &  table)
pure virtual

Fetches the number of rows within one of this data source's tables.

Parameters
[in]tableThe name of the table to query.
Returns
The number of rows within the specified table.
virtual void Rocket::Controls::DataSource::GetRow ( Rocket::Core::StringList &  row,
const Rocket::Core::String &  table,
int  row_index,
const Rocket::Core::StringList &  columns 
)
pure virtual

Fetches the contents of one row of a table within the data source.

Parameters
[out]rowThe list of values in the table.
[in]tableThe name of the table to query.
[in]row_indexThe index of the desired row.
[in]columnsThe list of desired columns within the row.
virtual void* Rocket::Controls::DataSource::GetScriptObject ( ) const
virtual
void Rocket::Controls::DataSource::NotifyRowAdd ( const Rocket::Core::String &  table,
int  first_row_added,
int  num_rows_added 
)
protected

Tells all attached listeners that one or more rows have been added to the data source.

Parameters
[in]tableThe name of the table to have rows added to it.
[in]first_row_addedThe index of the first row added.
[in]num_rows_addedThe number of rows added (including the first row).
void Rocket::Controls::DataSource::NotifyRowChange ( const Rocket::Core::String &  table,
int  first_row_changed,
int  num_rows_changed 
)
protected

Tells all attached listeners that one or more rows have been changed in the data source.

Parameters
[in]tableThe name of the table to have rows changed in it.
[in]first_row_changedThe index of the first row changed.
[in]num_rows_changedThe number of rows changed (including the first row).
void Rocket::Controls::DataSource::NotifyRowChange ( const Rocket::Core::String &  table)
protected

Tells all attached listeners that the row structure has completely changed in the data source.

Parameters
[in]tableThe name of the table to have rows changed in it.
void Rocket::Controls::DataSource::NotifyRowRemove ( const Rocket::Core::String &  table,
int  first_row_removed,
int  num_rows_removed 
)
protected

Tells all attached listeners that one or more rows have been removed from the data source.

Parameters
[in]tableThe name of the table to have rows removed from it.
[in]first_row_removedThe index of the first row removed.
[in]num_rows_removedThe number of rows removed (including the first row).

Member Data Documentation

const Rocket::Core::String Rocket::Controls::DataSource::CHILD_SOURCE
static
const Rocket::Core::String Rocket::Controls::DataSource::DEPTH
static
const Rocket::Core::String Rocket::Controls::DataSource::NUM_CHILDREN
static

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