From: Mukund Sivaraman Date: Fri, 2 Nov 2012 04:29:16 +0000 (+0530) Subject: [2369] Move exceptions to the top of class X-Git-Tag: trac2487_base~18^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80b227af0bf08ac9e7bdf645b11e8593b717add3;p=thirdparty%2Fkea.git [2369] Move exceptions to the top of class --- diff --git a/src/lib/dns/master_lexer_inputsource.h b/src/lib/dns/master_lexer_inputsource.h index bb507c9de3..b7eee5f11c 100644 --- a/src/lib/dns/master_lexer_inputsource.h +++ b/src/lib/dns/master_lexer_inputsource.h @@ -37,6 +37,32 @@ namespace master_lexer_internal { /// This class is not meant for public use. class InputSource { public: + /// \brief Returned by getChar() when end of stream is reached. + static const int END_OF_STREAM; + + /// \brief Exception thrown when ungetChar() is made to go before + /// the start of buffer. + struct UngetBeforeBeginning : public OutOfRange { + UngetBeforeBeginning(const char* file, size_t line, const char* what) : + OutOfRange(file, line, what) + {} + }; + + /// \brief Exception thrown when we fail to read from the input + /// stream or file. + struct ReadError : public Unexpected { + ReadError(const char* file, size_t line, const char* what) : + Unexpected(file, line, what) + {} + }; + + /// \brief Exception thrown when we fail to open the input file. + struct OpenError : public Unexpected { + OpenError(const char* file, size_t line, const char* what) : + Unexpected(file, line, what) + {} + }; + /// \brief Constructor which takes an input stream. The stream is /// read-from, but it is not closed. InputSource(std::istream& input_stream); @@ -73,32 +99,6 @@ public: saved_line_ = line_; } - /// \brief Exception thrown when ungetChar() is made to go before - /// the start of buffer. - struct UngetBeforeBeginning : public OutOfRange { - UngetBeforeBeginning(const char* file, size_t line, const char* what) : - OutOfRange(file, line, what) - {} - }; - - /// \brief Exception thrown when we fail to read from the input - /// stream or file. - struct ReadError : public Unexpected { - ReadError(const char* file, size_t line, const char* what) : - Unexpected(file, line, what) - {} - }; - - /// \brief Exception thrown when we fail to open the input file. - struct OpenError : public Unexpected { - OpenError(const char* file, size_t line, const char* what) : - Unexpected(file, line, what) - {} - }; - - /// \brief Returned by getChar() when end of stream is reached. - static const int END_OF_STREAM; - /// \brief Returns a single character from the input source. If end /// of file is reached, \c END_OF_STREAM is returned. ///