From d88f0087287717b47178249b6d910155d989bd38 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Fri, 14 Nov 2014 08:19:08 -0500 Subject: [PATCH] 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 --- DESIGN | 45 ------------------------------------- core/tags/library.cpp | 14 ++++++------ include/core/tags/library.h | 28 +++++++++++++++-------- 3 files changed, 26 insertions(+), 61 deletions(-) diff --git a/DESIGN b/DESIGN index a7c47696..12b0d063 100644 --- a/DESIGN +++ b/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. diff --git a/core/tags/library.cpp b/core/tags/library.cpp index ad1a25a1..c42c0e2b 100644 --- a/core/tags/library.cpp +++ b/core/tags/library.cpp @@ -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() diff --git a/include/core/tags/library.h b/include/core/tags/library.h index fa4fe7bd..20b3008c 100644 --- a/include/core/tags/library.h +++ b/include/core/tags/library.h @@ -8,7 +8,15 @@ #include /** - * 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(); };