summaryrefslogtreecommitdiff
path: root/src/attribute.hpp
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-01-31 17:16:27 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-01-31 17:16:27 +0300
commit0be032c6998e712dc2c9f2ed97c3491d89eb05af (patch)
treef762d884147d2f0a9a115edd0b5e0de554a3ec1b /src/attribute.hpp
downloadxift-0be032c6998e712dc2c9f2ed97c3491d89eb05af.tar
xift-0be032c6998e712dc2c9f2ed97c3491d89eb05af.tar.xz
xift-0be032c6998e712dc2c9f2ed97c3491d89eb05af.zip
[xift] Almost done.
Diffstat (limited to 'src/attribute.hpp')
-rw-r--r--src/attribute.hpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/attribute.hpp b/src/attribute.hpp
new file mode 100644
index 0000000..d54d5a3
--- /dev/null
+++ b/src/attribute.hpp
@@ -0,0 +1,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