diff options
Diffstat (limited to 'difference.h')
-rw-r--r-- | difference.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/difference.h b/difference.h new file mode 100644 index 0000000..bccf9ab --- /dev/null +++ b/difference.h | |||
@@ -0,0 +1,58 @@ | |||
1 | #ifndef DIFFERENCE_H_081276A3 | ||
2 | #define DIFFERENCE_H_081276A3 | ||
3 | |||
4 | #include <random> | ||
5 | #include <string> | ||
6 | #include <Magick++.h> | ||
7 | #include <utility> | ||
8 | #include <verbly.h> | ||
9 | #include <stdexcept> | ||
10 | #include <twitter.h> | ||
11 | #include <memory> | ||
12 | |||
13 | class difference { | ||
14 | public: | ||
15 | |||
16 | difference( | ||
17 | std::string configFile, | ||
18 | std::mt19937& rng); | ||
19 | |||
20 | void run() const; | ||
21 | |||
22 | private: | ||
23 | |||
24 | verbly::word getPicturedNoun() const; | ||
25 | |||
26 | std::pair<Magick::Image, Magick::Image> | ||
27 | getImagesForNoun(verbly::word pictured) const; | ||
28 | |||
29 | Magick::Image getImageAtUrl(std::string url) const; | ||
30 | |||
31 | std::pair<verbly::word, verbly::word> getOppositeIdentifiers() const; | ||
32 | |||
33 | Magick::Image composeImage( | ||
34 | Magick::Image image1, | ||
35 | verbly::word word1, | ||
36 | Magick::Image image2, | ||
37 | verbly::word word2) const; | ||
38 | |||
39 | std::string generateTweetText(verbly::word word1, verbly::word word2) const; | ||
40 | |||
41 | void sendTweet(std::string text, Magick::Image image) const; | ||
42 | |||
43 | class could_not_get_images : public std::runtime_error { | ||
44 | public: | ||
45 | |||
46 | could_not_get_images() : std::runtime_error("Could not get images for noun") | ||
47 | { | ||
48 | } | ||
49 | }; | ||
50 | |||
51 | std::mt19937& rng_; | ||
52 | std::unique_ptr<verbly::database> database_; | ||
53 | std::unique_ptr<twitter::client> client_; | ||
54 | std::string fontfile_; | ||
55 | |||
56 | }; | ||
57 | |||
58 | #endif /* end of include guard: DIFFERENCE_H_081276A3 */ | ||