/usr/include/ebml/MemIOCallback.h is in libebml-dev 1.2.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | /****************************************************************************
** libebml : parse EBML files, see http://embl.sourceforge.net/
**
** <file/class description>
**
** Copyright (C) 2003-2004 Jory Stone. All rights reserved.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
**
** Contact license@matroska.org if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
/*!
\file
\version \$Id: MemIOCallback.h 1298 2008-02-21 22:14:18Z mosu $
\author Jory Stone <jcsston @ toughguy.net>
*/
#ifndef LIBEBML_MEMIOCALLBACK_H
#define LIBEBML_MEMIOCALLBACK_H
#include "IOCallback.h"
#include <string>
#ifndef __BEOS__
#include <sstream>
#else
#include <strstream>
#define stringstream strstream
#endif
START_LIBEBML_NAMESPACE
class EBML_DLL_API MemIOCallback : public IOCallback
{
public:
MemIOCallback(uint64 DefaultSize = 128);
~MemIOCallback();
/*!
Use this to copy some data to the Buffer from this classes data
*/
uint32 read(void *Buffer, size_t Size);
/*!
Seek to the specified position. The mode can have either SEEK_SET, SEEK_CUR
or SEEK_END. The callback should return true(1) if the seek operation succeeded
or false (0), when the seek fails.
*/
void setFilePointer(int64 Offset, seek_mode Mode=seek_beginning);
/*!
This callback just works like its read pendant. It returns the number of bytes written.
*/
size_t write(const void *Buffer, size_t Size);
/*!
Although the position is always positive, the return value of this callback is signed to
easily allow negative values for returning errors. When an error occurs, the implementor
should return -1 and the file pointer otherwise.
If an error occurs, an exception should be thrown.
*/
virtual uint64 getFilePointer() {return dataBufferPos;};
/*!
The close callback flushes the file buffers to disk and closes the file. When using the stdio
library, this is equivalent to calling fclose. When the close is not successful, an exception
should be thrown.
*/
void close() {};
binary *GetDataBuffer() const {return dataBuffer;};
uint64 GetDataBufferSize() {return dataBufferTotalSize;};
void SetDataBufferSize(uint64 newDataBufferSize) {dataBufferTotalSize = newDataBufferSize;};
/*!
Use this to write some data from another IOCallback
*/
uint32 write(IOCallback & IOToRead, size_t Size);
bool IsOk() { return mOk; };
const std::string &GetLastErrorStr() { return mLastErrorStr; };
protected:
bool mOk;
std::string mLastErrorStr;
binary *dataBuffer;
/*!
Postion where we start 'writing' to the dataBuffer
*/
uint64 dataBufferPos;
/*!
Size of the data in the dataBuffer
*/
uint64 dataBufferTotalSize;
/*!
Size of the memory malloc()/realloc()
*/
uint64 dataBufferMemorySize;
};
END_LIBEBML_NAMESPACE
#endif // LIBEBML_MEMIOCALLBACK_H
|