lyx_mirror/src/PrinterParams.cpp
Richard Heck 1b1f8dd235 Audit all the LASSERT calls, and try to do something sensible at
each failure.

There are several places I was not sure what to do. These are marked
by comments beginning "LASSERT:" so they can be found easily. At the
moment, they are at:

Author.cpp:105: // LASSERT: What should we do here?
Author.cpp:121: // LASSERT: What should we do here?
Buffer.cpp:4525:        // LASSERT: Is it safe to continue here, or should we just return?
Cursor.cpp:345:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:403:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:1143:                // LASSERT: There have been several bugs around this code, that seem
CursorSlice.cpp:83:     // LASSERT: This should only ever be called from an InsetMath.
CursorSlice.cpp:92:     // LASSERT: This should only ever be called from an InsetMath.
LayoutFile.cpp:303:                     // LASSERT: Why would this fail?
Text.cpp:995:           // LASSERT: Is it safe to continue here?
2013-04-25 17:27:10 -04:00

62 lines
1.0 KiB
C++

/**
* \file PrinterParams.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Allan Rae
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "PrinterParams.h"
#include "LyXRC.h"
#include "support/lassert.h"
#include "support/lstrings.h"
namespace lyx {
PrinterParams::PrinterParams()
{
target = PRINTER;
printer_name = lyxrc.printer;
file_name = std::string();
all_pages = true;
from_page = 1;
to_page = 0;
odd_pages = true;
even_pages = true;
count_copies = 1;
sorted_copies = false;
reverse_order = false;
testInvariant();
}
void PrinterParams::testInvariant() const
{
#ifdef ENABLE_ASSERTIONS
switch (target) {
case PRINTER:
// We can't do this test, because no default printer
// may have been set.
// LASSERT(!printer_name.empty(), /**/);
break;
case FILE:
LATTEST(!file_name.empty());
break;
default:
LATTEST(false);
break;
}
#endif
}
} // namespace lyx