// Iffy // // Douglas Thrift // // $Id$ #ifndef _Tag_hpp_ #define _Tag_hpp_ #include "Iffy.hpp" #ifdef MENES_PRAGMA_ONCE #pragma once #endif enum TagType { OPEN, CLOSE, STANDALONE }; class Tag { private: TagType type; ext::String name; ios::String attributes; ext::String lower(const ext::String& string); public: Tag() : type(STANDALONE) {} Tag(const ext::String& segment); Tag(TagType type, const ext::String& name) : type(type), name(name) {} Tag& operator=(TagType type) { this->type = type; return *this; } Tag& operator=(const ext::String& name) { this->name = name; return *this; } bool operator==(TagType type) const { return this->type == type; } bool operator==(const ext::String& name) const { return this->name == name; } bool operator!=(TagType type) const { return this->type != type; } bool operator!=(const ext::String& name) const { return this->name != name; } operator TagType() const { return type; } operator ext::String() const { return name; } // friends: friend ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Tag& tag); }; inline ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Tag& tag) { pout << (tag == CLOSE ? "" : ">"); } #endif // _Tag_hpp_