Move IOStreams-related files to simgear/io/iostreams; rename zfstream.[ch]xx to gzfstream.[ch]xx

- 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).
This commit is contained in:
Florent Rougon
2017-01-23 17:37:21 +01:00
parent 1b8dfb2bef
commit 79f869a7f3
27 changed files with 51 additions and 38 deletions

View File

@@ -36,7 +36,7 @@
#include <simgear/threads/SGQueue.hxx>
#include <simgear/threads/SGGuard.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/sg_path.hxx>
#if defined (SG_WINDOWS)

View File

@@ -26,7 +26,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include "stardata.hxx"

View File

@@ -1,4 +1,4 @@
add_subdirectory(iostreams)
include (SimGearComponent)

View File

@@ -23,7 +23,7 @@
#include "HTTPRequest.hxx"
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
namespace simgear
{

View File

@@ -37,7 +37,7 @@
#include <simgear/misc/sg_dir.hxx>
#include <simgear/io/HTTPClient.hxx>
#include <simgear/io/sg_file.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/structure/exception.hxx>
#include <simgear/timing/timestamp.hxx>

View File

@@ -0,0 +1,23 @@
include (SimGearComponent)
set(HEADERS
sgstream.hxx
gzfstream.hxx
gzcontainerfile.hxx
)
set(SOURCES
sgstream.cxx
gzfstream.cxx
gzcontainerfile.cxx
)
simgear_component(IOStreams io/iostreams "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS)
add_executable(test_streams sgstream_test.cxx )
target_link_libraries(test_streams ${TEST_LIBS})
add_test(streams ${EXECUTABLE_OUTPUT_PATH}/test_streams)
endif(ENABLE_TESTS)

View File

@@ -22,7 +22,7 @@
#define GZ_CONTAINER_FILE_HXX
#include <string>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
class SGPropertyNode;

View File

@@ -34,7 +34,7 @@
#include <simgear/structure/exception.hxx>
#include <zlib.h>
#include "zfstream.hxx"
#include "gzfstream.hxx"
//
// Construct a gzfilebuf object.

View File

@@ -1,5 +1,5 @@
/**
* \file zfstream.hxx
* \file gzfstream.hxx
* A C++ I/O streams interface to the zlib gz* functions.
*/
@@ -24,8 +24,8 @@
//
// $Id$
#ifndef _zfstream_hxx
#define _zfstream_hxx
#ifndef _gzfstream_hxx
#define _gzfstream_hxx
#include <simgear/compiler.h>
@@ -164,4 +164,4 @@ struct gzofstream_base
gzfilebuf gzbuf;
};
#endif // _zfstream_hxx
#endif // _gzfstream_hxx

View File

@@ -40,7 +40,7 @@
#include <string>
#include <zlib.h>
#include <simgear/misc/zfstream.hxx>
#include <simgear/io/iostreams/gzfstream.hxx>
class SGPath;

View File

@@ -6,7 +6,7 @@ using std::cout;
using std::endl;
#include <simgear/misc/test_macros.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sg_dir.hxx>

View File

@@ -18,7 +18,7 @@
#include <simgear/timing/timestamp.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_dir.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/structure/exception.hxx>
#include <simgear/structure/callback.hxx>

View File

@@ -31,7 +31,7 @@
#include <string>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/props/props.hxx>

View File

@@ -12,14 +12,11 @@ set(HEADERS
sg_dir.hxx
sg_hash.hxx
sg_path.hxx
sgstream.hxx
stdint.hxx
stopwatch.hxx
strutils.hxx
tabbed_values.hxx
texcoord.hxx
zfstream.hxx
gzcontainerfile.hxx
)
set(SOURCES
@@ -31,12 +28,9 @@ set(SOURCES
sg_dir.cxx
sg_path.cxx
sg_hash.cxx
sgstream.cxx
strutils.cxx
tabbed_values.cxx
texcoord.cxx
zfstream.cxx
gzcontainerfile.cxx
)
if (WINDOWS)
@@ -59,10 +53,6 @@ add_executable(test_tabbed_values tabbed_values_test.cxx)
add_test(tabbed_values ${EXECUTABLE_OUTPUT_PATH}/test_tabbed_values)
target_link_libraries(test_tabbed_values ${TEST_LIBS})
add_executable(test_streams sgstream_test.cxx )
add_test(streams ${EXECUTABLE_OUTPUT_PATH}/test_streams)
target_link_libraries(test_streams ${TEST_LIBS})
add_executable(test_strutils strutils_test.cxx)
target_link_libraries(test_strutils ${TEST_LIBS})
add_test(strutils ${EXECUTABLE_OUTPUT_PATH}/test_strutils)

View File

@@ -12,7 +12,7 @@ using std::endl;
#include <simgear/misc/test_macros.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sg_dir.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/debug/logstream.hxx>
#if defined(SG_WINDOWS)

View File

@@ -27,7 +27,7 @@
#include <simgear_config.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/strutils.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <stdio.h>
#include <sys/stat.h>

View File

@@ -27,7 +27,7 @@
#include <simgear/io/HTTPRequest.hxx>
#include <simgear/io/HTTPClient.hxx>
#include <simgear/misc/sg_dir.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/structure/exception.hxx>
#include <simgear/package/Package.hxx>
#include <simgear/package/Root.hxx>

View File

@@ -33,7 +33,7 @@
#include <simgear/io/HTTPClient.hxx>
#include <simgear/misc/sg_dir.hxx>
#include <simgear/misc/strutils.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
extern "C" {
void fill_memory_filefunc (zlib_filefunc_def*);

View File

@@ -21,7 +21,7 @@
#include <simgear/misc/sg_path.hxx>
#include <simgear/xml/easyxml.hxx>
#include <simgear/misc/ResourceManager.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include "props.hxx"
#include "props_io.hxx"

View File

@@ -49,7 +49,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/threads/SGGuard.hxx>
#include <simgear/scene/util/SGReaderWriterOptions.hxx>

View File

@@ -1,4 +1,4 @@
// materialmgr.cxx -- class to handle material properties
// matlib.cxx -- class to handle material properties
//
// Written by Curtis Olson, started May 1998.
//
@@ -36,7 +36,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/props/props.hxx>
#include <simgear/props/props_io.hxx>
#include <simgear/props/condition.hxx>

View File

@@ -39,7 +39,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_random.h>
#include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/scene/model/modellib.hxx>
#include "matmodel.hxx"

View File

@@ -1,4 +1,4 @@
// tileentry.cxx -- routines to handle a scenery tile
// ReaderWriterSTG.cxx -- routines to handle a scenery tile
//
// Written by Curtis Olson, started May 1998.
//
@@ -42,7 +42,7 @@
#include <simgear/math/SGGeometry.hxx>
#include <simgear/bucket/newbucket.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/scene/util/OptionsReadFileCallback.hxx>
#include <simgear/scene/util/OsgMath.hxx>
#include <simgear/scene/util/QuadTreeBuilder.hxx>

View File

@@ -54,7 +54,7 @@
#include <simgear/bucket/newbucket.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/misc/strutils.hxx>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/threads/SGQueue.hxx>
#include <simgear/threads/SGThread.hxx>
#include <simgear/threads/SGGuard.hxx>

View File

@@ -23,7 +23,7 @@
#include <fstream>
#include <iostream>
#include <simgear/misc/sgstream.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/sg_path.hxx>
using std::ifstream;