- Rename zfstream.cxx (resp. zfstream.hxx) to gzfstream.cxx (resp.
gzfstream.hxx)
This is because these files only deal with the gzip format (RFC 1952),
while zlib can actually read and write two slightly different formats:
this one and the "ZLIB Compressed Data Format" (RFC 1950). Since I am
going to add std::streambuf and std::istream subclasses able to deal
with both formats (and supporting data sources that are general
std::istream instances, not just files), this renaming will make
things a bit clearer, I hope.
- Add new folder simgear/io/iostreams and move the following files to
this folder:
simgear/misc/gzcontainerfile.cxx
simgear/misc/gzcontainerfile.hxx
simgear/misc/gzfstream.cxx
simgear/misc/gzfstream.hxx
simgear/misc/sgstream.cxx
simgear/misc/sgstream.hxx
simgear/misc/sgstream_test.cxx
- Adapt other files accordingly (mainly #includes and CMakeLists.txt
files).
63 lines
1.6 KiB
C++
63 lines
1.6 KiB
C++
///@file
|
|
//
|
|
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
|
|
//
|
|
// This library is free software; you can redistribute it and/or
|
|
// modify it under the terms of the GNU Library General Public
|
|
// License as published by the Free Software Foundation; either
|
|
// version 2 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
|
|
// Library General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Library General Public
|
|
// License along with this library; if not, write to the Free Software
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
#ifndef SG_HTTP_FILEREQUEST_HXX_
|
|
#define SG_HTTP_FILEREQUEST_HXX_
|
|
|
|
#include <simgear/misc/sg_path.hxx>
|
|
|
|
#include "HTTPRequest.hxx"
|
|
|
|
#include <simgear/io/iostreams/sgstream.hxx>
|
|
|
|
namespace simgear
|
|
{
|
|
namespace HTTP
|
|
{
|
|
|
|
/**
|
|
* HTTP request writing response to a file.
|
|
*/
|
|
class FileRequest:
|
|
public Request
|
|
{
|
|
public:
|
|
|
|
/**
|
|
*
|
|
* @param url Adress to download from
|
|
* @param path Path to file for saving response
|
|
*/
|
|
FileRequest(const std::string& url, const std::string& path);
|
|
|
|
protected:
|
|
SGPath _filename;
|
|
sg_ofstream _file;
|
|
|
|
virtual void responseHeadersComplete();
|
|
virtual void gotBodyData(const char* s, int n);
|
|
virtual void onAlways();
|
|
};
|
|
|
|
typedef SGSharedPtr<FileRequest> FileRequestRef;
|
|
|
|
} // namespace HTTP
|
|
} // namespace simgear
|
|
|
|
#endif /* SG_HTTP_FILEREQUEST_HXX_ */
|