Gnash  0.8.10
StreamProvider.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
00003 //   Free Software Foundation, Inc
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #ifndef GNASH_STREAMPROVIDER_H
00020 #define GNASH_STREAMPROVIDER_H
00021 
00022 #include "NetworkAdapter.h"
00023 #include "dsodefs.h" // for DSOEXPORT
00024 #include "NamingPolicy.h"
00025 
00026 #include <string>
00027 #include <memory>
00028 
00029 // Forward declarations
00030 namespace gnash {
00031         class URL;
00032         class IOChannel;
00033 }
00034 
00035 
00036 namespace gnash {
00037 
00039 //
00047 //
00049 class DSOEXPORT StreamProvider
00050 {
00051 public:
00052 
00054     //
00059         StreamProvider(const URL& original, const URL& base,
00060             std::auto_ptr<NamingPolicy> np =
00061             std::auto_ptr<NamingPolicy>(new NamingPolicy));
00062 
00063         virtual ~StreamProvider() {}
00064 
00066         //
00069         virtual std::auto_ptr<IOChannel> getStream(const URL& url,
00070             bool namedCacheFile = false) const;
00071 
00073         //
00081         virtual std::auto_ptr<IOChannel> getStream(const URL& url,
00082             const std::string& postdata, bool namedCacheFile = false) const;
00083         
00084         virtual std::auto_ptr<IOChannel> getStream(const URL& url,
00085             const std::string& postdata,
00086             const NetworkAdapter::RequestHeaders& headers,
00087             bool namedCacheFile = false) const;
00088         
00090     //
00093     void setNamingPolicy(std::auto_ptr<NamingPolicy> np) {
00094         _namingPolicy = np;
00095     }
00096 
00098     const NamingPolicy& namingPolicy() const {
00099         assert(_namingPolicy.get());
00100         return *_namingPolicy;
00101     }
00102 
00104     //
00108     //
00111     bool allow(const URL& url) const;
00112 
00114     //
00117     const URL& baseURL() const {
00118         return _base;
00119     }
00120 
00121 private:
00122 
00124     std::auto_ptr<NamingPolicy> _namingPolicy;
00125 
00126     const URL _base;
00127 
00128     const URL _original;
00129 
00130 };
00131 
00132 } // namespace gnash
00133 
00134 #endif 
00135 
00136 
00137 // Local Variables:
00138 // mode: C++
00139 // indent-tabs-mode: t
00140 // End: