MWAWOLEStream.hxx
Go to the documentation of this file.
00001 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
00002 /* POLE - Portable C++ library to access OLE Storage
00003    Copyright (C) 2002-2005 Ariya Hidayat <ariya@kde.org>
00004 
00005    Redistribution and use in source and binary forms, with or without
00006    modification, are permitted provided that the following conditions
00007    are met:
00008    * Redistributions of source code must retain the above copyright notice,
00009      this list of conditions and the following disclaimer.
00010    * Redistributions in binary form must reproduce the above copyright notice,
00011      this list of conditions and the following disclaimer in the documentation
00012      and/or other materials provided with the distribution.
00013    * Neither the name of the authors nor the names of its contributors may be
00014      used to endorse or promote products derived from this software without
00015      specific prior written permission.
00016 
00017    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
00027    THE POSSIBILITY OF SUCH DAMAGE.
00028 */
00029 
00030 #ifndef MWAWOLESTREAM_HXX
00031 #define MWAWOLESTREAM_HXX
00032 
00033 #include <string>
00034 #include <fstream>
00035 #include <vector>
00036 
00037 #include "libmwaw_internal.hxx"
00038 
00039 class WPXInputStream;
00040 
00042 namespace libmwawOLE
00043 {
00044 class IStorage;
00045 class IStream;
00046 
00048 class Storage
00049 {
00050   friend class Stream;
00051 
00052 public:
00053 
00054   // for Storage::result()
00055   enum Result { Ok, OpenFailed, NotOLE, BadOLE, UnknownError };
00056 
00060   Storage( shared_ptr<WPXInputStream> is );
00061 
00065   ~Storage();
00066 
00070   bool isStructuredDocument();
00071 
00075   std::vector<std::string> getSubStreamList(std::string dir="/", bool onlyFiles=true);
00076 
00080   bool isSubStream(const std::string &name);
00081 
00085   bool isDirectory(const std::string &name);
00086 
00090   shared_ptr<WPXInputStream> getSubStream(const std::string &name);
00091 
00092 private:
00096   shared_ptr<WPXInputStream> getSubStreamForDirectory(const std::string &name);
00097 
00099   libmwawOLE::IStorage *m_io;
00100 
00101   // no copy or assign
00102   Storage( const Storage & );
00103   Storage &operator=( const Storage & );
00104 
00105 };
00106 
00107 }  // namespace libmwawOLE
00108 
00109 #endif // WPXOLESTREAM_H
00110 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: