about summary refs log tree commit diff stats
path: root/src/configuration.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/configuration.h')
-rw-r--r--src/configuration.h101
1 files changed, 64 insertions, 37 deletions
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 @@
8namespace twitter { 8namespace twitter {
9 9
10 class configuration { 10 class configuration {
11 public: 11 public:
12 enum class resizetype { 12 enum class resizetype {
13 fit, 13 fit,
14 crop 14 crop
15 }; 15 };
16 16
17 struct photosize { 17 struct photosize {
18 size_t height; 18 size_t height;
19 size_t width; 19 size_t width;
20 resizetype resize; 20 resizetype resize;
21 }; 21 };
22 22
23 configuration(); 23 explicit configuration(std::string data);
24 configuration(std::string data); 24
25 25 size_t getCharactersReservedPerMedia() const
26 size_t getCharactersReservedPerMedia() const; 26 {
27 size_t getDirectMessageCharacterLimit() const; 27 return _characters_reserved_per_media;
28 size_t getMaxMediaPerUpload() const; 28 }
29 size_t getPhotoSizeLimit() const; 29
30 std::map<std::string, photosize> getPhotoSizes() const; 30 size_t getDirectMessageCharacterLimit() const
31 size_t getShortUrlLength() const; 31 {
32 size_t getShortHttpsUrlLength() const; 32 return _dm_text_character_limit;
33 std::set<std::string> getNonUsernamePaths() const; 33 }
34 34
35 operator bool() const; 35 size_t getMaxMediaPerUpload() const
36 36 {
37 private: 37 return _max_media_per_upload;
38 bool _valid = false; 38 }
39 39
40 size_t _characters_reserved_per_media; 40 size_t getPhotoSizeLimit() const
41 size_t _dm_text_character_limit; 41 {
42 size_t _max_media_per_upload; 42 return _photo_size_limit;
43 size_t _photo_size_limit; 43 }
44 std::map<std::string, photosize> _photo_sizes; 44
45 size_t _short_url_length; 45 const std::map<std::string, photosize>& getPhotoSizes() const
46 size_t _short_https_url_length; 46 {
47 std::set<std::string> _non_username_paths; 47 return _photo_sizes;
48 }
49
50 size_t getShortUrlLength() const
51 {
52 return _short_url_length;
53 }
54
55 size_t getShortHttpsUrlLength() const
56 {
57 return _short_https_url_length;
58 }
59
60 const std::set<std::string>& getNonUsernamePaths() const
61 {
62 return _non_username_paths;
63 }
64
65 private:
66
67 size_t _characters_reserved_per_media;
68 size_t _dm_text_character_limit;
69 size_t _max_media_per_upload;
70 size_t _photo_size_limit;
71 std::map<std::string, photosize> _photo_sizes;
72 size_t _short_url_length;
73 size_t _short_https_url_length;
74 std::set<std::string> _non_username_paths;
48 }; 75 };
49 76
50}; 77};