Shared strings

class shared_strings

This class manages access to a pool of shared string instances for both unformatted strings and rich-text strings. The underlying string values themselves are stored externally in the ixion::model_context instance which this class references; this class itself only stores the format properties of the rich-text strings.

Public Functions

shared_strings() = delete
shared_strings(const shared_strings&) = delete
shared_strings &operator=(const shared_strings&) = delete
shared_strings(ixion::model_context &cxt)
~shared_strings()
void set_format_runs(std::size_t sindex, std::unique_ptr<format_runs_t> runs)

Set the entire format runs of a string.

Parameters:
  • sindex – index of the string to associate the format runs with.

  • runs – format runs.

const format_runs_t *get_format_runs(std::size_t index) const

Get the entire format runs of a string.

Parameters:

index – index of the string to get the format runs of.

Returns:

pointer to the format runs, or nullptr if no format runs exist for the specified string index.

const std::string *get_string(std::size_t index) const

Get an underlying string value associated with an index.

Parameters:

index – index of a string value.

Returns:

pointer to a string value associated with the index, or nullptr in case of an invalid string index.

void dump(std::ostream &os) const
struct format_run

Contains formatting properties of a section of a string. This is used in the stroage of rich-text strings.

Public Functions

format_run()
void reset()

Reset the properties to unformatted state.

bool formatted() const

Query whether or not the section contains non-default format properties.

Returns:

true of it’s formatted, otherwise false.

Public Members

std::size_t pos

Position of the section where the formatting starts.

std::size_t size

Length of the section.

std::string_view font

Name of the font.

double font_size

Size of the font.

color_t color

Color of the section.

bool bold

Whether or not the font is bold.

bool italic

Whether or not the font is italic.

using orcus::spreadsheet::format_runs_t = std::vector<format_run>

Collection of format properties of a string.