Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
xml.c File Reference

xml_escape More...

#include <common/types.h>
#include <common/utils.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <util/exit.h>
#include <util/gv_ctype.h>
#include <util/unreachable.h>
Include dependency graph for xml.c:

Go to the source code of this file.

Functions

static bool xml_isentity (const char *s)
 
static int xml_core (char previous, const char **current, xml_flags_t flags, int(*cb)(void *state, const char *s), void *state)
 
int xml_escape (const char *s, xml_flags_t flags, int(*cb)(void *state, const char *s), void *state)
 

Function Documentation

◆ xml_core()

static int xml_core ( char  previous,
const char **  current,
xml_flags_t  flags,
int(*)(void *state, const char *s cb,
void *  state 
)
static

XML-escape a character

Parameters
previousThe source character preceding the current one or '\0' if there was no prior character.
[in,out]currentPointer to the current position in a source string being escaped. The pointer is updated based on how many characters are consumed.
flagsOptions for configuring behavior.
cbUser function for emitting escaped data. This is expected to take a caller-defined state type as the first parameter and the string to emit as the second, and then return an opaque value that is passed back to the caller.
stateData to pass as the first parameter when calling cb.
Returns
The return value of a call to cb.

Definition at line 61 of file xml.c.

References flags, graphviz_exit(), UNREACHABLE, and xml_isentity().

Referenced by xml_escape().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_escape()

int xml_escape ( const char *  s,
xml_flags_t  flags,
int(*)(void *state, const char *s cb,
void *  state 
)

XML-escape a string

Parameters
sSource string to process.
flagsOptions of how to configure escaping.
cbAn fputs analogue for emitting escaped output.
stateCaller-defined data to pass to cb.
Returns
The first negative value cb returns or the last return value of cb.

Definition at line 179 of file xml.c.

References flags, and xml_core().

Referenced by EmbedText(), gvputs_xml(), pango_textlayout(), svg_begin_anchor(), svg_textspan(), xml_puts(), xml_puts(), xml_url_puts(), and xml_url_puts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_isentity()

static bool xml_isentity ( const char *  s)
static

Definition at line 22 of file xml.c.

References gv_isalpha(), gv_isdigit(), and gv_isxdigit().

Referenced by xml_core().

Here is the call graph for this function:
Here is the caller graph for this function: