GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
gp_markup_builder.h File Reference

Utils for markup parsers. More...

#include <utils/gp_markup.h>

Go to the source code of this file.

Data Structures

struct  gp_markup_builder
 A markup builder. More...
 

Typedefs

typedef struct gp_markup_builder gp_markup_builder
 A markup builder.
 

Functions

static void gp_markup_builder_glyph (gp_markup_builder *self, uint32_t glyph, uint8_t fmt, uint16_t fg_color)
 Appends a markup glyph.
 
static void gp_markup_builder_space (gp_markup_builder *self, uint8_t fmt)
 Appends a markup space.
 
static void gp_markup_builder_newline (gp_markup_builder *self)
 Appends a markup newline.
 
static void gp_markup_builder_hline (gp_markup_builder *self)
 Appends a markup horizontal line.
 
static void gp_markup_builder_finish (gp_markup_builder *self)
 Finishes a markup.
 
static gp_markupgp_markup_builder_alloc (gp_markup_builder *self)
 Allocates a buffer for a markup.
 

Detailed Description

Utils for markup parsers.

These functions are designed so that the parser runs twice, the first run computers number of glyphs, then the parser allocates a buffer for the output and then finaly the markup is parsed into the allocated buffer.

Definition in file gp_markup_builder.h.

Function Documentation

◆ gp_markup_builder_alloc()

static gp_markup * gp_markup_builder_alloc ( gp_markup_builder self)
inlinestatic

Allocates a buffer for a markup.

Parameters
selfA markup builder.
Returns
A newly allocated gp_markup.

Definition at line 133 of file gp_markup_builder.h.

◆ gp_markup_builder_finish()

static void gp_markup_builder_finish ( gp_markup_builder self)
inlinestatic

Finishes a markup.

Parameters
selfA markup builder.

Definition at line 115 of file gp_markup_builder.h.

References gp_markup_glyph::fmt, and gp_markup_glyph::glyph.

◆ gp_markup_builder_glyph()

static void gp_markup_builder_glyph ( gp_markup_builder self,
uint32_t  glyph,
uint8_t  fmt,
uint16_t  fg_color 
)
inlinestatic

Appends a markup glyph.

Parameters
selfA markup builder.
glyphAn unicode glyph.
fmtA glyph format enum gp_markup_flags.
fg_colorA glyph color.

Definition at line 36 of file gp_markup_builder.h.

References gp_markup_glyph::fg_color, gp_markup_glyph::fmt, and gp_markup_glyph::glyph.

◆ gp_markup_builder_hline()

static void gp_markup_builder_hline ( gp_markup_builder self)
inlinestatic

Appends a markup horizontal line.

Parameters
selfA markup builder.

Definition at line 98 of file gp_markup_builder.h.

References gp_markup_glyph::fmt, gp_markup_glyph::glyph, and GP_MARKUP_STRIKE.

◆ gp_markup_builder_newline()

static void gp_markup_builder_newline ( gp_markup_builder self)
inlinestatic

Appends a markup newline.

Parameters
selfA markup builder.

Definition at line 81 of file gp_markup_builder.h.

References gp_markup_glyph::fmt, and gp_markup_glyph::glyph.

◆ gp_markup_builder_space()

static void gp_markup_builder_space ( gp_markup_builder self,
uint8_t  fmt 
)
inlinestatic

Appends a markup space.

Parameters
selfA markup builder.
fmtA glyph format enum gp_markup_flags.

Definition at line 56 of file gp_markup_builder.h.

References gp_markup_glyph::fmt, and gp_markup_glyph::glyph.