~yadi/squid/connection-manager

« back to all changes in this revision

Viewing changes to src/base/CharacterSet.h

  • Committer: Amos Jeffries
  • Date: 2014-01-19 05:45:51 UTC
  • mfrom: (13045.1.209 trunk)
  • Revision ID: squid3@treenet.co.nz-20140119054551-3u1so2dy5vda7kfw
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
    ///  with specified initial contents
14
14
    CharacterSet(const char *label, const char * const initial);
15
15
 
 
16
    /// define a character set with the given label ("anonymous" if NULL)
 
17
    ///  containing characters defined in the supplied ranges
 
18
    /// \see addRange
 
19
    CharacterSet(const char *label, unsigned char low, unsigned char high);
 
20
 
16
21
    /// whether a given character exists in the set
17
22
    bool operator[](unsigned char c) const {return chars_[static_cast<uint8_t>(c)] != 0;}
18
23
 
19
24
    /// add a given character to the character set
20
25
    CharacterSet & add(const unsigned char c);
21
26
 
 
27
    /// add a list of character ranges, expressed as pairs [low,high], including both ends
 
28
    CharacterSet & addRange(unsigned char low, unsigned char high);
 
29
 
22
30
    /// add all characters from the given CharacterSet to this one
23
 
    const CharacterSet &operator +=(const CharacterSet &src);
 
31
    CharacterSet &operator +=(const CharacterSet &src);
 
32
 
 
33
    /// return a new CharacterSet containing the union of two sets
 
34
    CharacterSet operator +(const CharacterSet &src) const;
24
35
 
25
36
    /// optional set label for debugging (default: "anonymous")
26
37
    const char * name;
27
38
 
 
39
    // common character sets, insipired to RFC5234
 
40
    // A-Za-z
 
41
    static const CharacterSet ALPHA;
 
42
    // 0-1
 
43
    static const CharacterSet BIT;
 
44
    // carriage return
 
45
    static const CharacterSet CR;
 
46
    // line feed
 
47
    static const CharacterSet LF;
 
48
    // double quote
 
49
    static const CharacterSet DQUOTE;
 
50
    // 0-9
 
51
    static const CharacterSet DIGIT;
 
52
    // 0-9aAbBcCdDeEfF
 
53
    static const CharacterSet HEXDIG;
 
54
    // horizontal tab
 
55
    static const CharacterSet HTAB;
 
56
    // white space
 
57
    static const CharacterSet SP;
 
58
    // visible (printable) characters
 
59
    static const CharacterSet VCHAR;
 
60
    // <space><tab>
 
61
    static const CharacterSet WSP;
 
62
    // character sets from draft httpbis
 
63
    // any VCHAR except for SPECIAL
 
64
    static const CharacterSet TCHAR;
 
65
    // special VCHARs
 
66
    static const CharacterSet SPECIAL;
 
67
    // qdtext (ready but not enabled as it requires a c++11 constructor)
 
68
    //static const CharacterSet QDTEXT;
 
69
    // obs-text (ready but not enabled as it requires a c++11 constructor)
 
70
    //static const CharacterSet OBSTEXT;
 
71
 
28
72
private:
29
73
    /** index of characters in this set
30
74
     *