From 69fc8d805396b889b5e8c1c88e8129d93db77d29 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 20 Aug 2016 13:56:23 -0400 Subject: Updated API to use exceptions and make tweet/user objects more helpful --- src/configuration.h | 101 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 37 deletions(-) (limited to 'src/configuration.h') diff --git a/src/configuration.h b/src/configuration.h index a15be3d..543e306 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -8,43 +8,70 @@ namespace twitter { class configuration { - public: - enum class resizetype { - fit, - crop - }; - - struct photosize { - size_t height; - size_t width; - resizetype resize; - }; - - configuration(); - configuration(std::string data); - - size_t getCharactersReservedPerMedia() const; - size_t getDirectMessageCharacterLimit() const; - size_t getMaxMediaPerUpload() const; - size_t getPhotoSizeLimit() const; - std::map getPhotoSizes() const; - size_t getShortUrlLength() const; - size_t getShortHttpsUrlLength() const; - std::set getNonUsernamePaths() const; - - operator bool() const; - - private: - bool _valid = false; - - size_t _characters_reserved_per_media; - size_t _dm_text_character_limit; - size_t _max_media_per_upload; - size_t _photo_size_limit; - std::map _photo_sizes; - size_t _short_url_length; - size_t _short_https_url_length; - std::set _non_username_paths; + 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; + size_t _photo_size_limit; + std::map _photo_sizes; + size_t _short_url_length; + size_t _short_https_url_length; + std::set _non_username_paths; }; }; -- cgit 1.4.1