diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Doxyfile | 12 | ||||
-rw-r--r-- | commands.cpp | 3 | ||||
-rw-r--r-- | commands.h | 2 | ||||
-rw-r--r-- | decoder.cpp | 1 | ||||
-rw-r--r-- | decoder.h | 1 | ||||
-rw-r--r-- | encoder.cpp | 1 | ||||
-rw-r--r-- | encoder.h | 1 | ||||
-rw-r--r-- | music.cpp | 10 | ||||
-rw-r--r-- | music.h | 4 | ||||
-rw-r--r-- | telnet_connection.cpp | 3 |
11 files changed, 39 insertions, 0 deletions
@@ -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<std::string handlers["update"] = &Commands::update; } +/** Invokes the command and returns its results. + * Throws CommandException if the command isn't found. + */ std::vector<std::string> Commands::operator()() { assert(args.size()); Handler h = handlers[args[0]]; @@ -25,9 +25,11 @@ class Commands { std::map<std::string, Handler> handlers; typedef boost::function<std::vector<MusicListing::p> (const std::string artist)> FindFunction; + //! Handlers for the find command. std::map<std::string, FindFunction> find_handlers; boost::asio::io_service& io_service; + //! Command arguments. std::vector<std::string>& args; std::vector<std::string> 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<boost::shared_ptr<DecoderMpg123> >(); } +//! 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]()))); } @@ -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<boost::shared_ptr<EncoderLame> >(); } +//! 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]()))); } @@ -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; @@ -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)) { @@ -9,19 +9,23 @@ namespace fs = boost::filesystem; +//! Generalized abstract class for music content. class MusicListing { public: typedef boost::shared_ptr<MusicListing> 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<MusicDirectory> 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<std::string> telnet::Connection::parse_args(std::string& line) { std::string::const_iterator begin = line.begin(); std::string::const_iterator end = line.end(); |