Listing 3
// Use of .netSTL c_string_accessor for database initialisation
using ::dotnetstl::c_string_accessor;
/* static */ ::openrj::ORJDatabaseA const
*FileDatabase::create_database_(char const *path, unsigned flags)
{
::openrj::ORJDatabaseA const *database;
::openrj::ORJError error;
::openrj::ORJRC rc = ...
/// call ::openrj::ORJ_ReadDatabaseA(), and
/// ... throw new DatabaseException(rc, error); on failure
/// ... or return databse
}
FileDatabase::FileDatabase(String *path, unsigned int flags)
: Database(create_database_(c_string_accessor<char>(path), flags))
, m_path(path)
{}
/* static */ ::openrj::ORJDatabaseA const
*MemoryDatabase::create_database_(char const *contents
, size_t cbContents, unsigned flags)
{
::openrj::ORJDatabaseA const *database;
::openrj::ORJError error;
::openrj::ORJRC rc = ...
/// call ::openrj::ORJ_CreateDatabaseFromMemoryA(), and
/// ... throw new DatabaseException(rc, error); on failure
/// ... or return databse
}
MemoryDatabase::MemoryDatabase(String *contents, unsigned int flags)
: Database(create_database_(c_string_accessor<char>(contents)
, contents->get_Length(), flags))
{}