summaryrefslogtreecommitdiff
path: root/src/attribute.hpp
blob: d3323a416e4aa7c0417c3093147d1a1057da2d12 (plain)
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
38
39
40
41
42
43
44
#ifndef XIFT_INCLUDED_ATTRIBUTE
#define XIFT_INCLUDED_ATTRIBUTE


struct XiftAttribute {
    XiftAttribute();
    ~XiftAttribute();

    bool MatchesForm(const XiftAttribute &form) const;

    char *name;
    int   nlen;
    int   nsize;
    char *value;
    int   vlen;
    int   vsize;

    char value_quota;
};

class XiftAttributes {
public:
    XiftAttributes();
    ~XiftAttributes();

    XiftAttribute &Attribute(const char *name);
    void           Remove(const char *name);

    XiftAttribute *Top();
    void           Pop();
    XiftAttribute &New();

    bool ContainsMatchedForm(const XiftAttribute &attribute) const;
    bool MatchesForm(const XiftAttributes &form) const;

private:
    struct Stack {
        Stack        *next;
        XiftAttribute item;
    } *stack;
};


#endif