From: rao Date: Thu, 21 Oct 2010 15:37:51 +0000 (+0000) Subject: Add description_init to parameter_handler X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1f94408e91fa39d815d7aeda42a7b66cc838018;p=dealii-svn.git Add description_init to parameter_handler git-svn-id: https://svn.dealii.org/trunk@22420 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/parameter_handler.h b/deal.II/base/include/base/parameter_handler.h index 223ff90194..05864f1e4e 100644 --- a/deal.II/base/include/base/parameter_handler.h +++ b/deal.II/base/include/base/parameter_handler.h @@ -276,7 +276,13 @@ namespace Patterns * a valid range. */ const int upper_bound; + + /** + * Initial part of description + */ + static const char* description_init; }; + const char* Integer::description_init = "[Integer"; /** * Test for the string being a @@ -410,7 +416,13 @@ namespace Patterns * a valid range. */ const double upper_bound; + + /** + * Initial part of description + */ + static const char* description_init; }; + const char* Double::description_init = "[Double"; /** * Test for the string being one @@ -483,7 +495,13 @@ namespace Patterns * the constructor. */ std::string sequence; + + /** + * Initial part of description + */ + static const char* description_init; }; + const char* Selection::description_init = "[Selection"; /** @@ -596,7 +614,13 @@ namespace Patterns * the list must have. */ const unsigned int max_elements; + + /** + * Initial part of description + */ + static const char* description_init; }; + const char* List::description_init = "[List"; /** * This class is much like the @@ -688,7 +712,13 @@ namespace Patterns * the constructor. */ std::string sequence; + + /** + * Initial part of description + */ + static const char* description_init; }; + const char* MultipleSelection::description_init = "[MultipleSelection"; /** * Test for the string being @@ -758,7 +788,13 @@ namespace Patterns * function. */ virtual PatternBase * clone () const; + + /** + * Initial part of description + */ + static const char* description_init; }; + const char* Anything::description_init = "[Anything"; } diff --git a/deal.II/base/source/parameter_handler.cc b/deal.II/base/source/parameter_handler.cc index b72d0ca709..04349eb53d 100644 --- a/deal.II/base/source/parameter_handler.cc +++ b/deal.II/base/source/parameter_handler.cc @@ -147,7 +147,8 @@ namespace Patterns { std::ostringstream description; - description << "[Integer range " + description << description_init + <<" range " << lower_bound << "..." << upper_bound << " (inclusive)]"; return description.str(); @@ -215,14 +216,15 @@ namespace Patterns std::string Double::description () const { + std::ostringstream description; + // check whether valid bounds // were specified, and if so // output their values if (lower_bound <= upper_bound) { - std::ostringstream description; - - description << "[Floating point range " + description << description_init + << " " << lower_bound << "..." << upper_bound << " (inclusive)]"; return description.str(); @@ -230,7 +232,10 @@ namespace Patterns else // if no bounds were given, then // return generic string - return "[Double]"; + { + description << description_init + << "]"; + return description.str(); } @@ -278,7 +283,14 @@ namespace Patterns std::string Selection::description () const { - return sequence; + std::ostringstream description; + + description << description_init + << " " + << sequence + << " ]"; + + return description.str(); } @@ -379,9 +391,11 @@ namespace Patterns { std::ostringstream description; - description << "list of <" << pattern->description() << ">" + description << description_init + << " list of <" << pattern->description() << ">" << " of length " << min_elements << "..." << max_elements - << " (inclusive)"; + << " (inclusive)" + << "]"; return description.str(); } @@ -483,7 +497,14 @@ namespace Patterns std::string MultipleSelection::description () const { - return sequence; + std::ostringstream description; + + description << description_init + << " " + << sequence + << " ]"; + + return description.str(); } @@ -533,7 +554,12 @@ namespace Patterns std::string Anything::description () const { - return "[Anything]"; + std::ostringstream description; + + description << description_init + << "]" + + return description.str(); }