diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-02-19 02:31:35 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-19 10:18:31 +0100 |
commit | 6f3c772939463c97a4a8a8371db42b8f4b181c68 (patch) | |
tree | f8010e9e49696505e22cd0dff3bd84089392a240 /vcal.h | |
parent | I somehow got stuff to bulid, now it just doesn't link. (diff) | |
download | calp-6f3c772939463c97a4a8a8371db42b8f4b181c68.tar.gz calp-6f3c772939463c97a4a8a8371db42b8f4b181c68.tar.xz |
No idea, to tired.
Diffstat (limited to 'vcal.h')
-rw-r--r-- | vcal.h | 70 |
1 files changed, 35 insertions, 35 deletions
@@ -11,9 +11,41 @@ #include "strbuf.h" #include "linked_list.h" -typedef std::pair<strbuf, llist<strbuf> > param_set; -typedef std::pair<strbuf, llist<param_set> > content_set; -typedef std::pair<strbuf, llist<content_set> > content_line; +// typedef std::pair<strbuf, llist<strbuf> > param_set; +// typedef std::pair<strbuf, llist<param_set> > content_set; +// typedef std::pair<strbuf, llist<strbuf> > content_line; +typedef llist<strbuf> content_line; + +struct vcomponent { + std::string filename; + std::string type; + vcomponent* parent = nullptr; + trie<content_line> clines; + std::vector<vcomponent> components; + + vcomponent(const std::string& type) : vcomponent(type, nullptr) { }; + + vcomponent(const std::string& type, const std::string& filename); + + + /* + * Resolves a collision in some form of structure (probably a hash-map + * or a trie). If dest is NULL just return new_. Otherwise mutates dest + * to have the correct form, and returns it. Destroying new_ in the + * process. + */ + vcomponent* operator= (vcomponent* other); + + content_line& operator[] (const char* key) { + return this->clines[key]; + } + + void push_back(const vcomponent& child) + { this->components.push_back(child); } +}; + +std::ostream& operator<<(std::ostream&, vcomponent*); + #if 1 /* @@ -41,36 +73,4 @@ typedef std::pair<strbuf, llist<content_set> > content_line; #define CLINE_CUR_PARAM_VAL(c) (CLINE_CUR_PARAMS(c)->cur->value->second.cur->value) #endif - struct vcomponent { - std::string filename; - std::string type; - vcomponent* parent = nullptr; - trie<content_line> clines; - std::vector<vcomponent> components; - - vcomponent(const std::string& type) : vcomponent(type, nullptr) { }; - vcomponent(const std::string& type, const std::string& filename) - : type(type) , filename(filename) { }; - - ~vcomponent(); - - -/* - * Resolves a collision in some form of structure (probably a hash-map - * or a trie). If dest is NULL just return new_. Otherwise mutates dest - * to have the correct form, and returns it. Destroying new_ in the - * process. - */ - vcomponent* operator= (vcomponent* other); - - content_line& operator[] (char* key) { - return this->clines[key]; - } - - void push_back(const vcomponent& child) - { this->components.push_back(child); } -}; - -std::ostream& operator<<(std::ostream&, vcomponent*); - #endif /* VCAL_H */ |