aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-09-26 20:36:04 +0200
committerJay Berkenbilt <ejb@ql.org>2009-09-26 20:36:04 +0200
commitf3d7c26de1f575a14017a161ad1fdd2b93385e03 (patch)
tree065d6b0e12534a7371974bfb17e77c91d7b217d6 /include
parent64546cfa0ddc2cf4c91e0865e979947c6b20ca46 (diff)
downloadqpdf-f3d7c26de1f575a14017a161ad1fdd2b93385e03.tar.zst
removed qexc; non-compatible ABI change
git-svn-id: svn+q:///qpdf/trunk@709 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/Pipeline.hh18
-rw-r--r--include/qpdf/Pl_Flate.hh15
-rw-r--r--include/qpdf/Pl_StdioFile.hh15
-rw-r--r--include/qpdf/QEXC.hh135
-rw-r--r--include/qpdf/QPDFExc.hh5
-rw-r--r--include/qpdf/QUtil.hh26
6 files changed, 22 insertions, 192 deletions
diff --git a/include/qpdf/Pipeline.hh b/include/qpdf/Pipeline.hh
index 358bcb03..8bdbfcac 100644
--- a/include/qpdf/Pipeline.hh
+++ b/include/qpdf/Pipeline.hh
@@ -31,27 +31,11 @@
#define __PIPELINE_HH__
#include <qpdf/DLL.hh>
-
-#include <qpdf/QEXC.hh>
+#include <string>
class Pipeline
{
public:
- class Exception: public QEXC::General
- {
- public:
- DLL_EXPORT
- Exception(std::string const& message) :
- QEXC::General(message)
- {
- }
-
- DLL_EXPORT
- virtual ~Exception() throw()
- {
- }
- };
-
DLL_EXPORT
Pipeline(char const* identifier, Pipeline* next);
diff --git a/include/qpdf/Pl_Flate.hh b/include/qpdf/Pl_Flate.hh
index 60b3fd8a..286d80e8 100644
--- a/include/qpdf/Pl_Flate.hh
+++ b/include/qpdf/Pl_Flate.hh
@@ -15,21 +15,6 @@
class Pl_Flate: public Pipeline
{
public:
- class Exception: public Pipeline::Exception
- {
- public:
- DLL_EXPORT
- Exception(std::string const& message) :
- Pipeline::Exception(message)
- {
- }
-
- DLL_EXPORT
- virtual ~Exception() throw ()
- {
- }
- };
-
static int const def_bufsize = 65536;
enum action_e { a_inflate, a_deflate };
diff --git a/include/qpdf/Pl_StdioFile.hh b/include/qpdf/Pl_StdioFile.hh
index 84324d54..3bb9f257 100644
--- a/include/qpdf/Pl_StdioFile.hh
+++ b/include/qpdf/Pl_StdioFile.hh
@@ -21,21 +21,6 @@
class Pl_StdioFile: public Pipeline
{
public:
- class Exception: public Pipeline::Exception
- {
- public:
- DLL_EXPORT
- Exception(std::string const& message) :
- Pipeline::Exception(message)
- {
- }
-
- DLL_EXPORT
- virtual ~Exception() throw ()
- {
- }
- };
-
// f is externally maintained; this class just writes to and
// flushes it. It does not close it.
DLL_EXPORT
diff --git a/include/qpdf/QEXC.hh b/include/qpdf/QEXC.hh
deleted file mode 100644
index 49be72a8..00000000
--- a/include/qpdf/QEXC.hh
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (c) 2005-2009 Jay Berkenbilt
-//
-// This file is part of qpdf. This software may be distributed under
-// the terms of version 2 of the Artistic License which may be found
-// in the source distribution. It is provided "as is" without express
-// or implied warranty.
-
-#ifndef __QEXC_HH__
-#define __QEXC_HH__
-
-#include <qpdf/DLL.hh>
-
-#include <string>
-#include <exception>
-#include <errno.h>
-
-namespace QEXC
-{
- // This namespace contains all exception classes used by the
- // library.
-
- // The class hierarchy is as follows:
-
- // std::exception
- // |
- // +-> QEXC::Base
- // |
- // +-> QEXC::General
- // |
- // +-> QEXC::Internal
-
- // QEXC::General is the base class of all standard user-defined
- // exceptions and "expected" error conditions raised by QClass.
- // Applications or libraries using QClass are encouraged to derive
- // their own exceptions from these classes if they wish. It is
- // entirely reasonable for code to catch QEXC::General or specific
- // subclasses of it as part of normal error handling.
-
- // QEXC::Internal is reserved for internal errors. These should
- // be used only for situations that indicate a likely bug in the
- // software itself. This may include improper use of a library
- // function. Operator errors should not be able to cause Internal
- // errors. (There may be some exceptions to this such as users
- // invoking programs that were intended only to be invoked by
- // other programs.) QEXC::Internal should generally not be
- // trapped except in terminate handlers or top-level exception
- // handlers which will want to translate them into error messages
- // and cause the program to exit. Such top-level handlers may
- // want to catch std::exception instead.
-
- // All subclasses of QEXC::Base implement a const unparse() method
- // which returns a std::string const&. They also override
- // std::exception::what() to return a char* with the same value.
- // unparse() should be implemented in such a way that a program
- // catching QEXC::Base or std::exception can use the text returned
- // by unparse() (or what()) without any exception-specific
- // adornment. (The program may prefix the program name or other
- // general information.) Note that std::exception::what() is a
- // const method that returns a const char*. For this reason, it
- // is essential that unparse() return a const reference to a
- // string so that what() can be implemented by calling unparse().
- // This means that the string that unparse() returns a reference
- // to must not be allocated on the stack in the call to unparse().
- // The recommended way to do this is for derived exception classes
- // to store their string descriptions by calling the protected
- // setMessage() method and then to not override unparse().
-
- class Base: public std::exception
- {
- // This is the common base class for all exceptions in qclass.
- // Application/library code should not generally catch this
- // directly. See above for caveats.
- public:
- DLL_EXPORT
- Base();
- DLL_EXPORT
- Base(std::string const& message);
- DLL_EXPORT
- virtual ~Base() throw() {}
- DLL_EXPORT
- virtual std::string const& unparse() const;
- DLL_EXPORT
- virtual const char* what() const throw();
-
- protected:
- DLL_EXPORT
- void setMessage(std::string const& message);
-
- private:
- std::string message;
- };
-
- class General: public Base
- {
- // This is the base class for normal user/library-defined
- // error conditions.
- public:
- DLL_EXPORT
- General();
- DLL_EXPORT
- General(std::string const& message);
- DLL_EXPORT
- virtual ~General() throw() {};
- };
-
- // Note that Internal is not derived from General. Internal
- // errors are too severe. We don't want internal errors
- // accidentally trapped as part of QEXC::General. If you are
- // going to deal with internal errors, you have to do so
- // explicitly.
- class Internal: public Base
- {
- public:
- DLL_EXPORT
- Internal(std::string const& message);
- DLL_EXPORT
- virtual ~Internal() throw() {};
- };
-
- class System: public General
- {
- public:
- DLL_EXPORT
- System(std::string const& prefix, int sys_errno);
- DLL_EXPORT
- virtual ~System() throw() {};
- DLL_EXPORT
- int getErrno() const;
-
- private:
- int sys_errno;
- };
-};
-
-#endif // __QEXC_HH__
diff --git a/include/qpdf/QPDFExc.hh b/include/qpdf/QPDFExc.hh
index 81e62cfd..ebfa870b 100644
--- a/include/qpdf/QPDFExc.hh
+++ b/include/qpdf/QPDFExc.hh
@@ -8,9 +8,10 @@
#ifndef __QPDFEXC_HH__
#define __QPDFEXC_HH__
-#include <qpdf/QEXC.hh>
+#include <qpdf/DLL.hh>
+#include <stdexcept>
-class QPDFExc: public QEXC::General
+class QPDFExc: public std::runtime_error
{
public:
DLL_EXPORT
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh
index 1d2b2b1b..bfd59b61 100644
--- a/include/qpdf/QUtil.hh
+++ b/include/qpdf/QUtil.hh
@@ -8,13 +8,13 @@
#ifndef __QUTIL_HH__
#define __QUTIL_HH__
+#include <qpdf/DLL.hh>
#include <string>
#include <list>
+#include <stdexcept>
#include <stdio.h>
#include <sys/stat.h>
-#include <qpdf/QEXC.hh>
-
namespace QUtil
{
// This is a collection of useful utility functions that don't
@@ -24,15 +24,25 @@ namespace QUtil
DLL_EXPORT
std::string double_to_string(double, int decimal_places = 0);
- // If status is -1, convert the current value of errno to a
- // QEXC::System exception. Otherwise, return status.
+ // Throw std::runtime_error with a string formed by appending to
+ // "description: " the standard string corresponding to the
+ // current value of errno.
+ DLL_EXPORT
+ void throw_system_error(std::string const& description);
+
+ // The status argument is assumed to be the return value of a
+ // standard library call that sets errno when it fails. If status
+ // is -1, convert the current value of errno to a
+ // std::runtime_error that includes the standard error string.
+ // Otherwise, return status.
DLL_EXPORT
- int os_wrapper(std::string const& description, int status)
- throw (QEXC::System);
+ int os_wrapper(std::string const& description, int status);
+ // The FILE* argument is assumed to be the return of fopen. If
+ // null, throw std::runtime_error. Otherwise, return the FILE*
+ // argument.
DLL_EXPORT
- FILE* fopen_wrapper(std::string const&, FILE*)
- throw (QEXC::System);
+ FILE* fopen_wrapper(std::string const&, FILE*);
DLL_EXPORT
char* copy_string(std::string const&);