From e42d8636f3aa15e0ea8f723133914d6dba22009c Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 30 Aug 2018 19:28:02 -0400 Subject: Whitespace changes --- src/codes.cpp | 6 +-- src/codes.h | 108 +++++++++++++++++++++++++------------------------- src/configuration.cpp | 10 ++--- src/configuration.h | 28 ++++++------- 4 files changed, 76 insertions(+), 76 deletions(-) diff --git a/src/codes.cpp b/src/codes.cpp index 7805c7a..560194c 100644 --- a/src/codes.cpp +++ b/src/codes.cpp @@ -2,15 +2,15 @@ #include namespace twitter { - + const char* invalid_response::WHAT_TEXT = "Invalid response data received from Twitter"; const char* connection_error::WHAT_TEXT = "Error connecting to Twitter"; - + std::string unknown_error::generateMessage(int response_code) { std::ostringstream msgbuilder; msgbuilder << "Unknown error (HTTP " << response_code << ")"; - + return msgbuilder.str(); } diff --git a/src/codes.h b/src/codes.h index baf4f8f..b8812df 100644 --- a/src/codes.h +++ b/src/codes.h @@ -5,179 +5,179 @@ #include namespace twitter { - + class twitter_error : public std::runtime_error { public: - + using std::runtime_error::runtime_error; }; - + class bad_auth : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class invalid_response : public twitter_error { public: - + static const char* WHAT_TEXT; - + explicit invalid_response(std::string response) noexcept : twitter_error(WHAT_TEXT), _response(std::move(response)) { } - + const std::string& getResponse() const noexcept { return _response; } - + private: - + std::string _response; }; - + class account_suspended : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class rate_limit_exceeded : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class update_limit_exceeded : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class bad_token : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class server_overloaded : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class server_error : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class bad_length : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class duplicate_status : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class suspected_spam : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class write_restricted : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class invalid_media : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class server_unavailable : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class server_timeout : public twitter_error { public: - + using twitter_error::twitter_error; }; - + class unknown_error : public twitter_error { public: - + unknown_error(int response_code, std::string response_data) : twitter_error(generateMessage(response_code)), _response_code(response_code), _response_data(std::move(response_data)) { } - + int getResponseCode() const noexcept { return _response_code; } - + const std::string& getResponse() const noexcept { return _response_data; } - + private: - + static std::string generateMessage(int response_code); - + int _response_code; std::string _response_data; }; - + class connection_error : public twitter_error { public: - + static const char* WHAT_TEXT; - + connection_error() noexcept : twitter_error(WHAT_TEXT) { } }; - + class invalid_member : public std::domain_error { public: - + using std::domain_error::domain_error; }; - + class malformed_object : public invalid_response { public: - + malformed_object(std::string type, std::string data) noexcept : invalid_response(std::move(data)), _type(std::move(type)) { } - + const std::string& getType() const noexcept { return _type; } - + private: - + std::string _type; }; - + }; #endif /* end of include guard: CODES_H_05838D39 */ diff --git a/src/configuration.cpp b/src/configuration.cpp index 0010a40..ed0ba8c 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -4,18 +4,18 @@ #include "codes.h" namespace twitter { - + configuration::configuration(std::string data) try { auto json_data = nlohmann::json::parse(data); - + _characters_reserved_per_media = json_data["characters_reserved_per_media"].get(); _dm_text_character_limit = json_data["dm_text_character_limit"].get(); _max_media_per_upload = json_data["max_media_per_upload"].get(); _photo_size_limit = json_data["photo_size_limit"].get(); _short_url_length = json_data["short_url_length"].get(); _short_https_url_length = json_data["short_url_length_https"].get(); - + for (auto sizedata = std::begin(json_data["photo_sizes"]); sizedata != std::end(json_data["photo_sizes"]); ++sizedata) { photosize size; @@ -27,10 +27,10 @@ namespace twitter { } else { size.resize = resizetype::crop; } - + _photo_sizes[sizedata.key()] = size; } - + for (auto path : json_data["non_username_paths"]) { _non_username_paths.insert(path.get()); diff --git a/src/configuration.h b/src/configuration.h index 543e306..e9c3be3 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -6,64 +6,64 @@ #include namespace twitter { - + class configuration { public: enum class resizetype { fit, crop }; - + struct photosize { size_t height; size_t width; resizetype resize; }; - + explicit configuration(std::string data); - + size_t getCharactersReservedPerMedia() const { return _characters_reserved_per_media; } - + size_t getDirectMessageCharacterLimit() const { return _dm_text_character_limit; } - + size_t getMaxMediaPerUpload() const { return _max_media_per_upload; } - + size_t getPhotoSizeLimit() const { return _photo_size_limit; } - + const std::map& getPhotoSizes() const { return _photo_sizes; } - + size_t getShortUrlLength() const { return _short_url_length; } - + size_t getShortHttpsUrlLength() const { return _short_https_url_length; } - + const std::set& getNonUsernamePaths() const { return _non_username_paths; } - + private: - + size_t _characters_reserved_per_media; size_t _dm_text_character_limit; size_t _max_media_per_upload; @@ -73,7 +73,7 @@ namespace twitter { size_t _short_https_url_length; std::set _non_username_paths; }; - + }; #endif /* end of include guard: CONFIGURATION_H_A7164D18 */ -- cgit 1.4.1