From 9c50a60c2b45ff1f3073419ce6581cc335dbfb39 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 26 Aug 2019 07:06:18 -0400 Subject: [PATCH] General: Include headers that are necessary Removes unused headers and ensures that all necessary headers are included. In particular, this removes quite a few includes, which removes quite a few static constructors. --- include/LZ77/LZType10.hpp | 2 +- include/LZ77/LZType11.hpp | 2 +- include/athena/Checksums.hpp | 2 +- include/athena/Compression.hpp | 2 +- include/athena/DNA.hpp | 14 +++++++++----- include/athena/DNAOp.hpp | 15 ++++++++++----- include/athena/DNAYaml.hpp | 13 ++++++++----- include/athena/Dir.hpp | 8 ++------ include/athena/FileInfo.hpp | 2 +- include/athena/FileReader.hpp | 4 +++- include/athena/FileWriter.hpp | 2 ++ include/athena/IStream.hpp | 2 +- include/athena/IStreamReader.hpp | 10 ++++++---- include/athena/IStreamWriter.hpp | 11 +++++++---- include/athena/MemoryWriter.hpp | 4 ++-- include/athena/Socket.hpp | 9 +++------ include/athena/Utility.hpp | 4 ++-- include/athena/VectorWriter.hpp | 6 +++--- include/athena/YAMLCommon.hpp | 12 ++++++------ include/athena/YAMLDocReader.hpp | 10 +++++++++- include/athena/YAMLDocWriter.hpp | 9 ++++++++- src/athena/Checksums.cpp | 3 --- src/athena/Compression.cpp | 3 ++- src/athena/DNAYaml.cpp | 5 +++++ src/athena/Dir.cpp | 6 +++++- src/athena/FileInfo.cpp | 12 +++++++----- src/athena/FileWriterGeneric.cpp | 2 ++ src/athena/MemoryReader.cpp | 7 ++----- src/athena/MemoryWriter.cpp | 2 -- src/athena/Socket.cpp | 11 +++++++---- src/athena/Utility.cpp | 15 ++++++++------- src/athena/VectorWriter.cpp | 4 +--- 32 files changed, 125 insertions(+), 88 deletions(-) diff --git a/include/LZ77/LZType10.hpp b/include/LZ77/LZType10.hpp index a3517bc..2e0f0da 100644 --- a/include/LZ77/LZType10.hpp +++ b/include/LZ77/LZType10.hpp @@ -1,6 +1,6 @@ #pragma once -#include "LZBase.hpp" +#include "LZ77/LZBase.hpp" class LZType10 : public LZBase { public: diff --git a/include/LZ77/LZType11.hpp b/include/LZ77/LZType11.hpp index 7402319..42a26a5 100644 --- a/include/LZ77/LZType11.hpp +++ b/include/LZ77/LZType11.hpp @@ -1,6 +1,6 @@ #pragma once -#include "LZBase.hpp" +#include "LZ77/LZBase.hpp" class LZType11 : public LZBase { public: diff --git a/include/athena/Checksums.hpp b/include/athena/Checksums.hpp index 68402b1..ef2633e 100644 --- a/include/athena/Checksums.hpp +++ b/include/athena/Checksums.hpp @@ -1,6 +1,6 @@ #pragma once -#include "athena/Global.hpp" +#include "athena/Types.hpp" namespace athena::checksums { atUint64 crc64(const atUint8* data, atUint64 length, atUint64 seed = 0xFFFFFFFFFFFFFFFF, diff --git a/include/athena/Compression.hpp b/include/athena/Compression.hpp index b56eb7e..43f7c1d 100644 --- a/include/athena/Compression.hpp +++ b/include/athena/Compression.hpp @@ -1,6 +1,6 @@ #pragma once -#include "athena/Global.hpp" +#include "athena/Types.hpp" namespace athena::io::Compression { // Zlib compression diff --git a/include/athena/DNA.hpp b/include/athena/DNA.hpp index 3fe92a2..b24d0f8 100644 --- a/include/athena/DNA.hpp +++ b/include/athena/DNA.hpp @@ -6,12 +6,16 @@ * Any changes to the types or namespacing must be reflected in 'atdna/main.cpp' */ -#include "Global.hpp" -#include "IStreamReader.hpp" -#include "IStreamWriter.hpp" -#include "DNAOp.hpp" -#include #include +#include +#include + +#include + +#include "athena/DNAOp.hpp" +#include "athena/Global.hpp" +#include "athena/IStreamReader.hpp" +#include "athena/IStreamWriter.hpp" namespace athena::io { diff --git a/include/athena/DNAOp.hpp b/include/athena/DNAOp.hpp index 271dd63..f37d2aa 100644 --- a/include/athena/DNAOp.hpp +++ b/include/athena/DNAOp.hpp @@ -1,11 +1,16 @@ #pragma once -#include "IStreamReader.hpp" -#include "IStreamWriter.hpp" -#include "YAMLDocReader.hpp" -#include "YAMLDocWriter.hpp" -#include "ChecksumsLiterals.hpp" +#include +#include +#include #include +#include + +#include "athena/ChecksumsLiterals.hpp" +#include "athena/IStreamReader.hpp" +#include "athena/IStreamWriter.hpp" +#include "athena/YAMLDocReader.hpp" +#include "athena/YAMLDocWriter.hpp" namespace athena::io { diff --git a/include/athena/DNAYaml.hpp b/include/athena/DNAYaml.hpp index 0ca0ad4..4713b14 100644 --- a/include/athena/DNAYaml.hpp +++ b/include/athena/DNAYaml.hpp @@ -1,10 +1,13 @@ #pragma once -#include "YAMLDocReader.hpp" -#include "YAMLDocWriter.hpp" -#include "DNA.hpp" -#include "FileReader.hpp" -#include "FileWriter.hpp" +#include +#include + +#include "athena/DNA.hpp" +#include "athena/FileReader.hpp" +#include "athena/FileWriter.hpp" +#include "athena/YAMLDocReader.hpp" +#include "athena/YAMLDocWriter.hpp" namespace athena::io { diff --git a/include/athena/Dir.hpp b/include/athena/Dir.hpp index 413800c..ec34eda 100644 --- a/include/athena/Dir.hpp +++ b/include/athena/Dir.hpp @@ -1,11 +1,9 @@ #pragma once -#include "athena/FileInfo.hpp" -#include -#include +#include #if _WIN32 -typedef int mode_t; +using mode_t = int; #endif namespace athena { @@ -19,8 +17,6 @@ public: bool isDir() const; static bool isDir(std::string_view dir) { return Dir(dir).isDir(); } - std::vector files() const; - bool cd(std::string_view path); bool rm(std::string_view path); bool touch(); diff --git a/include/athena/FileInfo.hpp b/include/athena/FileInfo.hpp index 58cc753..925cba6 100644 --- a/include/athena/FileInfo.hpp +++ b/include/athena/FileInfo.hpp @@ -2,7 +2,7 @@ #include -#include "athena/Global.hpp" +#include "athena/Types.hpp" namespace athena { class FileInfo { diff --git a/include/athena/FileReader.hpp b/include/athena/FileReader.hpp index 123b3ab..69a3357 100644 --- a/include/athena/FileReader.hpp +++ b/include/athena/FileReader.hpp @@ -9,9 +9,11 @@ #include #endif -#include #include +#include + #include "athena/IStreamReader.hpp" +#include "athena/Types.hpp" namespace athena::io { class FileReader : public IStreamReader { diff --git a/include/athena/FileWriter.hpp b/include/athena/FileWriter.hpp index a095d9b..99994ba 100644 --- a/include/athena/FileWriter.hpp +++ b/include/athena/FileWriter.hpp @@ -8,7 +8,9 @@ #else #include #endif + #include "athena/IStreamWriter.hpp" +#include "athena/Types.hpp" namespace athena::io { class FileWriter : public IStreamWriter { diff --git a/include/athena/IStream.hpp b/include/athena/IStream.hpp index 6b790fe..4614184 100644 --- a/include/athena/IStream.hpp +++ b/include/athena/IStream.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Global.hpp" +#include "athena/Global.hpp" namespace athena::io { std::ostream& operator<<(std::ostream& os, Endian& endian); diff --git a/include/athena/IStreamReader.hpp b/include/athena/IStreamReader.hpp index fbdd896..203ed52 100644 --- a/include/athena/IStreamReader.hpp +++ b/include/athena/IStreamReader.hpp @@ -1,10 +1,12 @@ #pragma once -#include #include -#include "utf8proc.h" -#include "Utility.hpp" -#include "IStream.hpp" +#include +#include +#include + +#include "athena/IStream.hpp" +#include "athena/Utility.hpp" namespace athena::io { /** @brief The IStreamReader class defines a basic API for reading from streams, Implementors are provided with one pure diff --git a/include/athena/IStreamWriter.hpp b/include/athena/IStreamWriter.hpp index 28c9406..629d86c 100644 --- a/include/athena/IStreamWriter.hpp +++ b/include/athena/IStreamWriter.hpp @@ -1,11 +1,14 @@ #pragma once -#include "utf8proc.h" -#include "IStream.hpp" -#include "Utility.hpp" -#include +#include +#include #include +#include "utf8proc.h" + +#include "athena/IStream.hpp" +#include "athena/Utility.hpp" + namespace athena::io { class IStreamWriter : public IStream { public: diff --git a/include/athena/MemoryWriter.hpp b/include/athena/MemoryWriter.hpp index 2adb0d6..2e59e94 100644 --- a/include/athena/MemoryWriter.hpp +++ b/include/athena/MemoryWriter.hpp @@ -1,8 +1,8 @@ #pragma once -#include #include -#include +#include + #include "athena/IStreamWriter.hpp" namespace athena::io { diff --git a/include/athena/Socket.hpp b/include/athena/Socket.hpp index 9570f03..fb19b89 100644 --- a/include/athena/Socket.hpp +++ b/include/athena/Socket.hpp @@ -1,15 +1,12 @@ #pragma once -#include -#include +#include +#include #include -#include - -#include "Global.hpp" #ifdef _WIN32 #include -typedef UINT_PTR SOCKET; +using SOCKET = UINT_PTR; #endif struct sockaddr_in; diff --git a/include/athena/Utility.hpp b/include/athena/Utility.hpp index 1602564..2242626 100644 --- a/include/athena/Utility.hpp +++ b/include/athena/Utility.hpp @@ -1,11 +1,11 @@ #ifndef __UTILITY_H__ #define __UTILITY_H__ +#include #include #include #include -#include -#include + #include "athena/Global.hpp" #include "athena/Types.hpp" diff --git a/include/athena/VectorWriter.hpp b/include/athena/VectorWriter.hpp index 3233f41..396cec1 100644 --- a/include/athena/VectorWriter.hpp +++ b/include/athena/VectorWriter.hpp @@ -1,10 +1,10 @@ #pragma once -#include -#include -#include +#include #include + #include "athena/IStreamWriter.hpp" +#include "athena/Types.hpp" namespace athena::io { diff --git a/include/athena/YAMLCommon.hpp b/include/athena/YAMLCommon.hpp index 01e56bd..1b282ea 100644 --- a/include/athena/YAMLCommon.hpp +++ b/include/athena/YAMLCommon.hpp @@ -4,13 +4,13 @@ #pragma once -#include -#include -#include -#include #include -#include -#include "Global.hpp" +#include +#include + +#include + +#include "athena/Types.hpp" namespace athena::io { class IStreamReader; diff --git a/include/athena/YAMLDocReader.hpp b/include/athena/YAMLDocReader.hpp index 45f160c..a0f2cb4 100644 --- a/include/athena/YAMLDocReader.hpp +++ b/include/athena/YAMLDocReader.hpp @@ -1,6 +1,14 @@ #pragma once -#include "YAMLCommon.hpp" +#include +#include +#include +#include +#include +#include + +#include "athena/Types.hpp" +#include "athena/YAMLCommon.hpp" namespace athena::io { diff --git a/include/athena/YAMLDocWriter.hpp b/include/athena/YAMLDocWriter.hpp index c590674..557a061 100644 --- a/include/athena/YAMLDocWriter.hpp +++ b/include/athena/YAMLDocWriter.hpp @@ -1,6 +1,13 @@ #pragma once -#include "YAMLCommon.hpp" +#include +#include +#include +#include +#include + +#include "athena/Types.hpp" +#include "athena/YAMLCommon.hpp" namespace athena::io { diff --git a/src/athena/Checksums.cpp b/src/athena/Checksums.cpp index da0bcd8..2f69ece 100644 --- a/src/athena/Checksums.cpp +++ b/src/athena/Checksums.cpp @@ -1,7 +1,4 @@ #include "athena/Checksums.hpp" -#include "athena/FileReader.hpp" -#include -#include namespace athena::checksums { atUint64 crc64(const atUint8* data, atUint64 length, atUint64 seed, atUint64 final) { diff --git a/src/athena/Compression.cpp b/src/athena/Compression.cpp index ff23040..2f7ac54 100644 --- a/src/athena/Compression.cpp +++ b/src/athena/Compression.cpp @@ -1,8 +1,9 @@ #include "athena/Compression.hpp" + #if AT_LZOKAY #include #endif -#include + #include #include "LZ77/LZType10.hpp" #include "LZ77/LZType11.hpp" diff --git a/src/athena/DNAYaml.cpp b/src/athena/DNAYaml.cpp index 6021982..3422a6f 100644 --- a/src/athena/DNAYaml.cpp +++ b/src/athena/DNAYaml.cpp @@ -1,5 +1,10 @@ #include "athena/DNAYaml.hpp" +#include +#include + +#include "athena/YAMLCommon.hpp" + namespace athena::io { template <> diff --git a/src/athena/Dir.cpp b/src/athena/Dir.cpp index bdb3b09..1f038a4 100644 --- a/src/athena/Dir.cpp +++ b/src/athena/Dir.cpp @@ -1,10 +1,14 @@ #include "athena/Dir.hpp" -#include + #include #include #include +#include + #define __STDC_FORMAT_MACROS #include + +#include "athena/FileInfo.hpp" #include "athena/Utility.hpp" #ifndef _WIN32 diff --git a/src/athena/FileInfo.cpp b/src/athena/FileInfo.cpp index d78913c..cf8e6ba 100644 --- a/src/athena/FileInfo.cpp +++ b/src/athena/FileInfo.cpp @@ -1,11 +1,13 @@ #include "athena/FileInfo.hpp" -#include "athena/Utility.hpp" -#include "athena/FileWriter.hpp" -#include "athena/FileReader.hpp" -#include + +#include #include -#include #include +#include + +#include "athena/FileReader.hpp" +#include "athena/FileWriter.hpp" +#include "athena/Utility.hpp" #ifndef _WIN32 #include diff --git a/src/athena/FileWriterGeneric.cpp b/src/athena/FileWriterGeneric.cpp index 7873123..cd898f5 100644 --- a/src/athena/FileWriterGeneric.cpp +++ b/src/athena/FileWriterGeneric.cpp @@ -1,5 +1,7 @@ #include "athena/FileWriter.hpp" +#include + namespace athena::io { void TransactionalFileWriter::seek(atInt64 pos, SeekOrigin origin) { switch (origin) { diff --git a/src/athena/MemoryReader.cpp b/src/athena/MemoryReader.cpp index ba45b41..7d86191 100644 --- a/src/athena/MemoryReader.cpp +++ b/src/athena/MemoryReader.cpp @@ -1,11 +1,8 @@ #include "athena/MemoryReader.hpp" -#include -#include -#include -#include -#include #include +#include +#include #ifdef HW_RVL #include diff --git a/src/athena/MemoryWriter.cpp b/src/athena/MemoryWriter.cpp index 15f4216..4e8bb61 100644 --- a/src/athena/MemoryWriter.cpp +++ b/src/athena/MemoryWriter.cpp @@ -2,8 +2,6 @@ #include #include -#include -#include #ifdef HW_RVL #include diff --git a/src/athena/Socket.cpp b/src/athena/Socket.cpp index 129972a..d4041e5 100644 --- a/src/athena/Socket.cpp +++ b/src/athena/Socket.cpp @@ -1,18 +1,21 @@ #include "athena/Socket.hpp" #ifndef _WIN32 -#include -#include -#include +#include + #include #include +#include +#include +#include #include -#include #else #include #include #endif +#include "athena/Global.hpp" + namespace athena::net { /* Define the low-level send/receive flags, which depend on the OS */ diff --git a/src/athena/Utility.cpp b/src/athena/Utility.cpp index c0665fc..6779da1 100644 --- a/src/athena/Utility.cpp +++ b/src/athena/Utility.cpp @@ -1,15 +1,16 @@ #include "athena/Utility.hpp" -#include -#include -#include -#include + #include #include -#include #include -#include -#include +#include +#include +#include #include +#include + +#include +#include #include "utf8proc.h" #ifdef _MSC_VER diff --git a/src/athena/VectorWriter.cpp b/src/athena/VectorWriter.cpp index 2e36c9d..a9db96c 100644 --- a/src/athena/VectorWriter.cpp +++ b/src/athena/VectorWriter.cpp @@ -1,10 +1,8 @@ #include "athena/VectorWriter.hpp" -#include +#include #include #include -#include -#include namespace athena::io {