File: xml.h

package info (click to toggle)
graphviz 14.0.5-2
  • links: PTS
  • area: main
  • in suites: forky
  • size: 139,388 kB
  • sloc: ansic: 141,938; cpp: 11,957; python: 7,766; makefile: 4,043; yacc: 3,030; xml: 2,972; tcl: 2,495; sh: 1,388; objc: 1,159; java: 560; lex: 423; perl: 243; awk: 156; pascal: 139; php: 58; ruby: 49; cs: 31; sed: 1
file content (37 lines) | stat: -rw-r--r-- 958 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/// @file
/// @brief XML escaping functionality

#pragma once

#include <util/api.h>

#ifdef __cplusplus
extern "C" {
#endif

/// options to tweak the behavior of XML escaping
typedef struct {
  /// assume no embedded escapes, and escape "\n" and "\r"
  unsigned raw : 1;
  /// escape '-'
  unsigned dash : 1;
  /// escape consecutive ' '
  unsigned nbsp : 1;
  /// anticipate non-ASCII characters that need to be encoded
  unsigned utf8 : 1;
} xml_flags_t;

/// XML-escape a string
///
/// @param s Source string to process.
/// @param flags Options of how to configure escaping.
/// @param cb An `fputs` analogue for emitting escaped output.
/// @param state Caller-defined data to pass to `cb`.
/// @return The first negative value `cb` returns or the last return value of
///   `cb`.
UTIL_API int gv_xml_escape(const char *s, xml_flags_t flags,
                           int (*cb)(void *state, const char *s), void *state);

#ifdef __cplusplus
}
#endif