libUTL++
StringEscape.h
1 #pragma once
2 
4 
5 #include <libutl/BitArray.h>
6 #include <libutl/String.h>
7 
9 
10 UTL_NS_BEGIN;
11 
13 
24 
26 class StringEscape : public Object
27 {
31 
32 public:
39  void add(char c, const char* s, bool owner = false);
40 
48  void process(String& out,
49  const String& in,
50  const char* prefix = nullptr,
51  const char* suffix = nullptr) const;
52 
53 private:
54  void init();
55  void deInit();
56 
57 private:
58  struct sub_t
59  {
60  const char* s;
61  char buf[6];
62  byte_t len;
63  byte_t owner;
64  };
65 
66 private:
67  BitArray _hasSub;
68  sub_t _subs[256];
69 };
70 
72 
73 UTL_NS_END;
void deInit()
De-initialize UTL++.
#define UTL_CLASS_DECL(DC, BC)
Declaration of standard UTL++ functionality for a non-template class.
Definition: macros.h:688
unsigned char byte_t
Unsigned character.
Definition: types.h:31
Character string.
Definition: String.h:31
Character-based substitution.
Definition: StringEscape.h:26
#define UTL_CLASS_NO_COMPARE
Declare that a class cannot do compare().
Definition: macros.h:344
#define UTL_CLASS_NO_COPY
Declare that a class cannot do copy().
Definition: macros.h:358
Root of UTL++ class hierarchy.
Definition: Object.h:52
void init()
Initialize UTL++.
Array of n-bit values.
Definition: BitArray.h:36