Source map for stylesheet text produced by concatenating <style> text/CDATA children.
More...
#include "donner/svg/components/StylesheetComponent.h"
|
| void | addSegment (std::size_t cssStartOffset, std::size_t cssEndOffset, FileOffset documentStartOffset) |
| | Add one local-CSS to document-source mapping segment.
|
| void | setCssLength (std::size_t cssLength) |
| | Record the length of the concatenated CSS text this map describes.
|
|
bool | empty () const |
| | Return true when no local CSS offsets can be mapped to document source.
|
| std::optional< SourceRange > | mapToDocumentSource (const SourceRange &localRange) const |
| | Map a local CSS source range back to the SVG document source.
|
| std::optional< FileOffset > | mapPointToDocumentSource (FileOffset localOffset) const |
| | Map a point diagnostic, preferring the next chunk at a shared CSS boundary.
|
| 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 StylesheetSourceMapSegment > | segments () const |
| | Get the stored mapping segments.
|
Source map for stylesheet text produced by concatenating <style> text/CDATA children.
◆ 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
-
| cssStartOffset | First local CSS byte covered by this segment. |
| cssEndOffset | First local CSS byte after this segment. |
| documentStartOffset | Document source offset for cssStartOffset. |
◆ mapPointToDocumentSource()
| std::optional< FileOffset > donner::svg::components::StylesheetSourceMap::mapPointToDocumentSource |
( |
FileOffset | localOffset | ) |
const |
Map a point diagnostic, preferring the next chunk at a shared CSS boundary.
The stylesheet end maps to the end of the last segment only when setCssLength recorded that the last segment reaches it.
- Parameters
-
| localOffset | Point in the parsed CSS string. |
- Returns
- Document offset, or nullopt when no source segment covers the point.
◆ 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
-
| localRange | Range 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
-
| documentOffset | Offset in the SVG document source. |
- Returns
- Local CSS offset, or
std::nullopt if documentOffset is outside this stylesheet.
◆ setCssLength()
| void donner::svg::components::StylesheetSourceMap::setCssLength |
( |
std::size_t | cssLength | ) |
|
|
inline |
Record the length of the concatenated CSS text this map describes.
Point diagnostics at the end of the last mapped segment map to that segment's end only when it is also the end of the stylesheet; a later chunk without source provenance makes that point unmappable instead.
- Parameters
-
| cssLength | Length in bytes of the concatenated CSS text. |
The documentation for this class was generated from the following file: