OpenXLSX 1.12.1
Modern C++ Excel Library (Fork of OpenXLSX by Kenneth Troldal Balslev)
Loading...
Searching...
No Matches
OpenXLSX::XLMapSharedStringTable Class Referencefinal

In-memory read-only SST for unit tests and offline consumers (no document required). More...

#include <XLSharedStringTable.hpp>

Inheritance diagram for OpenXLSX::XLMapSharedStringTable:
OpenXLSX::XLSharedStringTable

Public Member Functions

 XLMapSharedStringTable ()=default
 XLMapSharedStringTable (std::vector< std::string > strings)
 Replace the table with an ordered list of strings (indices 0..n-1).
int32_t append (std::string_view str)
 Append a string and return its index (duplicates reuse the existing index).
void clear ()
int32_t stringCount () const override
int32_t getStringIndex (std::string_view str) const override
 Look up an existing string's index.
bool stringExists (std::string_view str) const override
const char * getString (int32_t index) const override
 Resolve an SST index to a null-terminated C string.
std::string_view getStringView (int32_t index) const override
 Resolve an SST index to a string_view into the arena/cache.
Public Member Functions inherited from OpenXLSX::XLSharedStringTable
virtual ~XLSharedStringTable ()=default

Detailed Description

In-memory read-only SST for unit tests and offline consumers (no document required).

Mirrors XLMapEvaluationContext: a lightweight mock of the SST port. Appended strings keep stable storage so getString/getStringView remain valid.

Constructor & Destructor Documentation

◆ XLMapSharedStringTable() [1/2]

OpenXLSX::XLMapSharedStringTable::XLMapSharedStringTable ( )
default

◆ XLMapSharedStringTable() [2/2]

OpenXLSX::XLMapSharedStringTable::XLMapSharedStringTable ( std::vector< std::string > strings)
explicit

Replace the table with an ordered list of strings (indices 0..n-1).

Member Function Documentation

◆ append()

int32_t OpenXLSX::XLMapSharedStringTable::append ( std::string_view str)

Append a string and return its index (duplicates reuse the existing index).

◆ clear()

void OpenXLSX::XLMapSharedStringTable::clear ( )

◆ getString()

const char * OpenXLSX::XLMapSharedStringTable::getString ( int32_t index) const
nodiscardoverridevirtual

Resolve an SST index to a null-terminated C string.

Note
Pointer is valid while the document / SST remains alive.

Implements OpenXLSX::XLSharedStringTable.

◆ getStringIndex()

int32_t OpenXLSX::XLMapSharedStringTable::getStringIndex ( std::string_view str) const
nodiscardoverridevirtual

Look up an existing string's index.

Returns
Index, or a negative value when the string is not present.

Implements OpenXLSX::XLSharedStringTable.

◆ getStringView()

std::string_view OpenXLSX::XLMapSharedStringTable::getStringView ( int32_t index) const
nodiscardoverridevirtual

Resolve an SST index to a string_view into the arena/cache.

Note
View is valid while the document / SST remains alive.

Implements OpenXLSX::XLSharedStringTable.

◆ stringCount()

int32_t OpenXLSX::XLMapSharedStringTable::stringCount ( ) const
nodiscardoverridevirtual
Returns
Number of entries currently in the SST cache.

Implements OpenXLSX::XLSharedStringTable.

◆ stringExists()

bool OpenXLSX::XLMapSharedStringTable::stringExists ( std::string_view str) const
nodiscardoverridevirtual
Returns
true if str is already registered in the SST.

Implements OpenXLSX::XLSharedStringTable.


The documentation for this class was generated from the following files: