diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-08-30 20:38:37 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-08-30 20:38:37 -0400 |
commit | a9d33aa08df10102539e33c0c6d4334e9e99a470 (patch) | |
tree | 6e6e4db4c6250b6a4720dc4e34907347e8dcddf5 /src | |
parent | e42d8636f3aa15e0ea8f723133914d6dba22009c (diff) | |
download | libtwittercpp-a9d33aa08df10102539e33c0c6d4334e9e99a470.tar.gz libtwittercpp-a9d33aa08df10102539e33c0c6d4334e9e99a470.tar.bz2 libtwittercpp-a9d33aa08df10102539e33c0c6d4334e9e99a470.zip |
Started using hkutil
As of this commit, the only change is using hatkirby::implode instead of the implode that was in util.cpp.
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 11 | ||||
-rw-r--r-- | src/client.h | 1 | ||||
-rw-r--r-- | src/timeline.cpp | 5 | ||||
-rw-r--r-- | src/util.h | 21 |
4 files changed, 10 insertions, 28 deletions
diff --git a/src/client.cpp b/src/client.cpp index 3a01c90..07f7580 100644 --- a/src/client.cpp +++ b/src/client.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <algorithm> | 4 | #include <algorithm> |
5 | #include <json.hpp> | 5 | #include <json.hpp> |
6 | #include <thread> | 6 | #include <thread> |
7 | #include <hkutil/string.h> | ||
7 | #include "request.h" | 8 | #include "request.h" |
8 | 9 | ||
9 | namespace twitter { | 10 | namespace twitter { |
@@ -26,7 +27,7 @@ namespace twitter { | |||
26 | if (!media_ids.empty()) | 27 | if (!media_ids.empty()) |
27 | { | 28 | { |
28 | datastrstream << "&media_ids="; | 29 | datastrstream << "&media_ids="; |
29 | datastrstream << twitter::implode(std::begin(media_ids), std::end(media_ids), ","); | 30 | datastrstream << hatkirby::implode(std::begin(media_ids), std::end(media_ids), ","); |
30 | } | 31 | } |
31 | 32 | ||
32 | return tweet( | 33 | return tweet( |
@@ -46,7 +47,7 @@ namespace twitter { | |||
46 | if (!media_ids.empty()) | 47 | if (!media_ids.empty()) |
47 | { | 48 | { |
48 | datastrstream << "&media_ids="; | 49 | datastrstream << "&media_ids="; |
49 | datastrstream << twitter::implode(std::begin(media_ids), std::end(media_ids), ","); | 50 | datastrstream << hatkirby::implode(std::begin(media_ids), std::end(media_ids), ","); |
50 | } | 51 | } |
51 | 52 | ||
52 | return tweet( | 53 | return tweet( |
@@ -366,7 +367,8 @@ namespace twitter { | |||
366 | } | 367 | } |
367 | 368 | ||
368 | std::string datastr = "id=" + | 369 | std::string datastr = "id=" + |
369 | OAuth::PercentEncode(implode(std::begin(cur), std::end(cur), ",")); | 370 | OAuth::PercentEncode( |
371 | hatkirby::implode(std::begin(cur), std::end(cur), ",")); | ||
370 | 372 | ||
371 | std::string response = | 373 | std::string response = |
372 | post(auth_, | 374 | post(auth_, |
@@ -399,7 +401,8 @@ namespace twitter { | |||
399 | } | 401 | } |
400 | 402 | ||
401 | std::string datastr = "user_id=" + | 403 | std::string datastr = "user_id=" + |
402 | OAuth::PercentEncode(implode(std::begin(cur), std::end(cur), ",")); | 404 | OAuth::PercentEncode( |
405 | hatkirby::implode(std::begin(cur), std::end(cur), ",")); | ||
403 | 406 | ||
404 | std::string response = | 407 | std::string response = |
405 | post(auth_, | 408 | post(auth_, |
diff --git a/src/client.h b/src/client.h index ba68e6b..5329edb 100644 --- a/src/client.h +++ b/src/client.h | |||
@@ -9,7 +9,6 @@ | |||
9 | #include "tweet.h" | 9 | #include "tweet.h" |
10 | #include "auth.h" | 10 | #include "auth.h" |
11 | #include "configuration.h" | 11 | #include "configuration.h" |
12 | #include "util.h" | ||
13 | #include "timeline.h" | 12 | #include "timeline.h" |
14 | 13 | ||
15 | namespace twitter { | 14 | namespace twitter { |
diff --git a/src/timeline.cpp b/src/timeline.cpp index fd75a69..280c814 100644 --- a/src/timeline.cpp +++ b/src/timeline.cpp | |||
@@ -1,8 +1,8 @@ | |||
1 | #include "timeline.h" | 1 | #include "timeline.h" |
2 | #include <sstream> | 2 | #include <sstream> |
3 | #include <json.hpp> | 3 | #include <json.hpp> |
4 | #include <hkutil/string.h> | ||
4 | #include "codes.h" | 5 | #include "codes.h" |
5 | #include "util.h" | ||
6 | #include "request.h" | 6 | #include "request.h" |
7 | 7 | ||
8 | namespace twitter { | 8 | namespace twitter { |
@@ -40,7 +40,8 @@ namespace twitter { | |||
40 | if (!arguments.empty()) | 40 | if (!arguments.empty()) |
41 | { | 41 | { |
42 | urlstr << "?"; | 42 | urlstr << "?"; |
43 | urlstr << implode(std::begin(arguments), std::end(arguments), "&"); | 43 | urlstr << hatkirby::implode( |
44 | std::begin(arguments), std::end(arguments), "&"); | ||
44 | } | 45 | } |
45 | 46 | ||
46 | std::string theUrl = urlstr.str(); | 47 | std::string theUrl = urlstr.str(); |
diff --git a/src/util.h b/src/util.h index b950728..8b9cf86 100644 --- a/src/util.h +++ b/src/util.h | |||
@@ -1,31 +1,10 @@ | |||
1 | #ifndef UTIL_H_440DEAA0 | 1 | #ifndef UTIL_H_440DEAA0 |
2 | #define UTIL_H_440DEAA0 | 2 | #define UTIL_H_440DEAA0 |
3 | 3 | ||
4 | #include <string> | ||
5 | #include <sstream> | ||
6 | #include <memory> | ||
7 | #include <ctime> | 4 | #include <ctime> |
8 | 5 | ||
9 | namespace twitter { | 6 | namespace twitter { |
10 | 7 | ||
11 | template <class InputIterator> | ||
12 | std::string implode(InputIterator first, InputIterator last, std::string delimiter) | ||
13 | { | ||
14 | std::stringstream result; | ||
15 | |||
16 | for (InputIterator it = first; it != last; it++) | ||
17 | { | ||
18 | if (it != first) | ||
19 | { | ||
20 | result << delimiter; | ||
21 | } | ||
22 | |||
23 | result << *it; | ||
24 | } | ||
25 | |||
26 | return result.str(); | ||
27 | } | ||
28 | |||
29 | time_t timegm(struct tm * t); | 8 | time_t timegm(struct tm * t); |
30 | 9 | ||
31 | }; | 10 | }; |