Author: wyoung
Date: Thu Jun 25 08:07:01 2009
New Revision: 2530
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2530&view=rev
Log:
- Removed CommandLineBase and friends from under the Doxygen
invisibility shield and added Doxygen comments to everything
- Several other minor changes for ssqlsxlat
Modified:
trunk/lib/cmdline.h
Modified: trunk/lib/cmdline.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/cmdline.h?rev=2530&r1=2529&r2=2530&view=diff
==============================================================================
--- trunk/lib/cmdline.h (original)
+++ trunk/lib/cmdline.h Thu Jun 25 08:07:01 2009
@@ -26,7 +26,7 @@
USA
***********************************************************************/
-#if !defined(MYSQLPP_CMDLINE_H) && !defined(DOXYGEN_IGNORE)
+#if !defined(MYSQLPP_CMDLINE_H)
#define MYSQLPP_CMDLINE_H
#include "common.h"
@@ -37,23 +37,27 @@
#include <assert.h>
namespace mysqlpp {
- // Simple class for parsing a command line and holding the results.
- // Just contains common functionality and data structures; see
- // overrides below for instantiable classes.
+ /// \brief Parses command line arguments and holds the results.
+ ///
+ /// This class just contains common functionality and data
+ /// structures; instantiable subclasses follow.
class MYSQLPP_EXPORT CommandLineBase
{
public:
//// Public types
+ /// \brief Type for a list of arguments
typedef std::vector<std::string> ArgumentList;
+ /// \brief Iterator into ArgumentList
typedef ArgumentList::const_iterator ArgumentListIt;
//// Public interface
- // Get reference to list of command line arguments past the
- // last flag and its possible argument.
+ /// \brief Get reference to list of command line arguments past
+ /// the last flag and its possible argument.
const ArgumentList& extra_args() const
{ return extra_args_; }
- // Return truthy value if command line was parsed successfully
+ /// \brief Return truthy value if command line was parsed
+ /// successfully
operator void*() const
{
return successful_ ? const_cast<bool*>(&successful_) :
0;
@@ -61,7 +65,7 @@
protected:
//// Subclass interface
- // Hidden ctor and dtor to prevent instantiation
+ /// \brief Hidden ctor to prevent instantiation
CommandLineBase(int argc, char* const argv[], const char* opts)
:
argc_(argc),
argv_(argv),
@@ -70,32 +74,37 @@
{
assert(successful_);
}
+ /// \brief Hidden dtor to prevent instantiation
virtual ~CommandLineBase() { }
- // If object is still marked as "successful", save non-option
- // arguments to extra_args_ list. Subclass ctor should call
- // this after the parse_next() loop gets EOF.
+ /// \brief If object is still marked as "successful", save
+ /// non-option arguments to extra_args_ list. Subclass ctor
+ /// should call this after the parse_next() loop gets EOF.
void finish_parse();
- // Accessors for getopt() globals, so subclasses can ignore
- // getopt()'s interface entirely.
+ /// \brief Accessor for getopt()'s optarg global
const char* option_argument() const;
+ /// \brief Accessor for getopt()'s optind global
int option_index() const;
- // Prints the passed message, calls subclass's print_usage(),
- // and marks the object as no longer successful.
+ /// \brief Called by a subclass when encountering a command
+ /// line parsing error.
+ ///
+ /// Prints the passed message, calls subclass's print_usage(),
+ /// and marks the object as no longer successful.
void parse_error(const char* message = 0);
- // Wrapper for getopt()
+ /// \brief Wrapper for getopt()
int parse_next() const;
- // Show a message explaining the program's proper usage
+ /// \brief Show a message explaining the program's proper usage
virtual void print_usage() const = 0;
- // Get the program's executable name
+ /// \brief Get the file name of the program's executable
const char* program_name() const { return argv_[0]; }
- // Returns true if nothing has gone wrong since calling the
ctor.
+ /// \brief Returns true if nothing has gone wrong since calling
+ /// the ctor.
bool successful() const { return successful_; }
private:
@@ -108,30 +117,52 @@
};
- // Stuff related to MySQL++ examples specifically
+ /// \brief Stuff related to MySQL++ examples specifically
namespace examples {
- // Name of examples' DB
+ /// \brief Name of examples' DB
extern const char* db_name;
- // Command line parsing mechanism for ../examples/*.cpp
+ /// \brief Command line parsing mechanism for ../examples/*.cpp
class MYSQLPP_EXPORT CommandLine : public CommandLineBase
{
public:
//// Public interface
- // Ctor
+ /// \brief Constructor
CommandLine(int argc, char* const argv[],
const char* user = 0, const char* pass
= 0,
const char* usage_extra = 0);
- // Show a message explaining the program's proper usage
+ /// \brief Show a message explaining the program's
proper usage
+ ///
+ /// Calls print_usage(const char*), passing along the
+ /// "usage_extra" parameter passed to the ctor
void print_usage() const { print_usage(usage_extra_); }
+
+ /// \brief Show a message explaining the program's
proper
+ /// usage, with custom extra info after standard command
+ /// line usage bits.
void print_usage(const char* extra) const;
- // Read-only "get" accessors
+ /// \brief Return true if we're in "dtest" mode
+ /// This happens when an example gets the -D flag,
always
+ /// passed by the dtest script to ask the programs it
runs
+ /// to suppress any nondeterministic output.
bool dtest_mode() const { return dtest_mode_; }
+
+ /// \brief Return the DB password (-p argument)
const char* pass() const { return pass_; }
+
+ /// \brief Return the -m flag value
+ ///
+ /// This flag is currently only used by
examples/deadlock,
+ /// but it's really a nonspecific "mode" value, which
could
+ /// be used by other examples in the future.
int run_mode() const { return run_mode_; }
+
+ /// \brief Return the DB server name (-s argument)
const char* server() const { return server_; }
+
+ /// \brief Return the DB user name (-u argument)
const char* user() const { return user_; }
private:
@@ -147,33 +178,48 @@
} // end namespace mysqlpp::examples
- // Command line parser for MySQL++'s ssqlsxlat tool
+ /// \brief Stuff specific to the ssqlsxlat tool
namespace ssqlsxlat {
+ /// \brief Command line parser for MySQL++'s ssqlsxlat tool
class MYSQLPP_EXPORT CommandLine : public CommandLineBase
{
public:
//// Public types
- enum input_source_t {
- input_unknown,
- input_ssqlsv1,
- input_ssqlsv2,
- input_table
+ /// \brief Types of inputs that ssqlsxlat will accept
+ enum InputSource {
+ is_unknown, ///< no known input type given
yet
+ is_ssqls1, ///< a C++ file containing an
SSQLS v1 declaration
+ is_ssqls2, ///< an SSQLS v2 file
+ is_table ///< an existing DB table schema
};
//// Public interface
- // Ctor
+ /// \brief Constructor
CommandLine(int argc, char* const argv[]);
- // Show a message explaining the program's proper usage
+ /// \brief Show a message explaining the program's
proper usage
void print_usage() const;
- // Read-only "get" accessors
+ /// \brief Return the name of the input source
+ ///
+ /// This can be a file name, a table name, etc. Call
+ /// input_source() to determine the proper
interpretation.
const char* input() const { return input_; }
+
+ /// \brief The input source type
+ InputSource input_source() const { return
input_source_; }
+
+ /// \brief The base name of the output file
const char* output() const { return output_; }
+
+ /// \brief DB password, when input type is is_table
const char* pass() const { return pass_; }
+
+ /// \brief DB server name, when input type is is_table
const char* server() const { return server_; }
+
+ /// \brief DB user name, when input type is is_table
const char* user() const { return user_; }
- input_source_t input_source() const { return
input_source_; }
private:
//// Internal data: command line parse results
@@ -182,7 +228,7 @@
const char* pass_;
const char* server_;
const char* user_;
- input_source_t input_source_;
+ InputSource input_source_;
};
} // end namespace mysqlpp::ssqlsxlat
} // end namespace mysqlpp
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits