From fba8ac2b43b6af28deb0dfff21004874d98fb09e Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 3 Sep 2002 15:21:56 +0000 Subject: [PATCH] Indentation changes and truncate lines at some width if possible. git-svn-id: https://svn.dealii.org/trunk@6343 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/table_handler.h | 623 ++++++++++++---------- 1 file changed, 333 insertions(+), 290 deletions(-) diff --git a/deal.II/base/include/base/table_handler.h b/deal.II/base/include/base/table_handler.h index 9ef7e58670..ebc2a2273b 100644 --- a/deal.II/base/include/base/table_handler.h +++ b/deal.II/base/include/base/table_handler.h @@ -41,23 +41,24 @@ class TableEntryBase { public: - /** - * Constructor. - */ + /** + * Constructor. + */ TableEntryBase(); - /** - * Virtual destructor. - */ + + /** + * Virtual destructor. + */ virtual ~TableEntryBase(); - /** - * Write the table entry as text. - */ + /** + * Write the table entry as text. + */ virtual void write_text (std::ostream &) const =0; - - /** - * Write the table entry in tex format. - */ + + /** + * Write the table entry in tex format. + */ virtual void write_tex (std::ostream &) const =0; }; @@ -77,54 +78,58 @@ template class TableEntry : public TableEntryBase { public: - /** - * Constructor. - */ + /** + * Constructor. + */ TableEntry(const value_type value); - /** - * Destructor. - */ + /** + * Destructor. + */ virtual ~TableEntry(); - /** - * Returns the value of this - * table entry. - */ + /** + * Returns the value of this + * table entry. + */ value_type value() const; - /** - * Write the table entry as text. - */ + /** + * Write the table entry as text. + */ virtual void write_text (std::ostream &out) const; - /** - * Write the table entry in tex format. - */ + /** + * Write the table entry in tex + * format. + */ virtual void write_tex (std::ostream &out) const; private: - /** - * Stored value. - */ + /** + * Stored value. + */ const value_type val; }; /** - * The @p{TableHandler} stores @p{TableEntries} of arbitrary value type and - * writes the table as text or in tex format to an output stream. The value - * type actually may vary from column to column and from row to row. + * The @p{TableHandler} stores @p{TableEntries} of arbitrary value + * type and writes the table as text or in tex format to an output + * stream. The value type actually may vary from column to column and + * from row to row. * * @sect3{Usage} * - * The most important function is the templatized function - * @p{add_value(const std::string &key, const value_type value)}, that adds a column - * with the name @p{key} to the table if this column does not yet exist and adds the - * value of @p{value_type} (e.g. @p{unsigned int}, @p{double}, @p{std::string}, ...) to this column. - * After the table is complete there are different possibilities of output, e.g. - * into a tex file with @p{write_tex(std::ofstream &file)} or as text with - * @p{write_text (std::ostream &out)}. + * The most important function is the templatized function + * @p{add_value(const std::string &key, const value_type value)}, that + * adds a column with the name @p{key} to the table if this column + * does not yet exist and adds the value of @p{value_type} + * (e.g. @p{unsigned int}, @p{double}, @p{std::string}, ...) to this + * column. After the table is complete there are different + * possibilities of output, e.g. into a tex file with + * @p{write_tex(std::ofstream &file)} or as text with @p{write_text + * (std::ostream &out)}. * * Two (or more) columns may be merged into a "supercolumn" by twice * (or multiple) calling @p{add_column_to_supercolumn(...)}, see @@ -134,12 +139,14 @@ class TableEntry : public TableEntryBase * with in tex mode. * * @sect3{Example} - * This is a simple example demonstrating the usage of this class. The first column - * includes the numbers @p{i=1..n}, the second $1^2$...$n^2$, the third $sqrt(1)...sqrt(n)$, - * where the second and third columns are merged into one supercolumn - * with the superkey @p{squares and roots}. Additionally the first column is - * aligned to the right (the default was @p{centered}) and the precision of - * the square roots are set to be 6 (instead of 4 as default). + * + * This is a simple example demonstrating the usage of this class. The + * first column includes the numbers @p{i=1..n}, the second + * $1^2$...$n^2$, the third $sqrt(1)...sqrt(n)$, where the second and + * third columns are merged into one supercolumn with the superkey + * @p{squares and roots}. Additionally the first column is aligned to + * the right (the default was @p{centered}) and the precision of the + * square roots are set to be 6 (instead of 4 as default). * * @begin{verbatim} * TableHandler table(); @@ -170,296 +177,332 @@ class TableHandler { public: - /** - * Constructor. - */ + /** + * Constructor. + */ TableHandler(); - /** - * Adds a column (if not yet existent) with - * the key @p{key} - * and adds the value of @p{value_type} - * to the column. - */ + /** + * Adds a column (if not yet + * existent) with the key @p{key} + * and adds the value of + * @p{value_type} to the column. + */ template void add_value (const std::string &key, - const value_type value); + const value_type value); - /** - * Creates a sypercolumn (if not yet - * existent) and includes column to it. - * The keys of the column and the supercolumn - * are @p{key} and @p{superkey}, respectively. - * To merge two columns @p{c1} and @p{c2} to - * a supercolumn @p{sc} hence call - * @p{add_column_to_supercolumn(c1,sc)} and - * @p{add_column_to_supercolumn(c2,sc)}. - * - * Concerning the order of the columns, - * the supercolumn replaces the first - * column that is added to the supercolumn. - * Within the supercolumn - * the order of output follows the order - * the columns are added to the supercolumn. - */ + /** + * Creates a supercolumn (if not + * yet existent) and includes + * column to it. The keys of the + * column and the supercolumn are + * @p{key} and @p{superkey}, + * respectively. To merge two + * columns @p{c1} and @p{c2} to a + * supercolumn @p{sc} hence call + * @p{add_column_to_supercolumn(c1,sc)} + * and + * @p{add_column_to_supercolumn(c2,sc)}. + * + * Concerning the order of the + * columns, the supercolumn + * replaces the first column that + * is added to the supercolumn. + * Within the supercolumn the + * order of output follows the + * order the columns are added to + * the supercolumn. + */ void add_column_to_supercolumn (const std::string &key, - const std::string &superkey); - - /** - * Change the order of columns and - * supercolumns in the table. - * - * @p{new_order} includes the keys and - * superkeys of the columns and - * supercolumns in the order the user like to. - * If a superkey is included the keys - * of the subcolumns need not to be additionally - * mentioned in this vector. - * The order of subcolumns within a supercolumn - * is not changeable and keeps the order - * in which - * the columns are added to the supercolumn. - * - * This function may also be used to break - * big tables with to many columns into smaller - * ones. Call this function with - * the first e.g. five columns and then @p{write_*}. - * Afterwards call this function with the - * next e.g. five columns and again @p{write_*}, - * and so on. - */ + const std::string &superkey); + + /** + * Change the order of columns and + * supercolumns in the table. + * + * @p{new_order} includes the + * keys and superkeys of the + * columns and supercolumns in + * the order the user like to. + * If a superkey is included the + * keys of the subcolumns need + * not to be additionally + * mentioned in this vector. The + * order of subcolumns within a + * supercolumn is not changeable + * and keeps the order in which + * the columns are added to the + * supercolumn. + * + * This function may also be used + * to break big tables with to + * many columns into smaller + * ones. Call this function with + * the first e.g. five columns + * and then @p{write_*}. + * Afterwards call this function + * with the next e.g. five + * columns and again @p{write_*}, + * and so on. + */ void set_column_order (const std::vector &new_order); - /** - * Sets the @p{precision} e.g. double or float - * variables are written with. @p{precision} is - * the same as in calling - * @p{out << setprecision(precision)}. - */ + /** + * Sets the @p{precision} + * e.g. double or float variables + * are written + * with. @p{precision} is the + * same as in calling + * @p{out< does not exist."); + std::string, + << "Column <" << arg1 << "> does not exist."); - /** - * Exception - */ + /** + * Exception + */ DeclException1 (ExcSuperColumnNotExistent, - std::string, - << "Supercolumn <" << arg1 << "> does not exist."); + std::string, + << "Supercolumn <" << arg1 << "> does not exist."); - /** - * Exception - */ + /** + * Exception + */ DeclException1 (ExcColumnOrSuperColumnNotExistent, - std::string, - << "Column or supercolumn <" << arg1 << "> does not exist."); + std::string, + << "Column or supercolumn <" << arg1 << "> does not exist."); - /** - * Exception - */ + /** + * Exception + */ DeclException4 (ExcWrongNumberOfDataEntries, - std::string, int, std::string, int, - << "Column <" << arg1 << "> has got " << arg2 - << " rows, but Column <" << arg3 << "> has got " << arg4 << "."); + std::string, int, std::string, int, + << "Column <" << arg1 << "> has got " << arg2 + << " rows, but Column <" << arg3 << "> has got " << arg4 << "."); - /** - * Exception - */ + /** + * Exception + */ DeclException1 (ExcUndefinedTexFormat, - std::string, - << "<" << arg1 << "> is not a tex column format. Use l,c,r."); + std::string, + << "<" << arg1 << "> is not a tex column format. Use l,c,r."); protected: - /** - * Structure encapsulating all the data - * that is needed to describe one column - * of a table. - */ + /** + * Structure encapsulating all the data + * that is needed to describe one column + * of a table. + */ struct Column { - /** - * Constructor needed by STL maps. - */ - Column(); - - /** - * Constructor. - */ - Column(const std::string &tex_caption); + /** + * Constructor needed by STL maps. + */ + Column(); + + /** + * Constructor. + */ + Column(const std::string &tex_caption); - /** - * Destructor. - */ - ~Column(); + /** + * Destructor. + */ + ~Column(); - /** - * List of entries within this column. - * They may actually be of very - * different type, since we use the - * templated @p{TableEntry} class - * for actual values, which is only - * a wrapper for @p{T}, but is derived - * from @p{TableEntryBase}. - */ - std::vector entries; + /** + * List of entries within + * this column. They may + * actually be of very + * different type, since we + * use the templated + * @p{TableEntry} class + * for actual values, which + * is only a wrapper for + * @p{T}, but is derived from + * @p{TableEntryBase}. + */ + std::vector entries; - /** - * The caption of the column in tex output. - * By default, this is the key string that - * is given to the @p{TableHandler} by - * @p{TableHandler::add_value(...)}. This may - * be changed by calling - * @p{TableHandler::set_tex_caption(...)}. - */ - std::string tex_caption; - - /** - * The column format in tex output. - * By default, this is @p{"c"}, meaning - * `centered'. This may - * be changed by calling - * @p{TableHandler::set_tex_format(...)} - * with @p{"c", "r", "l"} for centered, - * right or left. - */ + /** + * The caption of the column + * in tex output. By + * default, this is the key + * string that is given to + * the @p{TableHandler} by + * @p{TableHandler::add_value(...)}. This + * may be changed by calling + * @p{TableHandler::set_tex_caption(...)}. + */ + std::string tex_caption; + + /** + * The column format in tex + * output. By default, this + * is @p{"c"}, meaning + * `centered'. This may be + * changed by calling + * @p{TableHandler::set_tex_format(...)} + * with @p{"c", "r", "l"} for + * centered, right or left. + */ - std::string tex_format; - - /** - * Double or float entries are written with - * this precision (set by the user). - * The default is 4. - */ - unsigned int precision; - - /** - * @p{scientific}=false means fixed - * point notation. - */ - bool scientific; - - /** - * Flag that may be used by derived - * classes for arbitrary purposes. - */ - unsigned int flag; + std::string tex_format; + + /** + * Double or float entries + * are written with this + * precision (set by the + * user). The default is 4. + */ + unsigned int precision; + + /** + * @p{scientific}=false means + * fixed point notation. + */ + bool scientific; + + /** + * Flag that may be used by + * derived classes for + * arbitrary purposes. + */ + unsigned int flag; }; - /** - * Help function that gives a vector of - * the keys of all columns that are mentioned - * in @p{column_order}, where each supercolumn key - * is replaced by its subcolumn keys. - * - * This function implicitly checks the - * consistency of the data. The result is - * returned in @p{sel_columns}. - */ + /** + * Help function that gives a + * vector of the keys of all + * columns that are mentioned in + * @p{column_order}, where each + * supercolumn key is replaced by + * its subcolumn keys. + * + * This function implicitly + * checks the consistency of the + * data. The result is returned + * in @p{sel_columns}. + */ void get_selected_columns (std::vector &sel_columns) const; - /** - * Builtin function, that gives the - * number of rows in the table and - * that checks if the number of rows - * is equal in every - * column. This function is e.g. called before - * writing output. - */ + /** + * Builtin function, that gives + * the number of rows in the + * table and that checks if the + * number of rows is equal in + * every column. This function is + * e.g. called before writing + * output. + */ unsigned int n_rows() const; - /** - * Stores the column and - * supercolumn keys in the order desired - * by the user. - * By default this is the order of - * adding the columns. This order may be - * changed by @p{set_column_order(...)}. - */ + /** + * Stores the column and + * supercolumn keys in the order + * desired by the user. By + * default this is the order of + * adding the columns. This order + * may be changed by + * @p{set_column_order(...)}. + */ std::vector column_order; - /** - * Maps the column keys to the columns - * (not supercolumns). - */ + /** + * Maps the column keys to the + * columns (not supercolumns). + */ std::map columns; - /** - * Maps each supercolumn key to the - * the keys of its subcolumns in the right order. - * It is allowed that a supercolumn has got - * the same key as a column. - * - * Note that we do not use a @p{multimap} - * here since the order of column - * keys for each supercolumn key is - * relevant. - */ + /** + * Maps each supercolumn key to + * the the keys of its subcolumns + * in the right order. It is + * allowed that a supercolumn has + * got the same key as a column. + * + * Note that we do not use a @p{multimap} + * here since the order of column + * keys for each supercolumn key is + * relevant. + */ std::map > supercolumns; - /** - * Maps the supercolumn keys to the - * captions of the supercolumns that - * are used in tex output. - * - * By default these are just the - * supercolumn keys but they may be changed - * by @p{set_tex_supercaptions(...)}. - */ + /** + * Maps the supercolumn keys to + * the captions of the + * supercolumns that are used in + * tex output. + * + * By default these are just the + * supercolumn keys but they may + * be changed by + * @p{set_tex_supercaptions(...)}. + */ std::map tex_supercaptions; }; -- 2.39.5