Commit ec7fdf92 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding with documentation

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2210
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 2ee5ca00
// this is <README>
// ----------------------------------------------------------------------------
// $Id: README,v 1.9 2002-11-27 22:38:38 forbrig Exp $
// $Id: README,v 1.10 2007-01-31 07:42:03 tforb Exp $
//
// Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
//
......@@ -18,7 +18,7 @@
\since November 2002
\date November 2002
\version V1.0
$Id: README,v 1.9 2002-11-27 22:38:38 forbrig Exp $
$Id: README,v 1.10 2007-01-31 07:42:03 tforb Exp $
\section main_aims Aims
......@@ -32,7 +32,13 @@ $Id: README,v 1.9 2002-11-27 22:38:38 forbrig Exp $
This modules supports a convenient definition and use of commandline
arguments. You find this module in namespace tfxx::cmdline.
References to the \ref commandline are collected on a separate page.
There are two interfaces available:
- The \ref commandline_h
is used to read optional and mandatory commandline options with or without
arguments.
- The \ref xcmdline_h
is used to read a list of filenames together with file specific options
and arguments.
\subsection main_module_io I/O support routines
......@@ -143,12 +149,16 @@ $Id: README,v 1.9 2002-11-27 22:38:38 forbrig Exp $
/*! \page notes Programming notes
No notes yet...
*/
/*======================================================================*/
/*! \page general General notes
No notes yet...
*/
// ----- END OF README -----
......@@ -4,7 +4,7 @@
* \addtogroup commandline_h
* ----------------------------------------------------------------------------
*
* $Id: commandline.h,v 1.3 2006-03-28 18:14:14 tforb Exp $
* $Id: commandline.h,v 1.4 2007-01-31 07:42:04 tforb Exp $
*
* \date 12/01/2002
* \author Thomas Forbriger
......@@ -41,7 +41,7 @@
#ifndef TF_COMMANDLINE_H_
//! $Id: newclass,v 1.2 2000/10/13 09:16:32 forbrig Exp 3
#define TF_COMMANDLINE_H_ \
"$Id: commandline.h,v 1.3 2006-03-28 18:14:14 tforb Exp $";
"$Id: commandline.h,v 1.4 2007-01-31 07:42:04 tforb Exp $";
#include<tfxx/error.h>
#include<iostream>
......@@ -61,6 +61,15 @@
/*! \brief Interface provided through commandline.h
*
* \defgroup commandline_h Interface provided through commandline.h
*
* The main classes providing this interface are
* - tfxx::cmdline::Commandline
* - tfxx::cmdline::Declare
*
* A tutorial for their use will be given there.
*
* \sa example_commandlinetest
*
* \ingroup group_commandline
*/
......
......@@ -4,7 +4,7 @@
* \ingroup xcmdline_h
* ----------------------------------------------------------------------------
*
* $Id: xcmdline.h,v 1.2 2006-03-28 18:14:14 tforb Exp $
* $Id: xcmdline.h,v 1.3 2007-01-31 07:42:04 tforb Exp $
* \author Thomas Forbriger
* \date 28/06/2005
*
......@@ -40,7 +40,7 @@
#define TF_XCMDLINE_H_VERSION \
"TF_XCMDLINE_H V1.0 "
#define TF_XCMDLINE_H_CVSID \
"$Id: xcmdline.h,v 1.2 2006-03-28 18:14:14 tforb Exp $"
"$Id: xcmdline.h,v 1.3 2007-01-31 07:42:04 tforb Exp $"
#include <tfxx/commandline.h>
#include <string>
......@@ -53,24 +53,149 @@ namespace tfxx {
/*! \brief Interface provided through xcmdline.h
*
* \defgroup xcmdline_h Interface provided through xcmdline.h
*
* This module is used to read a list o filenames from the command line
* together with options and arguments that are given per filename.
*
* In case you want to pass options in the form
* \verbatim filename f:option1 dl:option2 k:option3 \endverbatim
* you should generate keys of the form
* \code
* static const char* keys[]={"f", "dl", "k", 0};
* \endcode
*
* With this list of key strings, you call the function
* tfxx::cmdline::parse_cmdline to read the rest of the command line:
* \code
* tfxx::cmdline::Tparsed
* filenames=tfxx::cmdline::parse_cmdline(cmdline,
* keys,
* verbose);
* \endcode
* The arguments to this function have the following meaning:
* - \p cmdline is an object of type
* \code
* tfxx::cmdline::Commandline cmdline(iargc, argv, options);
* \endcode
* that is initialized with the contents of the command line and that is
* usually available anyway.
* - \p keys is a list of character strings declared as
* \code
* static const char* keys[]={"f", "dl", "k", 0};
* \endcode
* that contains the keys for filename specific parameters
* - \p debug is a switch of type
* \code
* bool verbose;
* \endcode
* that controls verbosity
*
* The functions returns an object of type tfxx::cmdline::Tparsed.
* This contains the filenames together with their parameters.
* It is a list of objects of type tfxx::cmdline::Filename actually
* defined as
* \code
* std::list<tfxx::cmdline::Filename> filenames;
* \endcode
* It can thus be scanned by the means of STL iterators.
* Each entry contains exactly one filename together with its parameters.
* See tfxx::cmdline::Filename for details.
*
* \sa example_commandlinetest
*
* \ingroup group_commandline
*/
/*! \brief pair to hold file option
* \ingroup group_commandline, xcmdline_h
*
* A std::pair is an STL container.
* In this it contains a key together with the parameter read from the
* command line.
* Given an option
* \code
* Tfileoption option;
* \endcode
* The key value is available through
* \code
* std::string key=option.first;
* \endcode
* and the parameter is available though
* \code
* std::string parameter=option.second;
* \endcode
*
* A tutorial is available in the detailed description of
* the \ref xcmdline_h
*
* \sa example_commandlinetest
*/
typedef std::pair<std::string, std::string> Tfileoption;
/*! \brief map to hold file options
* \ingroup group_commandline, xcmdline_h
*
* A std::multimap is an STL container of pairs.
* It provides STL iterators to scan the collection.
* In this context each element in a
* \c tfxx::cmdline::Toptionmap is a \c tfxx::cmdline::Tfileoption.
*
* A tutorial is available in the detailed description of
* the \ref xcmdline_h
*
* \sa example_commandlinetest
*/
typedef std::multimap<std::string, std::string> Toptionmap;
/*! \brief struct to hold filename together with options
/*! \brief A struct to hold filename together with options
* \ingroup group_commandline, xcmdline_h
*
* If a filename is given together with its specific parameters in
* \code
* tfxx::cmdline::Filename fname;
* \endcode
* You can
* - extract obtain the filename itself from field \p name:
* \code
* std::string name=fname.name;
* \endcode
* - extract all parameters together with their keys in a multimap from
* field \p options:
* \code
* std::multimap<std::string, std::string> parameters=fname.options;
* \endcode
* - extract all parameters matching a specific key \c "keyval" through
* function \c extract:
* \code
* std::multimap<std::string, std::string>
* parameters=fname.extract("keyval");
* \endcode
* - find out whether a key was used to specify parameters through
* function \c haskey:
* \code
* bool keysfound=fname.haskey("keyval");
* \endcode
* - find out how many entries are available for a specific key through
* function \c count:
* \code
* int nentries=fname.count("keyval");
* \endcode
* - extract the first parameter used together with a specific key through
* function \c value:
* \code
* std::string parameter=fname.value("keyval");
* \endcode
*
* Lists of parameters are provided in a multimap defined as
* \c tfxx::cmdline::Toptionmap
*
* \sa Toptionmap
* \sa example_commandlinetest
*/
struct Filename {
//! filename
std::string name;
//! multimap containing all arguments together with their keys
Toptionmap options;
//! return all entries for a given key
Toptionmap extract(const std::string& key) const;
......@@ -87,18 +212,21 @@ namespace tfxx {
/*! \brief list to hold file names with options
* \ingroup group_commandline, xcmdline_h
*
* A tutorial is available in the detailed description of
* the \ref xcmdline_h
*
* \sa example_commandlinetest
*/
typedef std::list<Filename> Tparsed;
/*! \brief parse command line arguments for file names and options
* \ingroup group_commandline, xcmdline_h
*
* In case you want to pass options in the form
* \verbatim filename f:option1 dl:option2 k:option3 \endverbatim
* you should generate keys of the form
* \code
* static const char* keys[]={"f", "dl", "k", 0};
* \endcode
* A tutorial is available in the detailed description of
* the \ref xcmdline_h
*
* \sa example_commandlinetest
*/
Tparsed parse_cmdline(tfxx::cmdline::Commandline& c,
const char** keys,
......
......@@ -359,7 +359,9 @@ INPUT = ./
# *.h++ *.idl *.odl *.cs
FILE_PATTERNS = *.h \
*.cc
*.cc \
README \
README.xtra
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: blitztest.cc,v 1.2 2002-11-29 16:10:25 forbrig Exp $
* $Id: blitztest.cc,v 1.3 2007-01-31 07:42:04 tforb Exp $
* \author Thomas Forbriger
* \date 28/11/2002
*
......@@ -19,7 +19,7 @@
#define BLITZTEST_VERSION \
"BLITZTEST V1.0 test all blitz support modules"
#define BLITZTEST_CVSID \
"$Id: blitztest.cc,v 1.2 2002-11-29 16:10:25 forbrig Exp $"
"$Id: blitztest.cc,v 1.3 2007-01-31 07:42:04 tforb Exp $"
#include <iostream>
#include <blitz/array.h>
......@@ -32,7 +32,15 @@ using std::cout;
using std::cerr;
using std::endl;
//! test blitz binary I/O operators
/*! \defgroup example_blitz TEST: Blitz array reading and writing
*
*/
/*! \brief test blitz binary I/O operators
* \ingroup example_blitz
*
*/
int main(int iargc, char* argv[])
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment