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

openrj::cpp Namespace Reference


Detailed Description

The namespace of the Open-RJ/C++ mapping.

This contains the Field, Record, FileDatabase and MemoryDatabase classes, along with the exception class DatabaseException


Classes

class  DatabaseBase
 This class implements the common database manipulation for the FileDatabase and MemoryDatabase classes. More...
class  Field
 This class represents a field in a record in the database. More...
class  FileDatabase
 This class represents the Open-RJ database file, once read in and parsed. More...
class  MemoryDatabase
 This class opens and provides access to a memory-based Open-RJ database. More...
class  DatabaseException
 The exception type thrown by the Open-RJ - C++ mapping. More...
class  Record
 This class represents a record in the database. More...

Typedefs

typedef ::stlsoft::basic_string_view<
char > 
String
 Presents a standard string-like interface over the ORJStringA structure.

Functions

bool operator== (Field const &lhs, Field const &rhs)
 Evaluates to true if the two instances have identical names and values.
bool operator!= (Field const &lhs, Field const &rhs)
 Evaluates to true if the two instances have different names and/or values.
inline::stlsoft::basic_shim_string<
char, true > 
c_str_ptr_null (Field const &f)
 String access shim providing, possibly NULL, C-string access to the contents of a Field instance.
inline::stlsoft::basic_shim_string<
char > 
c_str_ptr (Field const &f)
 String access shim providing C-string access to the contents of a Field instance.
inline::stlsoft::basic_shim_string<
char > 
c_str_data (Field const &f)
 String access shim providing (potentially non-nul-terminated) C-string access to the contents of a Field instance.
size_t c_str_len (Field const &f)
 String attribute shim providing the length of the C-string form of a Field instance.
template<class S>
S & operator<< (S &s, Field const &field)
 Stream insertion shim for a Field instance.
String Lookup (char const *fieldName, Record const &r0, char const *defaultValue)
 Looks up the named field in a record, or returns a default value if not found.
String Lookup (char const *fieldName, Record const &r0, Record const &r1)
 Looks up the named field in one of two records, or throws exception if not found in either.
String Lookup (char const *fieldName, Record const &r0, Record const &r1, char const *defaultValue)
 Looks up the named field in one of two records, or returns a default value if not found in either.


Typedef Documentation

typedef ::stlsoft::basic_string_view<char> String

Presents a standard string-like interface over the ORJStringA structure.

Note:
It uses STLSoft's basic_string_view, which does not do any allocation, rather it uses the underlying storage. Therefore, you should not use any String copies from a given database once that database instance is destroyed.


Function Documentation

bool openrj::cpp::operator== ( Field const &  lhs,
Field const &  rhs 
) [inline]

Evaluates to true if the two instances have identical names and values.

bool openrj::cpp::operator!= ( Field const &  lhs,
Field const &  rhs 
) [inline]

Evaluates to true if the two instances have different names and/or values.

String openrj::cpp::Lookup ( char const *  fieldName,
Record const &  r0,
char const *  defaultValue 
) [inline]

Looks up the named field in a record, or returns a default value if not found.

Parameters:
fieldName The named of the field to be searched for
r0 The record to be searched
defaultValue The default value to be used if the named field is not found in the record
Returns:
The value matching the field found in r0, or defaultValue if not found

String openrj::cpp::Lookup ( char const *  fieldName,
Record const &  r0,
Record const &  r1 
) [inline]

Looks up the named field in one of two records, or throws exception if not found in either.

Parameters:
fieldName The named of the field to be searched for
r0 The first record to be searched
r1 The second record to be searched
Returns:
The value matching the field found in r0 or r1
Note:
If the field is not found in either record, an instance of std::out_of_range exception is thrown

String openrj::cpp::Lookup ( char const *  fieldName,
Record const &  r0,
Record const &  r1,
char const *  defaultValue 
) [inline]

Looks up the named field in one of two records, or returns a default value if not found in either.

Parameters:
fieldName The named of the field to be searched for
r0 The first record to be searched
r1 The second record to be searched
defaultValue The default value to be used if the named field is not found in either record
Returns:
The value matching the field found in r0 or r1, or defaultValue if not found in either


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