MUSX Document Model
Loading...
Searching...
No Matches
musx::dom::others::ShapeInstruction Struct Reference

Helper functions and structs for decoding instruction data vectors in ShapeDef. More...

#include <ShapeDesigner.h>

Classes

struct  LineWidth
 Holds the parsed data for a LineWidth instruction. More...
 
struct  RLineTo
 Holds the parsed data for an RLineTo instruction. More...
 

Static Public Member Functions

static std::optional< LineWidthparseLineWidth (ShapeDef::InstructionType type, const std::vector< int > &data)
 Attempts to parse a LineWidth instruction.
 
static std::optional< RLineToparseRLineTo (ShapeDef::InstructionType type, const std::vector< int > &data)
 Attempts to parse an RLineTo instruction.
 
static std::optional< FontInfoparseSetFont (const DocumentWeakPtr &document, ShapeDef::InstructionType type, const std::vector< int > &data)
 Attempts to parse a SetFont instruction into a FontInfo object.
 

Detailed Description

Helper functions and structs for decoding instruction data vectors in ShapeDef.

Member Function Documentation

◆ parseLineWidth()

std::optional< ShapeInstruction::LineWidth > musx::dom::others::ShapeInstruction::parseLineWidth ( ShapeDef::InstructionType  type,
const std::vector< int > &  data 
)
static

Attempts to parse a LineWidth instruction.

Parameters
[in]typeThe instruction type; must be InstructionType::LineWidth.
[in]dataThe instruction's associated data vector.
Returns
A LineWidth struct if successfully parsed, otherwise std::nullopt.

◆ parseRLineTo()

std::optional< ShapeInstruction::RLineTo > musx::dom::others::ShapeInstruction::parseRLineTo ( ShapeDef::InstructionType  type,
const std::vector< int > &  data 
)
static

Attempts to parse an RLineTo instruction.

Parameters
[in]typeThe instruction type; must be InstructionType::RLineTo.
[in]dataThe instruction's associated data vector.
Returns
An RLineTo struct if successfully parsed, otherwise std::nullopt.

◆ parseSetFont()

std::optional< FontInfo > musx::dom::others::ShapeInstruction::parseSetFont ( const DocumentWeakPtr document,
ShapeDef::InstructionType  type,
const std::vector< int > &  data 
)
static

Attempts to parse a SetFont instruction into a FontInfo object.

Parameters
[in]documentThe owning document used to construct the FontInfo object.
[in]typeThe instruction type; must be InstructionType::SetFont.
[in]dataThe instruction's associated data vector.
Returns
A FontInfo object if successfully parsed, otherwise std::nullopt.