From 79f869a7f32910197be72b21f6489fbbba02c836 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Mon, 23 Jan 2017 17:37:21 +0100 Subject: [PATCH] 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). --- simgear/debug/logstream.cxx | 2 +- simgear/ephemeris/stardata.cxx | 2 +- simgear/io/CMakeLists.txt | 2 +- simgear/io/HTTPFileRequest.hxx | 2 +- simgear/io/HTTPRepository.cxx | 2 +- simgear/io/iostreams/CMakeLists.txt | 23 +++++++++++++++++++ .../iostreams}/gzcontainerfile.cxx | 0 .../iostreams}/gzcontainerfile.hxx | 2 +- .../iostreams/gzfstream.cxx} | 2 +- .../iostreams/gzfstream.hxx} | 8 +++---- simgear/{misc => io/iostreams}/sgstream.cxx | 0 simgear/{misc => io/iostreams}/sgstream.hxx | 2 +- .../{misc => io/iostreams}/sgstream_test.cxx | 2 +- simgear/io/test_repository.cxx | 2 +- simgear/math/interpolater.cxx | 2 +- simgear/misc/CMakeLists.txt | 10 -------- simgear/misc/path_test.cxx | 2 +- simgear/misc/sg_path.cxx | 2 +- simgear/package/Catalog.cxx | 2 +- simgear/package/Install.cxx | 2 +- simgear/props/props_io.cxx | 2 +- simgear/scene/material/mat.cxx | 2 +- simgear/scene/material/matlib.cxx | 4 ++-- simgear/scene/material/matmodel.cxx | 2 +- simgear/scene/tgdb/ReaderWriterSTG.cxx | 4 ++-- simgear/scene/tsync/terrasync.cxx | 2 +- simgear/xml/easyxml.cxx | 2 +- 27 files changed, 51 insertions(+), 38 deletions(-) create mode 100644 simgear/io/iostreams/CMakeLists.txt rename simgear/{misc => io/iostreams}/gzcontainerfile.cxx (100%) rename simgear/{misc => io/iostreams}/gzcontainerfile.hxx (97%) rename simgear/{misc/zfstream.cxx => io/iostreams/gzfstream.cxx} (99%) rename simgear/{misc/zfstream.hxx => io/iostreams/gzfstream.hxx} (97%) rename simgear/{misc => io/iostreams}/sgstream.cxx (100%) rename simgear/{misc => io/iostreams}/sgstream.hxx (99%) rename simgear/{misc => io/iostreams}/sgstream_test.cxx (96%) diff --git a/simgear/debug/logstream.cxx b/simgear/debug/logstream.cxx index 86711fff..e8766c6d 100644 --- a/simgear/debug/logstream.cxx +++ b/simgear/debug/logstream.cxx @@ -36,7 +36,7 @@ #include #include -#include +#include #include #if defined (SG_WINDOWS) diff --git a/simgear/ephemeris/stardata.cxx b/simgear/ephemeris/stardata.cxx index e6b9b754..cd3f8113 100644 --- a/simgear/ephemeris/stardata.cxx +++ b/simgear/ephemeris/stardata.cxx @@ -26,7 +26,7 @@ #include #include -#include +#include #include "stardata.hxx" diff --git a/simgear/io/CMakeLists.txt b/simgear/io/CMakeLists.txt index fa0d3fc6..c658935a 100644 --- a/simgear/io/CMakeLists.txt +++ b/simgear/io/CMakeLists.txt @@ -1,4 +1,4 @@ - +add_subdirectory(iostreams) include (SimGearComponent) diff --git a/simgear/io/HTTPFileRequest.hxx b/simgear/io/HTTPFileRequest.hxx index 32b64811..b725c9ba 100644 --- a/simgear/io/HTTPFileRequest.hxx +++ b/simgear/io/HTTPFileRequest.hxx @@ -23,7 +23,7 @@ #include "HTTPRequest.hxx" -#include +#include namespace simgear { diff --git a/simgear/io/HTTPRepository.cxx b/simgear/io/HTTPRepository.cxx index 6e75b104..30e4de5e 100644 --- a/simgear/io/HTTPRepository.cxx +++ b/simgear/io/HTTPRepository.cxx @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include diff --git a/simgear/io/iostreams/CMakeLists.txt b/simgear/io/iostreams/CMakeLists.txt new file mode 100644 index 00000000..6c87ae22 --- /dev/null +++ b/simgear/io/iostreams/CMakeLists.txt @@ -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) diff --git a/simgear/misc/gzcontainerfile.cxx b/simgear/io/iostreams/gzcontainerfile.cxx similarity index 100% rename from simgear/misc/gzcontainerfile.cxx rename to simgear/io/iostreams/gzcontainerfile.cxx diff --git a/simgear/misc/gzcontainerfile.hxx b/simgear/io/iostreams/gzcontainerfile.hxx similarity index 97% rename from simgear/misc/gzcontainerfile.hxx rename to simgear/io/iostreams/gzcontainerfile.hxx index bb30f69c..79c5563a 100644 --- a/simgear/misc/gzcontainerfile.hxx +++ b/simgear/io/iostreams/gzcontainerfile.hxx @@ -22,7 +22,7 @@ #define GZ_CONTAINER_FILE_HXX #include -#include +#include class SGPropertyNode; diff --git a/simgear/misc/zfstream.cxx b/simgear/io/iostreams/gzfstream.cxx similarity index 99% rename from simgear/misc/zfstream.cxx rename to simgear/io/iostreams/gzfstream.cxx index d0514f45..582f389c 100644 --- a/simgear/misc/zfstream.cxx +++ b/simgear/io/iostreams/gzfstream.cxx @@ -34,7 +34,7 @@ #include #include -#include "zfstream.hxx" +#include "gzfstream.hxx" // // Construct a gzfilebuf object. diff --git a/simgear/misc/zfstream.hxx b/simgear/io/iostreams/gzfstream.hxx similarity index 97% rename from simgear/misc/zfstream.hxx rename to simgear/io/iostreams/gzfstream.hxx index 996860ff..368c2c64 100644 --- a/simgear/misc/zfstream.hxx +++ b/simgear/io/iostreams/gzfstream.hxx @@ -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 @@ -164,4 +164,4 @@ struct gzofstream_base gzfilebuf gzbuf; }; -#endif // _zfstream_hxx +#endif // _gzfstream_hxx diff --git a/simgear/misc/sgstream.cxx b/simgear/io/iostreams/sgstream.cxx similarity index 100% rename from simgear/misc/sgstream.cxx rename to simgear/io/iostreams/sgstream.cxx diff --git a/simgear/misc/sgstream.hxx b/simgear/io/iostreams/sgstream.hxx similarity index 99% rename from simgear/misc/sgstream.hxx rename to simgear/io/iostreams/sgstream.hxx index 66fc8cbd..948d14ee 100644 --- a/simgear/misc/sgstream.hxx +++ b/simgear/io/iostreams/sgstream.hxx @@ -40,7 +40,7 @@ #include #include -#include +#include class SGPath; diff --git a/simgear/misc/sgstream_test.cxx b/simgear/io/iostreams/sgstream_test.cxx similarity index 96% rename from simgear/misc/sgstream_test.cxx rename to simgear/io/iostreams/sgstream_test.cxx index 43561e5c..b210b713 100644 --- a/simgear/misc/sgstream_test.cxx +++ b/simgear/io/iostreams/sgstream_test.cxx @@ -6,7 +6,7 @@ using std::cout; using std::endl; #include -#include +#include #include #include diff --git a/simgear/io/test_repository.cxx b/simgear/io/test_repository.cxx index 6afb0edf..07ba9728 100644 --- a/simgear/io/test_repository.cxx +++ b/simgear/io/test_repository.cxx @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include diff --git a/simgear/math/interpolater.cxx b/simgear/math/interpolater.cxx index cbbb31cf..01d6f0b6 100644 --- a/simgear/math/interpolater.cxx +++ b/simgear/math/interpolater.cxx @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include diff --git a/simgear/misc/CMakeLists.txt b/simgear/misc/CMakeLists.txt index 4a4ef3d3..62303764 100644 --- a/simgear/misc/CMakeLists.txt +++ b/simgear/misc/CMakeLists.txt @@ -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) diff --git a/simgear/misc/path_test.cxx b/simgear/misc/path_test.cxx index cb05b22c..b587bfe2 100644 --- a/simgear/misc/path_test.cxx +++ b/simgear/misc/path_test.cxx @@ -12,7 +12,7 @@ using std::endl; #include #include #include -#include +#include #include #if defined(SG_WINDOWS) diff --git a/simgear/misc/sg_path.cxx b/simgear/misc/sg_path.cxx index 5c84f8b4..6ab6ad65 100644 --- a/simgear/misc/sg_path.cxx +++ b/simgear/misc/sg_path.cxx @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/simgear/package/Catalog.cxx b/simgear/package/Catalog.cxx index 4e7fd094..4ebedab4 100644 --- a/simgear/package/Catalog.cxx +++ b/simgear/package/Catalog.cxx @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/simgear/package/Install.cxx b/simgear/package/Install.cxx index 482f9451..4ba1dcbc 100644 --- a/simgear/package/Install.cxx +++ b/simgear/package/Install.cxx @@ -33,7 +33,7 @@ #include #include #include -#include +#include extern "C" { void fill_memory_filefunc (zlib_filefunc_def*); diff --git a/simgear/props/props_io.cxx b/simgear/props/props_io.cxx index f98dbfff..12e2b9e8 100644 --- a/simgear/props/props_io.cxx +++ b/simgear/props/props_io.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include "props.hxx" #include "props_io.hxx" diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx index 178b8227..916d4cbd 100644 --- a/simgear/scene/material/mat.cxx +++ b/simgear/scene/material/mat.cxx @@ -49,7 +49,7 @@ #include #include -#include +#include #include #include diff --git a/simgear/scene/material/matlib.cxx b/simgear/scene/material/matlib.cxx index 7eb917ab..6d4ad5ab 100644 --- a/simgear/scene/material/matlib.cxx +++ b/simgear/scene/material/matlib.cxx @@ -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 #include -#include +#include #include #include #include diff --git a/simgear/scene/material/matmodel.cxx b/simgear/scene/material/matmodel.cxx index 84dd9237..5cbcd242 100644 --- a/simgear/scene/material/matmodel.cxx +++ b/simgear/scene/material/matmodel.cxx @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include "matmodel.hxx" diff --git a/simgear/scene/tgdb/ReaderWriterSTG.cxx b/simgear/scene/tgdb/ReaderWriterSTG.cxx index 8f5844c7..c6268026 100644 --- a/simgear/scene/tgdb/ReaderWriterSTG.cxx +++ b/simgear/scene/tgdb/ReaderWriterSTG.cxx @@ -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 #include #include -#include +#include #include #include #include diff --git a/simgear/scene/tsync/terrasync.cxx b/simgear/scene/tsync/terrasync.cxx index 2d071b06..2adee317 100644 --- a/simgear/scene/tsync/terrasync.cxx +++ b/simgear/scene/tsync/terrasync.cxx @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/simgear/xml/easyxml.cxx b/simgear/xml/easyxml.cxx index a5b9c89c..4bcdf454 100644 --- a/simgear/xml/easyxml.cxx +++ b/simgear/xml/easyxml.cxx @@ -23,7 +23,7 @@ #include #include -#include +#include #include using std::ifstream;