2014-11-08 14:43:58 -05:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#ifndef OCARINA_CORE_TAGS_GENERIC_H
|
|
|
|
#define OCARINA_CORE_TAGS_GENERIC_H
|
|
|
|
|
|
|
|
#include <core/database.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 ::_name. */
|
|
|
|
|
|
|
|
public:
|
|
|
|
GenericTag(); /**< GenericTag constructor. */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generic tag constructor.
|
|
|
|
*
|
|
|
|
* @param name Name to associate with this tag.
|
|
|
|
*/
|
|
|
|
GenericTag(const std::string &);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to access the generic tag's primary key.
|
|
|
|
*
|
2014-11-08 20:08:42 -05:00
|
|
|
* @return GenericTag::_name.
|
2014-11-08 14:43:58 -05:00
|
|
|
*/
|
|
|
|
virtual const std::string primary_key() const;
|
|
|
|
|
|
|
|
/**
|
2014-11-08 20:08:42 -05:00
|
|
|
* Read GenericTag::_name from file and find the lowercase form.
|
2014-11-08 14:43:58 -05:00
|
|
|
*
|
|
|
|
* @param file The file to read from.
|
|
|
|
*/
|
|
|
|
virtual void read(File &);
|
|
|
|
|
|
|
|
/**
|
2014-11-08 20:08:42 -05:00
|
|
|
* Write GenericTag::_name to file.
|
2014-11-08 14:43:58 -05:00
|
|
|
*
|
|
|
|
* @param file The file to write to.
|
|
|
|
*/
|
|
|
|
virtual void write(File &);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to access the name associated with this tag.
|
|
|
|
*
|
2014-11-08 20:08:42 -05:00
|
|
|
* @return GenericTag::_name.
|
2014-11-08 14:43:58 -05:00
|
|
|
*/
|
2014-11-08 20:53:08 -05:00
|
|
|
const std::string &name() const;
|
2014-11-08 14:43:58 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to access the lowercase form of ::_name.
|
|
|
|
*
|
2014-11-08 20:08:42 -05:00
|
|
|
* @return GenericTag::_lower.
|
2014-11-08 14:43:58 -05:00
|
|
|
*/
|
|
|
|
const std::string &lowercase();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* OCARINA_CORE_TAGS_GENERIC_H */
|