Browse Source

[2369] Move exceptions to the top of class

Mukund Sivaraman 12 years ago
parent
commit
80b227af0b
1 changed files with 26 additions and 26 deletions
  1. 26 26
      src/lib/dns/master_lexer_inputsource.h

+ 26 - 26
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.
     ///