summaryrefslogtreecommitdiff
path: root/src/tag.hpp
blob: 469c4fddd704dd35bb19be98f3ace0f7f976ced7 (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_TAG
#define XIFT_INCLUDED_TAG

#include "attribute.hpp"


class XiftTags {
public:
    class Item: public XiftAttributes {
        friend class XiftTags;

        Item();
        ~Item();

        bool MatchesForm(const Item & form) const;

        char *name;
        int   len;
        int   size;
    };

    XiftTags();
    ~XiftTags();

    Item &Tag(const char *name);
    void  Remove(const char *name);

protected:
    Item *Top();
    void  Pop();
    Item *PopToBeDeleted();
    Item &New();

    bool ContainsMatchedForm(const Item &tag) const;

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


#endif