summaryrefslogtreecommitdiff
path: root/src/attribute.hpp
blob: d54d5a35b7da515bb3e9f14bfeddc345ad001d9f (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
45
46
47
#ifndef XIFT_INCLUDED_ATTRIBUTE
#define XIFT_INCLUDED_ATTRIBUTE


class XiftAttributes {
public:
    class Attr {
        friend class XiftAttributes;

        Attr();
        ~Attr();

        bool MatchesForm(const Attr &form) const;

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

        char value_quota;
    };

    XiftAttributes();
    ~XiftAttributes();

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

protected:
    Attr *Top();
    void  Pop();
    Attr &New();

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

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


#endif