2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-12 15:12:22 +00:00
qpdf/include/qpdf/BufferInputSource.hh
Jay Berkenbilt 296b679d6e Implement findFirst and findLast in InputSource
Preparing to refactor some pattern searching code to use these instead
of their own memchr loops. This should simplify the code that replaces
PCRE.
2017-08-10 21:30:32 -04:00

49 lines
1.3 KiB
C++

/* Copyright (c) 2005-2015 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 __QPDF_BUFFERINPUTSOURCE_HH__
#define __QPDF_BUFFERINPUTSOURCE_HH__
#include <qpdf/InputSource.hh>
#include <qpdf/Buffer.hh>
class BufferInputSource: public InputSource
{
public:
QPDF_DLL
BufferInputSource(std::string const& description, Buffer* buf,
bool own_memory = false);
QPDF_DLL
BufferInputSource(std::string const& description,
std::string const& contents);
QPDF_DLL
virtual ~BufferInputSource();
QPDF_DLL
virtual qpdf_offset_t findAndSkipNextEOL();
QPDF_DLL
virtual std::string const& getName() const;
QPDF_DLL
virtual qpdf_offset_t tell();
QPDF_DLL
virtual void seek(qpdf_offset_t offset, int whence);
QPDF_DLL
virtual void rewind();
QPDF_DLL
virtual size_t read(char* buffer, size_t length);
QPDF_DLL
virtual void unreadCh(char ch);
private:
bool own_memory;
std::string description;
Buffer* buf;
qpdf_offset_t cur_offset;
};
#endif // __QPDF_BUFFERINPUTSOURCE_HH__