]> git.lyx.org Git - lyx.git/blobdiff - src/PrinterParams.h
Dekels tabular/textinset patches
[lyx.git] / src / PrinterParams.h
index 90ce2f9a008eec7926883f324bb4aa3f449e57a5..a5609e262e7e38792309c2df5c9a588e042ca859 100644 (file)
 
 #ifdef ENABLE_ASSERTIONS
 #include "support/LAssert.h"
+extern bool containsOnly(string const &, char const *);
 #endif
 
+
 /**
   This struct contains (or should contain) all the parameters required for
   printing a buffer.  Some work still needs to be done on this struct and
@@ -33,7 +35,7 @@
 */
 struct PrinterParams {
        ///
-       enum Target{
+       enum Target {
                ///
                PRINTER,
                ///
@@ -82,6 +84,46 @@ struct PrinterParams {
        // Override document settings for duplex.
        // bool duplex;
 
+       /** Test that all the fields contain valid entries.  It's unlikely
+           that the internal code will get this wrong (at least for the
+           xforms code anyway) however new ports and external scripts
+           might drive the wrong values in.
+        */
+       void testInvariant() const
+               {
+#ifdef ENABLE_ASSERTIONS
+                       if (!from_page.empty()) {
+                               // Assert(from_page == number or empty)
+                               Assert(containsOnly(from_page, "1234567890"));
+                       }
+                       if (to_page) {
+                               // Assert(to_page == empty
+                               //        or number iff from_page set)
+                               Assert(!from_page.empty());
+                       }
+                       switch (target) {
+                       case PRINTER:
+//                             Assert(!printer_name.empty());
+                               break;
+                       case FILE:
+                               Assert(!file_name.empty());
+                               break;
+                       default:
+                               Assert(false);
+                               break;
+                       }
+                       switch (which_pages) {
+                       case ALL:
+                       case ODD:
+                       case EVEN:
+                               break;
+                       default:
+                               Assert(false);
+                               break;
+                       }
+#endif
+               }
+
        ///
        PrinterParams(Target const & t = PRINTER,
                      string const & pname = lyxrc.printer,
@@ -123,49 +165,6 @@ struct PrinterParams {
 //     friend bool operator==(PrinterParams const &, PrinterParams const &);
 //     friend bool operator<(PrinterParams const &, PrinterParams const &);
 
-       /** Test that all the fields contain valid entries.  It's unlikely
-           that the internal code will get this wrong (at least for the
-           xforms code anyway) however new ports and external scripts
-           might drive the wrong values in.
-        */
-       void testInvariant() const
-               {
-#ifdef ENABLE_ASSERTIONS
-                       extern bool containsOnly(string const &, char const *);
-                       if (!from_page.empty()) {
-                               // Assert(from_page == number or empty)
-                               Assert(containsOnly(from_page, "1234567890"));
-                       }
-                       if (to_page) {
-                               // Assert(to_page == empty
-                               //        or number iff from_page set)
-                               Assert(!from_page.empty());
-                       }
-                       switch (target) {
-                       case PRINTER:
-//                             Assert(!printer_name.empty());
-                               break;
-                       case FILE:
-                               Assert(!file_name.empty());
-                               break;
-                       default:
-                               Assert(false);
-                               break;
-                       }
-                       switch (which_pages) {
-                       case ALL:
-                       case ODD:
-                       case EVEN:
-                               break;
-                       default:
-                               Assert(false);
-                               break;
-                       }
-#endif
-               }
 };
 
 #endif
-
-
-