Utilities

class string_pool

Implements string hash map.

Public Functions

string_pool(const string_pool&) = delete
string_pool &operator=(const string_pool&) = delete
string_pool()
~string_pool()
std::pair<std::string_view, bool> intern(std::string_view str)

Intern a string.

Parameters

str – string to intern.

Returns

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).

std::vector<std::string_view> get_interned_strings() const

Return all interned strings.

Returns

sequence of all interned strings. The sequence will be sorted.

void dump() const
void clear()
size_t size() const
void swap(string_pool &other)
void 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 tokens

Public Functions

tokens() = delete
tokens(const char **token_names, size_t token_name_count)
bool is_valid_token(xml_token_t token) const

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

Returns

true if valid, false otherwise.

xml_token_t get_token(std::string_view name) const

Get token from a specified name.

Parameters

name – textural token name

Returns

token value representing the given textural token.

std::string_view get_token_name(xml_token_t token) const

Get textural token name from a token value.

Parameters

token – numeric token value

Returns

textural token name, or empty string in case the given token is not valid.

class cell_buffer

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

Public Functions

cell_buffer()

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

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

Public Functions

zip_archive(zip_archive_stream *stream)
~zip_archive()
void 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 dump_file_entry(size_t index) const

Dump the content of a specified file entry to stdout.

Parameters

index – file entry index

void dump_file_entry(std::string_view entry_name) const

Dump the content of a specified file entry to stdout.

Parameters

entry_name – file entry name.

std::string_view get_file_entry_name(std::size_t index) const

Get file entry name from its index.

Parameters

index – file entry index

Returns

file entry name

size_t 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.

Returns

number of file entries.

bool read_file_entry(std::string_view 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.

Parameters
  • entry_name – file entry name

  • buf – buffer to put the retrieved data stream into.

Returns

true if successful, false otherwise.

XML Types

using orcus::xml_token_t = size_t
using orcus::xmlns_id_t = const char*
struct xml_name_t

Public Types

enum to_string_type

Values:

enumerator use_alias
enumerator use_short_name

Public Functions

xml_name_t()
xml_name_t(xmlns_id_t _ns, std::string_view _name)
xml_name_t(const xml_name_t &r)
xml_name_t &operator=(const xml_name_t &other)
bool operator==(const xml_name_t &other) const
bool operator!=(const xml_name_t &other) const
std::string to_string(const xmlns_context &cxt, to_string_type type) const
std::string to_string(const xmlns_repository &repo) const

Public Members

xmlns_id_t ns
std::string_view name
struct xml_token_attr_t

Public Functions

xml_token_attr_t()
xml_token_attr_t(xmlns_id_t _ns, xml_token_t _name, std::string_view _value, bool _transient)
xml_token_attr_t(xmlns_id_t _ns, xml_token_t _name, std::string_view _raw_name, std::string_view _value, bool _transient)

Public Members

xmlns_id_t ns
xml_token_t name
std::string_view raw_name
std::string_view value
bool transient

Whether or not the attribute value is transient. A transient value is only guaranteed to be valid until the end of the start_element call, after which its validity is not guaranteed. A non-transient value is guaranteed to be valid during the life cycle of the xml stream it belongs to.

Other Types

enum class orcus::length_unit_t

Values:

enumerator unknown
enumerator centimeter
enumerator millimeter
enumerator xlsx_column_digit
enumerator inch
enumerator point
enumerator twip
enumerator pixel
struct date_time_t

Public Functions

date_time_t()
date_time_t(int _year, int _month, int _day)
date_time_t(int _year, int _month, int _day, int _hour, int _minute, double _second)
date_time_t(const date_time_t &other)
~date_time_t()
date_time_t &operator=(date_time_t other)
bool operator==(const date_time_t &other) const
bool operator!=(const date_time_t &other) const
bool operator<(const date_time_t &other) const
std::string to_string() const
void swap(date_time_t &other)

Public Members

int year
int month
int day
int hour
int minute
double second