WvStreams
wvtclstring.h
Go to the documentation of this file.
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * FIXME:
6  * It would be possible to represent arbitrary binary blobs using this
7  * technique, but we'd have to avoid using null-terminated strings in a few
8  * places, particularly in the input to wvtcl_escape().
9  *
10  * We could even make encoded binary blobs printable (although that's not
11  * _strictly_ necessary in all cases) by encoding non-printable characters
12  * using \x## notation, if wvtcl_escape() or wvtcl_unescape() supported it.
13  */
34 #ifndef __WVTCLSTRING_H
35 #define __WVTCLSTRING_H
36 
37 #include "wvbuf.h"
38 class WvStringMask;
39 
40 // the default set of "nasties", ie. characters that need to be escaped if
41 // they occur somewhere in a string.
42 #define WVTCL_NASTY_SPACES_STR " \t\n\r"
43 extern const WvStringMask WVTCL_NASTY_SPACES;
44 
45 // Another default set of nasties, but only splitting on newlines
46 #define WVTCL_NASTY_NEWLINES_STR "\n\r"
47 extern const WvStringMask WVTCL_NASTY_NEWLINES;
48 
49 // {, }, \, and " are always considered "nasty."
50 #define WVTCL_ALWAYS_NASTY_CASE '{': case '}': case '\\': case '"'
51 
52 
53 // the default set of split characters, ie. characters that separate elements
54 // in a list. If these characters appear unescaped and not between {} or ""
55 // in a list, they signify the end of the current element.
56 #define WVTCL_SPLITCHARS_STR " \t\n\r"
57 extern const WvStringMask WVTCL_SPLITCHARS;
58 
59 
70  const WvStringMask &nasties = WVTCL_NASTY_SPACES);
71 
72 
80 
81 
88  const WvStringMask &nasties = WVTCL_NASTY_SPACES,
89  const WvStringMask &splitchars = WVTCL_SPLITCHARS);
90 
97  const WvStringMask &splitchars = WVTCL_SPLITCHARS,
98  bool do_unescape = true);
99 
117  const WvStringMask &splitchars = WVTCL_SPLITCHARS,
118  bool do_unescape = true);
119 
120 #endif // __WVTCLSTRING_H