From f0db6a4e4e6b3059c6553b819ac8788b62486103 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Tue, 4 Jan 2011 03:17:45 +0100 Subject: Added Doxyfile and documentation comments in various places. --- .gitignore | 1 + Doxyfile | 12 ++++++++++++ commands.cpp | 3 +++ commands.h | 2 ++ decoder.cpp | 1 + decoder.h | 1 + encoder.cpp | 1 + encoder.h | 1 + music.cpp | 10 ++++++++++ music.h | 4 ++++ telnet_connection.cpp | 3 +++ 11 files changed, 39 insertions(+) create mode 100644 Doxyfile diff --git a/.gitignore b/.gitignore index c2fa971..85183e8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.conf *.sock *.vim +/doc /audistd .sconf_temp .sconsign.dblite diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..f57464b --- /dev/null +++ b/Doxyfile @@ -0,0 +1,12 @@ +PROJECT_NAME = audist + +OUTPUT_DIRECTORY = doc +HTML_OUTPUT = . +GENERATE_LATEX = NO + +TAB_SIZE = 4 + +QUIET = YES + +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES diff --git a/commands.cpp b/commands.cpp index 3000f31..84c1e5f 100644 --- a/commands.cpp +++ b/commands.cpp @@ -78,6 +78,9 @@ Commands::Commands(boost::asio::io_service& io_service_, std::vector Commands::operator()() { assert(args.size()); Handler h = handlers[args[0]]; diff --git a/commands.h b/commands.h index 084dd02..78ecf48 100644 --- a/commands.h +++ b/commands.h @@ -25,9 +25,11 @@ class Commands { std::map handlers; typedef boost::function (const std::string artist)> FindFunction; + //! Handlers for the find command. std::map find_handlers; boost::asio::io_service& io_service; + //! Command arguments. std::vector& args; std::vector ls(); diff --git a/decoder.cpp b/decoder.cpp index 420d538..f01215b 100644 --- a/decoder.cpp +++ b/decoder.cpp @@ -18,6 +18,7 @@ void decoder::init() { decoder_factories["mpg123"] = boost::factory >(); } +//! Construct a filter with the given decoder. DecoderFilter::p decoder::get_decoder(const std::string& name) { return DecoderFilter::p(new DecoderFilter(DecoderBase::p(decoder_factories[name]()))); } diff --git a/decoder.h b/decoder.h index c894065..25dbe56 100644 --- a/decoder.h +++ b/decoder.h @@ -13,6 +13,7 @@ class DecoderBase { virtual size_t decode(const uint8_t *input, size_t input_size, uint8_t *output, size_t output_size) = 0; }; +//! Input filter to hold a decoder in a filter chain. class DecoderFilter : public boost::iostreams::multichar_input_filter { private: DecoderBase::p decoder; diff --git a/encoder.cpp b/encoder.cpp index 0c0350a..cd37daa 100644 --- a/encoder.cpp +++ b/encoder.cpp @@ -17,6 +17,7 @@ void encoder::init() { encoder_factories["lame"] = boost::factory >(); } +//! Construct a filter with the given encoder. EncoderFilter::p encoder::get_encoder(const std::string& name) { return EncoderFilter::p(new EncoderFilter(EncoderBase::p(encoder_factories[name]()))); } diff --git a/encoder.h b/encoder.h index 14ecfeb..52c50ab 100644 --- a/encoder.h +++ b/encoder.h @@ -15,6 +15,7 @@ class EncoderBase { virtual size_t flush(uint8_t *output, size_t output_size) = 0; }; +//! Input filter to hold an encoder in a filter chain. class EncoderFilter : public boost::iostreams::multichar_input_filter { private: EncoderBase::p encoder; diff --git a/music.cpp b/music.cpp index 3faca9c..eb16226 100644 --- a/music.cpp +++ b/music.cpp @@ -24,6 +24,10 @@ void music::init(std::string root) { root_directory = root; } +/** Fetches a MusicListing object from the given path. + * Prefixes the given path with the music root directory. + * This can be either a track (file) or a directory. + */ MusicListing::p music::get(const HTTP::Connection::PathList& path) { // prefix path with our root_directory fs::path p = root_directory; @@ -48,12 +52,18 @@ MusicListing::p music::get(const HTTP::Connection::PathList& path) { return MusicListing::p(); } +/** Fetches a MusicListing object from the given path. + * Splits the given string and calls the above function. + */ MusicListing::p music::get(const std::string& path) { HTTP::Connection::PathList path_vector; boost::algorithm::split(path_vector, path, boost::algorithm::is_any_of("/\\")); return get(path_vector); } +/** Fetches a directory. + * This is a helper function which returns a null pointer if the fetched MusicListing isn't a directory. + */ MusicDirectory::p music::get_directory(const std::string& path) { MusicListing::p ml = get(path); if(!ml || !fs::is_directory(ml->path)) { diff --git a/music.h b/music.h index c019136..ed47657 100644 --- a/music.h +++ b/music.h @@ -9,19 +9,23 @@ namespace fs = boost::filesystem; +//! Generalized abstract class for music content. class MusicListing { public: typedef boost::shared_ptr p; fs::path path; + //! Render the content for HTTP transport. virtual void render(HTTP::Connection::p req) = 0; }; +//! Represents a track. class MusicTrack : public MusicListing { public: MusicTrack(const fs::path path); virtual void render(HTTP::Connection::p req); }; +//! Represents a directory. class MusicDirectory : public MusicListing { public: typedef boost::shared_ptr p; diff --git a/telnet_connection.cpp b/telnet_connection.cpp index 2cc723e..8d6675d 100644 --- a/telnet_connection.cpp +++ b/telnet_connection.cpp @@ -51,6 +51,9 @@ void telnet::Connection::handle_read(const boost::system::error_code& error, siz start(); } +/** Parse a given line and return a vector with its arguments. + * Arguments which are surrounded by "quotes" are interpreted as a single argument. + */ std::vector telnet::Connection::parse_args(std::string& line) { std::string::const_iterator begin = line.begin(); std::string::const_iterator end = line.end(); -- cgit v1.2.3