/** * Copyright 2014 (c) Anna Schumaker. */ #ifndef OCARINA_CORE_TAGS_GENERIC_H #define OCARINA_CORE_TAGS_GENERIC_H #include /** * The GenericTag class implements the basic functions that all * tag classes need. All other tag structures should inherit * from this class to have access to all the basic features. * * When writing a GenericTag to disk, only the _name field needs * to be written. * * ... << name1 * ... << name2 * ... << name3 */ class GenericTag : public DatabaseEntry { private: std::string _name; /**< The name associated with this tag. */ std::string _lower; /**< The lowercase form of GenericTag::_name. */ public: GenericTag(); /**< GenericTag constructor. */ /** * Generic tag constructor. * * @param name Name to associate with this tag. */ GenericTag(const std::string &); /** * Generic tag copy constructor. * * @param tag The tag that should be copied. */ GenericTag(const GenericTag &); /** * Called to access the generic tag's primary key. * * @return GenericTag::_name. */ virtual const std::string primary_key() const; /** * Read GenericTag::_name from file and find the lowercase form. * * @param file The file to read from. */ virtual void read(File &); /** * Write GenericTag::_name to file. * * @param file The file to write to. */ virtual void write(File &); /** * Called to access the name associated with this tag. * * @return GenericTag::_name. */ const std::string &name() const; /** * Called to access the lowercase form of GenericTag::_name. * * @return GenericTag::_lower. */ const std::string &lowercase(); /** * Called to compare the names of two GenericTags * * @param rhs The other tag that we are comparing with. * @return < 0: lhs < rhs, or rhs is empty. * @return 0: lhs == rhs. * @return > 0: rhs > lhs, or lhs is empty. */ int compare(const GenericTag *); }; #endif /* OCARINA_CORE_TAGS_GENERIC_H */