RVNGStreamImplementation.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* librevenge
00003  * Version: MPL 2.0 / LGPLv2.1+
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Major Contributor(s):
00010  * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
00011  *
00012  * For minor contributions see the git repository.
00013  *
00014  * Alternatively, the contents of this file may be used under the terms
00015  * of the GNU Lesser General Public License Version 2.1 or later
00016  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00017  * applicable instead of those above.
00018  */
00019 
00020 #ifndef RVNGSTREAMIMPLEMENTATION_H
00021 #define RVNGSTREAMIMPLEMENTATION_H
00022 
00023 #include "librevenge-stream-api.h"
00024 
00025 #include "RVNGStream.h"
00026 
00027 namespace librevenge
00028 {
00029 
00030 class RVNGFileStreamPrivate;
00031 
00032 class REVENGE_STREAM_API RVNGFileStream: public RVNGInputStream
00033 {
00034 public:
00035         explicit RVNGFileStream(const char *filename);
00036         ~RVNGFileStream();
00037 
00038         const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
00039         long tell();
00040         int seek(long offset, RVNG_SEEK_TYPE seekType);
00041         bool isEnd();
00042 
00043         bool isStructured();
00044         unsigned subStreamCount();
00045         const char *subStreamName(unsigned id);
00046         bool existsSubStream(const char *name);
00047         RVNGInputStream *getSubStreamById(unsigned id);
00048         RVNGInputStream *getSubStreamByName(const char *name);
00049 
00050 private:
00051         RVNGFileStreamPrivate *d;
00052         RVNGFileStream(const RVNGFileStream &); // copy is not allowed
00053         RVNGFileStream &operator=(const RVNGFileStream &); // assignment is not allowed
00054 };
00055 
00056 class RVNGStringStreamPrivate;
00057 
00058 class REVENGE_STREAM_API RVNGStringStream: public RVNGInputStream
00059 {
00060 public:
00061         RVNGStringStream(const unsigned char *data, const unsigned int dataSize);
00062         ~RVNGStringStream();
00063 
00064         const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
00065         long tell();
00066         int seek(long offset, RVNG_SEEK_TYPE seekType);
00067         bool isEnd();
00068 
00069         bool isStructured();
00070         unsigned subStreamCount();
00071         const char *subStreamName(unsigned);
00072         bool existsSubStream(const char *name);
00073         RVNGInputStream *getSubStreamByName(const char *name);
00074         RVNGInputStream *getSubStreamById(unsigned);
00075 
00076 private:
00077         RVNGStringStreamPrivate *d;
00078         RVNGStringStream(const RVNGStringStream &); // copy is not allowed
00079         RVNGStringStream &operator=(const RVNGStringStream &); // assignment is not allowed
00080 };
00081 
00082 }
00083 
00084 #endif // RVNGSTREAMIMPLEMENTATION_H
00085 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */