Donner 0.8.0-pre
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::svg::components::StylesheetSourceMap Class Reference

Source map for stylesheet text produced by concatenating <style> text/CDATA children. More...

#include "donner/svg/components/StylesheetComponent.h"

Public Member Functions

void addSegment (std::size_t cssStartOffset, std::size_t cssEndOffset, FileOffset documentStartOffset)
 Add one local-CSS to document-source mapping segment.
bool empty () const
 Return true when no local CSS offsets can be mapped to document source.
std::optional< SourceRangemapToDocumentSource (const SourceRange &localRange) const
 Map a local CSS source range back to the SVG document source.
std::optional< std::size_t > mapToLocalCssOffset (std::size_t documentOffset) const
 Map a document source offset back to this stylesheet's local CSS offset.
std::span< const StylesheetSourceMapSegmentsegments () const
 Get the stored mapping segments.

Detailed Description

Source map for stylesheet text produced by concatenating <style> text/CDATA children.

Member Function Documentation

◆ addSegment()

void donner::svg::components::StylesheetSourceMap::addSegment ( std::size_t cssStartOffset,
std::size_t cssEndOffset,
FileOffset documentStartOffset )

Add one local-CSS to document-source mapping segment.

Parameters
cssStartOffsetFirst local CSS byte covered by this segment.
cssEndOffsetFirst local CSS byte after this segment.
documentStartOffsetDocument source offset for cssStartOffset.

◆ mapToDocumentSource()

std::optional< SourceRange > donner::svg::components::StylesheetSourceMap::mapToDocumentSource ( const SourceRange & localRange) const

Map a local CSS source range back to the SVG document source.

Parameters
localRangeRange in the parsed CSS string.
Returns
Document source range, or std::nullopt when either endpoint is unmappable.

◆ mapToLocalCssOffset()

std::optional< std::size_t > donner::svg::components::StylesheetSourceMap::mapToLocalCssOffset ( std::size_t documentOffset) const

Map a document source offset back to this stylesheet's local CSS offset.

Parameters
documentOffsetOffset in the SVG document source.
Returns
Local CSS offset, or std::nullopt if documentOffset is outside this stylesheet.

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