From 39af18fe35b89b242081e245fe3842ad3f4e51b6 Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 12 Aug 2019 04:06:43 +0200 Subject: [PATCH] Removed nonsensical ifdefs. --- CMakeLists.txt | 4 -- examples/example01_get_public_timeline.cpp | 9 +--- examples/example02_stream.cpp | 9 +--- src/easy/all.hpp | 61 +++++++--------------- src/easy/easy.hpp | 19 ++----- src/easy/entities/account.hpp | 13 ++--- src/easy/entities/application.hpp | 10 +--- src/easy/entities/attachment.hpp | 10 +--- src/easy/entities/card.hpp | 10 +--- src/easy/entities/context.hpp | 13 ++--- src/easy/entities/emoji.hpp | 10 +--- src/easy/entities/filter.hpp | 10 +--- src/easy/entities/instance.hpp | 13 ++--- src/easy/entities/list.hpp | 10 +--- src/easy/entities/mention.hpp | 10 +--- src/easy/entities/notification.hpp | 16 ++---- src/easy/entities/pushsubscription.hpp | 10 +--- src/easy/entities/relationship.hpp | 10 +--- src/easy/entities/report.hpp | 10 +--- src/easy/entities/results.hpp | 19 ++----- src/easy/entities/status.hpp | 31 ++++------- src/easy/entities/tag.hpp | 10 +--- src/easy/entities/token.hpp | 10 +--- src/easy/entity.hpp | 7 +-- src/easy/return_types_easy.hpp | 7 +-- src/mastodon-cpp.hpp | 10 +--- 26 files changed, 83 insertions(+), 268 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bcb47aa..e49005d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,10 +48,6 @@ configure_file ( "${PROJECT_BINARY_DIR}/version.hpp" ) -# Announce that we are compiling mastodon-cpp (used to figure out where the -# headers are) -add_definitions(-DMASTODON_CPP=1) - if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_definitions(-DDEBUG=1) endif() diff --git a/examples/example01_get_public_timeline.cpp b/examples/example01_get_public_timeline.cpp index 285762c..6dbf68c 100644 --- a/examples/example01_get_public_timeline.cpp +++ b/examples/example01_get_public_timeline.cpp @@ -8,13 +8,8 @@ #include #include #include -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/all.hpp" -#else - #include - #include -#endif +#include "mastodon-cpp.hpp" +#include "easy/all.hpp" using std::cout; using std::cerr; diff --git a/examples/example02_stream.cpp b/examples/example02_stream.cpp index 0eaac72..fc08e8f 100644 --- a/examples/example02_stream.cpp +++ b/examples/example02_stream.cpp @@ -10,13 +10,8 @@ #include #include #include -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/all.hpp" -#else - #include - #include -#endif +#include "mastodon-cpp.hpp" +#include "easy/all.hpp" using std::cout; using std::cerr; diff --git a/src/easy/all.hpp b/src/easy/all.hpp index 3a81d0d..464ae78 100644 --- a/src/easy/all.hpp +++ b/src/easy/all.hpp @@ -17,47 +17,24 @@ #ifndef MASTODON_CPP_EASY_ALL_HPP #define MASTODON_CPP_EASY_ALL_HPP -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "easy/easy.hpp" - #include "easy/entities/account.hpp" - #include "easy/entities/application.hpp" - #include "easy/entities/attachment.hpp" - #include "easy/entities/card.hpp" - #include "easy/entities/context.hpp" - #include "easy/entities/emoji.hpp" - #include "easy/entities/instance.hpp" - #include "easy/entities/list.hpp" - #include "easy/entities/mention.hpp" - #include "easy/entities/notification.hpp" - #include "easy/entities/relationship.hpp" - #include "easy/entities/report.hpp" - #include "easy/entities/results.hpp" - #include "easy/entities/status.hpp" - #include "easy/entities/tag.hpp" - #include "easy/entities/token.hpp" - #include "easy/entities/pushsubscription.hpp" - #include "easy/entities/filter.hpp" -#else - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#endif +#include "easy.hpp" +#include "entities/account.hpp" +#include "entities/application.hpp" +#include "entities/attachment.hpp" +#include "entities/card.hpp" +#include "entities/context.hpp" +#include "entities/emoji.hpp" +#include "entities/instance.hpp" +#include "entities/list.hpp" +#include "entities/mention.hpp" +#include "entities/notification.hpp" +#include "entities/relationship.hpp" +#include "entities/report.hpp" +#include "entities/results.hpp" +#include "entities/status.hpp" +#include "entities/tag.hpp" +#include "entities/token.hpp" +#include "entities/pushsubscription.hpp" +#include "entities/filter.hpp" #endif // MASTODON_CPP_EASY_ALL_HPP diff --git a/src/easy/easy.hpp b/src/easy/easy.hpp index fdf7360..270d9aa 100644 --- a/src/easy/easy.hpp +++ b/src/easy/easy.hpp @@ -24,20 +24,11 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/return_types_easy.hpp" - #include "easy/types_easy.hpp" - #include "easy/entities/notification.hpp" - #include "easy/entities/status.hpp" -#else - #include - #include - #include - #include - #include -#endif +#include "../mastodon-cpp.hpp" +#include "return_types_easy.hpp" +#include "types_easy.hpp" +#include "entities/notification.hpp" +#include "entities/status.hpp" using std::string; using std::vector; diff --git a/src/easy/entities/account.hpp b/src/easy/entities/account.hpp index 9b3c791..a260b32 100644 --- a/src/easy/entities/account.hpp +++ b/src/easy/entities/account.hpp @@ -22,16 +22,9 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" - #include "easy/entities/emoji.hpp" -#else - #include - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" +#include "emoji.hpp" using std::string; using std::uint64_t; diff --git a/src/easy/entities/application.hpp b/src/easy/entities/application.hpp index a8b0b22..c971136 100644 --- a/src/easy/entities/application.hpp +++ b/src/easy/entities/application.hpp @@ -19,14 +19,8 @@ #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; diff --git a/src/easy/entities/attachment.hpp b/src/easy/entities/attachment.hpp index e90ce80..5601f0a 100644 --- a/src/easy/entities/attachment.hpp +++ b/src/easy/entities/attachment.hpp @@ -22,14 +22,8 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; using std::uint64_t; diff --git a/src/easy/entities/card.hpp b/src/easy/entities/card.hpp index a6a40fe..4aab41f 100644 --- a/src/easy/entities/card.hpp +++ b/src/easy/entities/card.hpp @@ -20,14 +20,8 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; using std::uint64_t; diff --git a/src/easy/entities/context.hpp b/src/easy/entities/context.hpp index 034b1f2..e977abf 100644 --- a/src/easy/entities/context.hpp +++ b/src/easy/entities/context.hpp @@ -20,16 +20,9 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" - #include "easy/entities/status.hpp" -#else - #include - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" +#include "status.hpp" using std::string; diff --git a/src/easy/entities/emoji.hpp b/src/easy/entities/emoji.hpp index acf539c..0d79f73 100644 --- a/src/easy/entities/emoji.hpp +++ b/src/easy/entities/emoji.hpp @@ -19,14 +19,8 @@ #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; diff --git a/src/easy/entities/filter.hpp b/src/easy/entities/filter.hpp index a9b2327..33a1df1 100644 --- a/src/easy/entities/filter.hpp +++ b/src/easy/entities/filter.hpp @@ -19,14 +19,8 @@ #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; diff --git a/src/easy/entities/instance.hpp b/src/easy/entities/instance.hpp index 115f5f5..6a743dd 100644 --- a/src/easy/entities/instance.hpp +++ b/src/easy/entities/instance.hpp @@ -22,16 +22,9 @@ using std::uint64_t; -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entities/account.hpp" - #include "easy/entity.hpp" -#else - #include - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" +#include "account.hpp" using std::string; diff --git a/src/easy/entities/list.hpp b/src/easy/entities/list.hpp index ce0378f..b53960b 100644 --- a/src/easy/entities/list.hpp +++ b/src/easy/entities/list.hpp @@ -21,14 +21,8 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; using std::uint64_t; diff --git a/src/easy/entities/mention.hpp b/src/easy/entities/mention.hpp index 58bac3a..23f1cc1 100644 --- a/src/easy/entities/mention.hpp +++ b/src/easy/entities/mention.hpp @@ -20,14 +20,8 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; using std::uint64_t; diff --git a/src/easy/entities/notification.hpp b/src/easy/entities/notification.hpp index 3460c5f..4aee624 100644 --- a/src/easy/entities/notification.hpp +++ b/src/easy/entities/notification.hpp @@ -20,18 +20,10 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entities/account.hpp" - #include "easy/entities/status.hpp" - #include "easy/entity.hpp" -#else - #include - #include - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" +#include "account.hpp" +#include "status.hpp" using std::string; using std::uint64_t; diff --git a/src/easy/entities/pushsubscription.hpp b/src/easy/entities/pushsubscription.hpp index 908379f..22b8928 100644 --- a/src/easy/entities/pushsubscription.hpp +++ b/src/easy/entities/pushsubscription.hpp @@ -22,14 +22,8 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; using std::vector; diff --git a/src/easy/entities/relationship.hpp b/src/easy/entities/relationship.hpp index cdb07c0..821ff7f 100644 --- a/src/easy/entities/relationship.hpp +++ b/src/easy/entities/relationship.hpp @@ -20,14 +20,8 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; using std::uint64_t; diff --git a/src/easy/entities/report.hpp b/src/easy/entities/report.hpp index aa10a84..80c0569 100644 --- a/src/easy/entities/report.hpp +++ b/src/easy/entities/report.hpp @@ -20,14 +20,8 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; diff --git a/src/easy/entities/results.hpp b/src/easy/entities/results.hpp index dffbbe1..0e8f995 100644 --- a/src/easy/entities/results.hpp +++ b/src/easy/entities/results.hpp @@ -20,20 +20,11 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" - #include "easy/entities/account.hpp" - #include "easy/entities/status.hpp" - #include "easy/entities/tag.hpp" -#else - #include - #include - #include - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" +#include "account.hpp" +#include "status.hpp" +#include "tag.hpp" using std::string; diff --git a/src/easy/entities/status.hpp b/src/easy/entities/status.hpp index 91589eb..eff3d08 100644 --- a/src/easy/entities/status.hpp +++ b/src/easy/entities/status.hpp @@ -21,28 +21,15 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" - #include "easy/entities/account.hpp" - #include "easy/entities/emoji.hpp" - #include "easy/entities/attachment.hpp" - #include "easy/entities/mention.hpp" - #include "easy/entities/tag.hpp" - #include "easy/entities/application.hpp" - #include "easy/entities/card.hpp" -#else - #include - #include - #include - #include - #include - #include - #include - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" +#include "account.hpp" +#include "emoji.hpp" +#include "attachment.hpp" +#include "mention.hpp" +#include "tag.hpp" +#include "application.hpp" +#include "card.hpp" using std::string; using std::uint64_t; diff --git a/src/easy/entities/tag.hpp b/src/easy/entities/tag.hpp index 6c14ae0..d52855b 100644 --- a/src/easy/entities/tag.hpp +++ b/src/easy/entities/tag.hpp @@ -20,14 +20,8 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; using std::uint64_t; diff --git a/src/easy/entities/token.hpp b/src/easy/entities/token.hpp index 88e7c6b..e356518 100644 --- a/src/easy/entities/token.hpp +++ b/src/easy/entities/token.hpp @@ -19,14 +19,8 @@ #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" - #include "easy/entity.hpp" -#else - #include - #include -#endif +#include "../../mastodon-cpp.hpp" +#include "../entity.hpp" using std::string; diff --git a/src/easy/entity.hpp b/src/easy/entity.hpp index e01c55a..fafc537 100644 --- a/src/easy/entity.hpp +++ b/src/easy/entity.hpp @@ -20,12 +20,7 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "easy/types_easy.hpp" -#else - #include -#endif +#include "types_easy.hpp" using std::string; diff --git a/src/easy/return_types_easy.hpp b/src/easy/return_types_easy.hpp index cd90af2..455efab 100644 --- a/src/easy/return_types_easy.hpp +++ b/src/easy/return_types_easy.hpp @@ -21,12 +21,7 @@ #include #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "mastodon-cpp.hpp" -#else - #include -#endif +#include "../mastodon-cpp.hpp" using std::string; using std::vector; diff --git a/src/mastodon-cpp.hpp b/src/mastodon-cpp.hpp index 6f30b43..e9b1960 100644 --- a/src/mastodon-cpp.hpp +++ b/src/mastodon-cpp.hpp @@ -28,14 +28,8 @@ #include #include -// If we are compiling mastodon-cpp, use another include path -#ifdef MASTODON_CPP - #include "return_types.hpp" - #include "types.hpp" -#else - #include - #include -#endif +#include "return_types.hpp" +#include "types.hpp" using std::string; using std::uint8_t;