summary refs log tree commit diff stats
path: root/capital.h
blob: 1f763db10ef4bb23978a4bc02c6d6f3c01a85284 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef CAPITAL_H_09912EAE
#define CAPITAL_H_09912EAE

#include <random>
#include <string>
#include <verbly.h>
#include <stdexcept>
#include <memory>
#include <Magick++.h>
#include <twitter.h>

class capital {
public:

  capital(
    std::string configFile,
    std::mt19937& rng);

  void run() const;

private:

  verbly::word getPicturedNoun() const;

  Magick::Image getImageForNoun(verbly::word pictured) const;

  std::string generateTweetText(verbly::word pictured) const;

  void sendTweet(std::string text, Magick::Image image) const;

  class could_not_get_image : public std::runtime_error {
  public:

    could_not_get_image() : std::runtime_error("Could not get image for noun")
    {
    }
  };

  std::mt19937& rng_;
  std::unique_ptr<verbly::database> database_;
  std::unique_ptr<twitter::client> client_;

};

#endif /* end of include guard: CAPITAL_H_09912EAE */