Utilities

class

This string class does not store any char arrays, but it only stores the position of the first char in the memory, and the size of the char array.

Public Functions

orcus::pstring::pstring()
orcus::pstring::pstring(const char *_pos)
orcus::pstring::pstring(const char *_pos, size_t _size)
std::string orcus::pstring::str() const
size_t orcus::pstring::size() const
const char &orcus::pstring::operator[](size_t idx) const
pstring &orcus::pstring::operator=(const pstring &r)
const char *orcus::pstring::get() const
bool orcus::pstring::operator==(const pstring &r) const
bool orcus::pstring::operator!=(const pstring &r) const
bool orcus::pstring::operator<(const pstring &r) const
bool orcus::pstring::operator==(const char *_str) const
bool orcus::pstring::operator!=(const char *_str) const
pstring orcus::pstring::trim() const
bool orcus::pstring::empty() const
void orcus::pstring::clear()
void orcus::pstring::resize(size_t new_size)
struct

Public Functions

size_t orcus::pstring::hash::operator()(const pstring &val) const
class

Implements string hash map.

Public Functions

orcus::string_pool::string_pool(const string_pool&)
string_pool &orcus::string_pool::operator=(const string_pool&)
orcus::string_pool::string_pool()
orcus::string_pool::~string_pool()
std::pair<pstring, bool> orcus::string_pool::intern(const char *str)

Intern a string.

Return
pair whose first value is the interned string, and the second value specifies whether it is a newly created instance (true) or a reuse of an existing instance (false).
Parameters
  • str: string to intern. It must be null-terminated.

std::pair<pstring, bool> orcus::string_pool::intern(const char *str, size_t n)

Intern a string.

Return
see above.
Parameters
  • str: string to intern. It doesn’t need to be null-terminated.
  • n: length of the string.

std::pair<pstring, bool> orcus::string_pool::intern(const pstring &str)

Intern a string.

Return
see above.
Parameters
  • str: string to intern.

void orcus::string_pool::dump() const
void orcus::string_pool::clear()
size_t orcus::string_pool::size() const
void orcus::string_pool::swap(string_pool &other)
void orcus::string_pool::merge(string_pool &other)

Merge another string pool instance in. This will not invalidate any string references to the other pool.

The other string pool instance will become empty when this call returns.

Parameters
  • other: string pool instance to merge in.

class

Public Functions

orcus::tokens::tokens(const char **token_names, size_t token_name_count)
bool orcus::tokens::is_valid_token(xml_token_t token) const

Check if a token returned from get_token() method is valid.

Return
true if valid, false otherwise.

xml_token_t orcus::tokens::get_token(const pstring &name) const

Get token from a specified name.

Return
token value representing the given textural token.
Parameters
  • name: textural token name

const char *orcus::tokens::get_token_name(xml_token_t token) const

Get textural token name from a token value.

Return
textural token name, or empty string in case the given token is not valid.
Parameters
  • token: numeric token value

class

Temporary cell buffer used to convert cell values when needed. This is used in the sax and csv parsers.

Public Functions

orcus::cell_buffer::cell_buffer()

Logical buffer size. May differ from the actual buffer size.

void orcus::cell_buffer::append(const char *p, size_t len)
void orcus::cell_buffer::reset()
const char *orcus::cell_buffer::get() const
size_t orcus::cell_buffer::size() const
bool orcus::cell_buffer::empty() const
class

Public Functions

orcus::zip_archive::zip_archive(zip_archive_stream *stream)
orcus::zip_archive::~zip_archive()
void orcus::zip_archive::load()

Loading involves the parsing of the central directory of a zip archive (located toward the end of the stream) and building of file entry data which are stored in the central directory.

void orcus::zip_archive::dump_file_entry(size_t index) const

Dump the content of a specified file entry to stdout.

Parameters
  • index: file entry index

void orcus::zip_archive::dump_file_entry(const char *entry_name) const

Dump the content of a specified file entry to stdout.

Parameters
  • entry_name: file entry name.

pstring orcus::zip_archive::get_file_entry_name(size_t index) const

Get file entry name from its index.

Return
file entry name
Parameters
  • index: file entry index

size_t orcus::zip_archive::get_file_entry_count() const

Return the number of file entries stored in this zip archive. Note that a file entry may be a directory, so the number of files stored in the zip archive may not equal the number of file entries.

Return
number of file entries.

bool orcus::zip_archive::read_file_entry(const pstring &entry_name, std::vector<unsigned char> &buf) const

Retrieve data stream of specified file entry into buffer. The retrieved data stream gets uncompressed if the original stream is compressed. The method will overwrite the content of passed buffer if there is any pre-existing data in it.

Return
true if successful, false otherwise.
Parameters
  • entry_name: file entry name
  • buf: buffer to put the retrieved data stream into.

XML Types

typedef
typedef
struct

Public Functions

orcus::xml_name_t::xml_name_t()
orcus::xml_name_t::xml_name_t(xmlns_id_t _ns, const pstring &_name)
orcus::xml_name_t::xml_name_t(const xml_name_t &r)

Public Members

xmlns_id_t orcus::xml_name_t::ns
pstring orcus::xml_name_t::name
struct

Public Functions

orcus::xml_token_attr_t::xml_token_attr_t()
orcus::xml_token_attr_t::xml_token_attr_t(xmlns_id_t _ns, xml_token_t _name, const pstring &_value, bool _transient)
orcus::xml_token_attr_t::xml_token_attr_t(xmlns_id_t _ns, xml_token_t _name, const pstring &_raw_name, const pstring &_value, bool _transient)

Public Members

xmlns_id_t orcus::xml_token_attr_t::ns
xml_token_t orcus::xml_token_attr_t::name
pstring orcus::xml_token_attr_t::raw_name
pstring orcus::xml_token_attr_t::value
bool orcus::xml_token_attr_t::transient

Whether or not the attribute value is transient. A transient value is not guaranteed to be valid after the start_element call ends. A non-transient value is guaranteed to be valid during the life cycle of the xml stream it belongs to.

Other Types

enum type orcus::length_unit_t

Values:

= 0
struct

Public Functions

orcus::date_time_t::date_time_t()
std::string orcus::date_time_t::to_string() const

Public Members

int orcus::date_time_t::year
int orcus::date_time_t::month
int orcus::date_time_t::day
int orcus::date_time_t::hour
int orcus::date_time_t::minute
double orcus::date_time_t::second