]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use only enum values, don't look at bits.
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 10 Jun 2017 00:57:31 +0000 (18:57 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 10 Jun 2017 00:57:31 +0000 (18:57 -0600)
This fixes an (undocumented) oddity in ParameterHandler::print_parameters(): We
were at times looking at individual bits instead of just the declared values
of ParameterHandler::OutputStyle. This presumably allowed for calling that
function with a combination of the OutputStyle flags, for reasons that no
longer seem particularly relevant nor obvious.

This patch removes this possibility from the current implementation of
the function, but retains it for the (deprecated) function
ParameterHandler::print_parameters_section().

source/base/parameter_handler.cc

index 9d2f8b99958b4ed2ab8ebfc86edf6dadc5462645..ae4e5d35aca9c8cf22ae5f9e28cdc0ba4f5d3355 100644 (file)
@@ -2386,7 +2386,7 @@ ParameterHandler::recursively_print_parameters (const std::vector<std::string> &
             // 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 ((!(style & 128)) &&
+            if ((style == Text) &&
                 !p->second.get<std::string>("documentation").empty())
               {
                 if (first_entry == false)
@@ -2417,7 +2417,7 @@ ParameterHandler::recursively_print_parameters (const std::vector<std::string> &
 
             // finally print the default value, but only if it differs
             // from the actual value
-            if ((!(style & 64)) && value != p->second.get<std::string>("default_value"))
+            if ((style == Text) && value != p->second.get<std::string>("default_value"))
               {
                 out << std::setw(longest_value-value.length()+1) << ' '
                     << "# ";
@@ -2612,7 +2612,7 @@ ParameterHandler::recursively_print_parameters (const std::vector<std::string> &
 
     if ((style != Description)
         &&
-        (!(style & 128))
+        (style != ShortText)
         &&
         (n_parameters != 0)
         &&

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.