Library: Update documentation for the Library tag
I also take the chance to remove the corresponding section of the DESIGN file. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
ce8b3ada03
commit
d88f008728
45
DESIGN
45
DESIGN
|
@ -120,51 +120,6 @@ Tag Database:
|
|||
|
||||
|
||||
|
||||
Library Tag:
|
||||
The library tag is used to store a single directory added to Ocarina
|
||||
by the user. It is not an ID3 tag, and is instead something I use
|
||||
internally to keep track of paths added by the user. The count field
|
||||
will be managed by the Track tag class.
|
||||
|
||||
- Library:
|
||||
class Library : public DatabaseEntry {
|
||||
public:
|
||||
std::string root_path;
|
||||
unsigned int count;
|
||||
bool enabled;
|
||||
|
||||
Library();
|
||||
Library(const std::string &);
|
||||
const std::string primary_key() const;
|
||||
void read(File &);
|
||||
void write(File &);
|
||||
};
|
||||
|
||||
- File Format:
|
||||
File << enabled << root_path
|
||||
|
||||
- API:
|
||||
Library();
|
||||
Initialize an invalid Library instance.
|
||||
Set count = 0.
|
||||
Set enabled = false.
|
||||
|
||||
Library(const std::string &path);
|
||||
Set root_path from the provided path.
|
||||
Set count = 0.
|
||||
Set enabled = true.
|
||||
|
||||
const std::string Library :: primary_key() const;
|
||||
Use root_path as the primary key,
|
||||
|
||||
void read(File &f);
|
||||
Read a library path from file.
|
||||
|
||||
void write(File &f);
|
||||
Write a library path to file.
|
||||
|
||||
|
||||
|
||||
Track Tag:
|
||||
The track tag is used to store information about a single track in the
|
||||
user's music collection.
|
||||
|
|
|
@ -9,8 +9,8 @@ Library :: Library()
|
|||
{
|
||||
}
|
||||
|
||||
Library :: Library(const std::string &s)
|
||||
: _size(0), _path(s), _enabled(true)
|
||||
Library :: Library(const std::string &path)
|
||||
: _size(0), _path(path), _enabled(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -19,15 +19,15 @@ const std::string Library :: primary_key() const
|
|||
return _path;
|
||||
}
|
||||
|
||||
void Library :: read(File &f)
|
||||
void Library :: read(File &file)
|
||||
{
|
||||
f >> _enabled;
|
||||
_path = f.getline();
|
||||
file >> _enabled;
|
||||
_path = file.getline();
|
||||
}
|
||||
|
||||
void Library :: write(File &f)
|
||||
void Library :: write(File &file)
|
||||
{
|
||||
f << _enabled << " " << _path;
|
||||
file << _enabled << " " << _path;
|
||||
}
|
||||
|
||||
const bool Library :: enabled()
|
||||
|
|
|
@ -8,7 +8,15 @@
|
|||
#include <core/database.h>
|
||||
|
||||
/**
|
||||
* Library tag
|
||||
* The Library tag is used to store a single directory added
|
||||
* to Ocarina by the user.
|
||||
*
|
||||
* When writing a Library tag to disk, write out the _enabled
|
||||
* and _path fields for each tag.
|
||||
*
|
||||
* ... << enabled1 << path1
|
||||
* ... << enabled2 << path2
|
||||
* ... << enabled3 << path3
|
||||
*/
|
||||
class Library : public DatabaseEntry {
|
||||
private:
|
||||
|
@ -17,29 +25,32 @@ private:
|
|||
bool _enabled; /**< Is this library path enabled? */
|
||||
|
||||
public:
|
||||
/** Library constructor */
|
||||
Library();
|
||||
Library(); /**< Library tag constructor. */
|
||||
|
||||
/**
|
||||
* Library constructor
|
||||
* @param path Path to the library on disk.
|
||||
* Library tag constructor.
|
||||
*
|
||||
* @param path Path to the library directory on disk.
|
||||
*/
|
||||
Library(const std::string &);
|
||||
|
||||
/**
|
||||
* Called to access the library tag's primary key.
|
||||
* @return Library::root_path
|
||||
*
|
||||
* @return Library::_path.
|
||||
*/
|
||||
const std::string primary_key() const;
|
||||
|
||||
/**
|
||||
* Read library information from file.
|
||||
*
|
||||
* @param file The file to read from.
|
||||
*/
|
||||
void read(File &);
|
||||
|
||||
/**
|
||||
* Write library information to file.
|
||||
*
|
||||
* @param file The file to write to.
|
||||
*/
|
||||
void write(File &);
|
||||
|
@ -59,7 +70,6 @@ public:
|
|||
*/
|
||||
void set_enabled(bool);
|
||||
|
||||
|
||||
/**
|
||||
* Called to access the number of tracks in this library.
|
||||
*
|
||||
|
@ -68,12 +78,12 @@ public:
|
|||
const unsigned int size();
|
||||
|
||||
/**
|
||||
* Used to increase _size by 1.
|
||||
* Used to increase Library::_size by 1.
|
||||
*/
|
||||
void inc_size();
|
||||
|
||||
/**
|
||||
* Used to decrease _size by 1.
|
||||
* Used to decrease Library::_size by 1.
|
||||
*/
|
||||
void dec_size();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue