From: Wolfgang Bangerth Date: Mon, 24 Apr 2017 17:21:27 +0000 (-0600) Subject: Remove deprecated ParameterHandler::read_input*(). X-Git-Tag: v9.0.0-rc1~1657^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8baf33d316b;p=dealii.git Remove deprecated ParameterHandler::read_input*(). --- diff --git a/include/deal.II/base/parameter_handler.h b/include/deal.II/base/parameter_handler.h index 4ac80e225b..f2d2241901 100644 --- a/include/deal.II/base/parameter_handler.h +++ b/include/deal.II/base/parameter_handler.h @@ -1734,24 +1734,6 @@ public: */ virtual ~ParameterHandler (); - /** - * Read input from a stream until the stream returns the eof - * condition or error. The second argument can be used to denote the name of - * the file (if that's what the input stream represents) we are reading - * from; this is only used when creating output for error messages. - * - * If non-empty @p last_line is provided, the ParameterHandler object - * will stop parsing lines after encountering @p last_line . - * This is handy when adding extra data that shall be parsed manually. - * - * @deprecated This function has been deprecated in favor of the replacement - * ParameterHandler::parse_input, which raises exceptions to indicate errors - * instead of returning an error code. - */ - virtual bool read_input (std::istream &input, - const std::string &filename = "input file", - const std::string &last_line = "") DEAL_II_DEPRECATED; - /** * Parse each line from a stream until the stream returns the eof * condition or error to provide values for known parameter fields. The second @@ -1767,32 +1749,6 @@ public: const std::string &filename = "input file", const std::string &last_line = ""); - /** - * Read input from a file the name of which is given. The PathSearch class - * "PARAMETERS" is used to find the file. - * - * Unless optional is true, this function will - * automatically generate the requested file with default values if the file - * did not exist. This file will not contain additional comments if - * write_stripped_file is true. - * - * If non-empty @p last_line is provided, the ParameterHandler object - * will stop parsing lines after encountering @p last_line . - * This is handy when adding extra data that shall be parsed manually. - * - * @deprecated This function has been deprecated in favor of the replacement - * ParameterHandler::parse_input, which raises exceptions to indicate errors - * instead of returning an error code. ParameterHandler::parse_input does - * not have the capability to write default values to a file on failure: if - * you wish to duplicate that old behavior then you should catch the - * PathSearch::ExcFileNotFound exception and then call - * ParameterHandler::print_parameters. - */ - virtual bool read_input (const std::string &filename, - const bool optional = false, - const bool write_stripped_file = false, - const std::string &last_line = "") DEAL_II_DEPRECATED; - /** * Parse the given file to provide values for known parameter fields. The * PathSearch class "PARAMETERS" is used to find the file. @@ -1804,21 +1760,6 @@ public: virtual void parse_input (const std::string &filename, const std::string &last_line = ""); - /** - * Read input from a string in memory. The lines in memory have to be - * separated by @\n characters. - * - * If non-empty @p last_line is provided, the ParameterHandler object - * will stop parsing lines after encountering @p last_line . - * This is handy when adding extra data that shall be parsed manually. - * - * @deprecated This function has been deprecated in favor of the replacement - * ParameterHandler::parse_input_from_string, which raises exceptions to - * indicate errors instead of returning an error code. - */ - virtual bool read_input_from_string (const char *s, - const std::string &last_line = ""); - /** * Parse input from a string to populate known parameter fields. The lines * in the string must be separated by @\n characters. @@ -1830,19 +1771,6 @@ public: virtual void parse_input_from_string (const char *s, const std::string &last_line = ""); - /** - * Read a parameter file in XML format. This could be from a file originally - * written by the print_parameters() function using the XML output style and - * then modified by hand as necessary; or from a file written using this - * method and then modified by the graphical parameter GUI (see the general - * documentation of this class). - * - * @deprecated This function has been deprecated in favor of the replacement - * ParameterHandler::parse_input_from_xml, which raises exceptions to indicate - * errors instead of returning an error code. - */ - virtual bool read_input_from_xml (std::istream &input) DEAL_II_DEPRECATED; - /** * Parse input from an XML stream to populate known parameter fields. This * could be from a file originally written by the print_parameters() function @@ -2623,33 +2551,6 @@ public: */ virtual ~MultipleParameterLoop (); - /** - * Read input from a stream until the stream returns the eof - * condition or error. The second argument can be used to denote the name of - * the file (if that's what the input stream represents) we are reading - * from; this is only used when creating output for error messages. - * - * Return whether the read was successful. - * - * If non-empty @p last_line is provided, the ParameterHandler object - * will stop parsing lines after encountering @p last_line . - * This is handy when adding extra data that shall be parsed manually. - * - * @note Of the three read_input functions implemented by - * ParameterHandler, this method and its replacement - * (MultipleParameterLoop::parse_input) are the only ones overridden with - * new behavior by this class. This is because the other two - * read_input functions just reformat their inputs and then call - * this version. - * - * @deprecated This function has been deprecated in favor of the replacement - * MultipleParameterLoop::parse_input, which raises exceptions to indicate - * errors instead of returning an error code. - */ - virtual bool read_input (std::istream &input, - const std::string &filename = "input file", - const std::string &last_line = "") DEAL_II_DEPRECATED; - /** * Read input from a stream until the stream returns the eof * condition or error. The second argument can be used to denote the name of @@ -2679,11 +2580,6 @@ public: */ using ParameterHandler::parse_input; - /** - * For backwards compatibility also include the deprecated read functions. - */ - using ParameterHandler::read_input; - /** * run the central loop. */ diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index 4a11bdd1e9..c072193074 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -1613,31 +1613,6 @@ ParameterHandler::get_current_full_path (const std::string &name) const -bool ParameterHandler::read_input (std::istream &input, - const std::string &filename, - const std::string &last_line) -{ - try - { - parse_input(input, filename, last_line); - return true; - } - catch (const ExcIO &) - { - throw; - } - // This catch block more or less duplicates the old behavior of this function, - // which was to print something to stderr for every parsing error (which are - // now exceptions) and then return false. - catch (const ExceptionBase &exc) - { - std::cerr << exc.what() << std::endl; - } - return false; -} - - - void ParameterHandler::parse_input (std::istream &input, const std::string &filename, const std::string &last_line) @@ -1741,39 +1716,6 @@ void ParameterHandler::parse_input (std::istream &input, -bool ParameterHandler::read_input (const std::string &filename, - const bool optional, - const bool write_compact, - const std::string &last_line) -{ - PathSearch search("PARAMETERS"); - - try - { - std::string openname = search.find(filename); - std::ifstream file_stream (openname.c_str()); - AssertThrow(file_stream, ExcIO()); - - return read_input (file_stream, filename, last_line); - } - catch (const PathSearch::ExcFileNotFound &) - { - std::cerr << "ParameterHandler::read_input: could not open file <" - << filename << "> for reading." << std::endl; - if (!optional) - { - std::cerr << "Trying to make file <" - << filename << "> with default values for you." << std::endl; - std::ofstream output (filename.c_str()); - if (output) - print_parameters (output, (write_compact ? ShortText : Text)); - } - } - return false; -} - - - void ParameterHandler::parse_input (const std::string &filename, const std::string &last_line) { @@ -1786,31 +1728,6 @@ void ParameterHandler::parse_input (const std::string &filename, -bool -ParameterHandler::read_input_from_string (const char *s, - const std::string &last_line) -{ - try - { - parse_input_from_string (s, last_line); - return true; - } - catch (const ExcIO &) - { - throw; - } - // This catch block more or less duplicates the old behavior of this function, - // which was to print something to stderr for every parsing error (which are - // now exceptions) and then return false. - catch (const ExceptionBase &exc) - { - std::cerr << exc.what() << std::endl; - } - return false; -} - - - void ParameterHandler::parse_input_from_string (const char *s, const std::string &last_line) @@ -1905,26 +1822,6 @@ namespace -bool ParameterHandler::read_input_from_xml(std::istream &in) -{ - try - { - parse_input_from_xml (in); - return true; - } - catch (const ExcIO &) - { - throw; - } - catch (const ExceptionBase &exc) - { - std::cerr << exc.what() << std::endl; - } - return false; -} - - - void ParameterHandler::parse_input_from_xml (std::istream &in) { AssertThrow(in, ExcIO()); @@ -3193,33 +3090,6 @@ MultipleParameterLoop::~MultipleParameterLoop () -bool -MultipleParameterLoop::read_input (std::istream &input, - const std::string &filename, - const std::string &last_line) -{ - - try - { - MultipleParameterLoop::parse_input(input, filename, last_line); - return true; - } - catch (const ExcIO &) - { - throw; - } - // This catch block more or less duplicates the old behavior of this function, - // which was to print something to stderr for every parsing error (which are - // now exceptions) and then return false. - catch (const ExceptionBase &exc) - { - std::cerr << exc.what() << std::endl; - } - return false; -} - - - void MultipleParameterLoop::parse_input (std::istream &input, const std::string &filename,