From 77600d9cd68379541fe645004fa6bc365c3b5237 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 8 Sep 2005 23:59:48 +0000 Subject: [PATCH] Significantly improve handling of comment lines. git-svn-id: https://svn.dealii.org/trunk@11377 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/parameter_handler.cc | 55 ++++++++++++++---------- deal.II/doc/news/changes.html | 9 ++++ 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/deal.II/base/source/parameter_handler.cc b/deal.II/base/source/parameter_handler.cc index c4a1084b98..96659114db 100644 --- a/deal.II/base/source/parameter_handler.cc +++ b/deal.II/base/source/parameter_handler.cc @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ #endif + //TODO[WB]: various functions here could be simplified by using namespace Utilities namespace Patterns @@ -903,6 +905,35 @@ ParameterHandler::print_parameters_section (std::ostream &out, : pd->entries[ptr->first].value); + // if there is documentation, + // then add an empty line (unless + // this is the first entry in a + // subsection), print the + // documentation, and then the + // actual entry; break the + // documentation into readable + // chunks such that the whole + // thing is at most 78 characters + // wide + if (pd->entries[ptr->first].has_documentation()) + { + if (ptr != pd->entries.begin()) + out << std::endl; + + const std::vector doc_lines + = Utilities:: + break_text_into_lines (pd->entries[ptr->first].documentation, + 78 - indent_level*2 - 2); + + for (unsigned int i=0; ifirst.length()+1) << " " << "= " << value; - // if we are going to write some - // text after this, then add a - // comment marker and align it - // properly - if ((pd->entries[ptr->first].has_documentation()) - || - (value != pd->entries[ptr->first].value)) - out << std::setw(longest_value-value.length()+1) << " " - << "# "; - - // if there is - // documentation, then - // print that, too. the - // documentation is - // always looked up in - // the Defaults tree - if (pd->entries[ptr->first].documentation.length() != 0) - out << pd->entries[ptr->first].documentation; - // finally print the // default value, but // only if it differs // from the actual value if (value != pd->entries[ptr->first].value) { - if (pd->entries[ptr->first].documentation.length() != 0) - out << ", "; - + out << std::setw(longest_value-value.length()+1) << " " + << "# "; out << "default: " << pd->entries[ptr->first].value; } diff --git a/deal.II/doc/news/changes.html b/deal.II/doc/news/changes.html index ab3f43389a..47af0531bf 100644 --- a/deal.II/doc/news/changes.html +++ b/deal.II/doc/news/changes.html @@ -264,6 +264,15 @@ inconvenience this causes.

base

    +
  1. + Extended: The ParameterHandler class now does a much better + job generating output in the print_parameters() function if + parameters have documentation strings attached to them. See the step-19 + example program output for this. +
    + (WB, 2005/09/12) +

    +
  2. New: There is now a namespace Utilities that contains functions that are not particularly specific to finite element codes, -- 2.39.5