Open-RJ C/C++ User's Journal Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

Record Class Reference

#include <openrj/cpp/record.hpp>

List of all members.


Detailed Description

This class represents a record in the database.
Examples:

example_cpp_1.cpp, example_cpp_2.cpp, and example_cpp_6.cpp.


Public Member Functions

 Record ()
 Default constructor.
 Record (Record const &rhs)
 Copy constructor.
Recordoperator= (Record const &rhs)
 Copy assignment operator.
String GetComment () const
 Returns the record comment string.
size_t GetNumFields () const
 Returns the number of fields in the record.
const Field operator[] (size_t index) const
 Returns the requested field.
bool has_field_with_name (char const *name, ORJField const **pfield=NULL) const
 Looks up the field, optionally returning the located field to the caller.
String operator[] (char const *name) const
 Returns the requested field.
template<typename S>
String operator[] (S const &name) const
 Returns the requested field.


Constructor & Destructor Documentation

Record (  )  [inline]

Default constructor.

Record ( Record const &  rhs  )  [inline]

Copy constructor.


Member Function Documentation

String GetComment (  )  const [inline]

Returns the record comment string.

size_t GetNumFields (  )  const [inline]

Returns the number of fields in the record.

bool has_field_with_name ( char const *  name,
ORJField const **  pfield = NULL 
) const [inline]

Looks up the field, optionally returning the located field to the caller.

Parameters:
name The name of the field to be returned.
pfield Pointer to a pointer that will be set to the returned field

Record& operator= ( Record const &  rhs  )  [inline]

Copy assignment operator.

String operator[] ( S const &  name  )  const [inline]

Returns the requested field.

Parameters:
name The index of the field to be returned.
Return values:
A Field wrapper to the requested field. If not found, an instance of std::out_of_range is thrown. There is no error return

String operator[] ( char const *  name  )  const [inline]

Returns the requested field.

Parameters:
name The index of the field to be returned.
Return values:
A Field wrapper to the requested field. If not found, an instance of std::out_of_range is thrown. There is no error return
Note:
The return type is const, to prevent confusing semantics such as ///
    /// 
    /// Record record = . . .;
    ///
    /// record["Channel"] = record["Port"]; // Doesn't have any effect!!
    /// 
    /// 
///

const Field operator[] ( size_t  index  )  const [inline]

Returns the requested field.

Parameters:
index The index of the field to be returned. Must be less than the value returned by GetNumFields()
Note:
The return type is const, to prevent confusing semantics such as ///
    /// 
    /// Record record = . . .;
    ///
    /// record[0] = record[1]; // Doesn't have any effect!!
    /// 
    /// 
///


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

Open-RJ Library documentation © Synesis Software Pty Ltd, 2004-2005