2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-01 09:50:54 +00:00
qpdf/include/qpdf/QUtil.hh
Jay Berkenbilt a9987ab570 Fix a few compiler errors reported correctly my MSVC 9.0.
Fix libtests test suites to pass on Windows, mostly by dealing with
ascii vs. binary and NL vs. CRNL change ($td->NORMALIZE_NEWLINES).
Convert some test suites to use fread instead of read.
PCRE.hh: define PCRE_STATIC if on Windows.
Provide cross-platform function for getting current time instead of
using time(0).


git-svn-id: svn+q:///qpdf/trunk@678 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-07-12 22:52:13 +00:00

48 lines
1.4 KiB
C++

// 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 __QUTIL_HH__
#define __QUTIL_HH__
#include <string>
#include <list>
#include <stdio.h>
#include <sys/stat.h>
#include <qpdf/QEXC.hh>
namespace QUtil
{
// This is a collection of useful utility functions that don't
// really go anywhere else.
std::string int_to_string(int, int length = 0);
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.
int os_wrapper(std::string const& description, int status)
throw (QEXC::System);
FILE* fopen_wrapper(std::string const&, FILE*)
throw (QEXC::System);
char* copy_string(std::string const&);
// Get the value of an environment variable in a portable fashion.
// Returns true iff the variable is defined. If `value' is
// non-null, initializes it with the value of the variable.
bool get_env(std::string const& var, std::string* value = 0);
time_t get_current_time();
// Return a string containing the byte representation of the UTF-8
// encoding for the unicode value passed in.
std::string toUTF8(unsigned long uval);
};
#endif // __QUTIL_HH__