summaryrefslogtreecommitdiffstats
path: root/include/qpdf/QUtil.hh
diff options
context:
space:
mode:
Diffstat (limited to 'include/qpdf/QUtil.hh')
-rw-r--r--include/qpdf/QUtil.hh26
1 files changed, 18 insertions, 8 deletions
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&);