picture.hpp
1 #ifndef NOOS_OBJECT_PICTURE
2 #define NOOS_OBJECT_PICTURE
3 /*
4  * LICENSE HERE
5  */
6 #include "includes.ihh"
7 #include <noos/objects/globals.hpp>
8 namespace noos {
9 namespace object {
17 class picture
18 {
19 public:
21  picture(const std::string filepath);
22 
24  picture(std::ifstream & bytestream);
25 
27  picture(const std::vector<noos::types::byte> data);
28 
30  picture(const picture &) = default;
31 
33  picture & operator=(const picture &) = default;
34 
36  bool operator==(const picture & rhs) const;
37 
39  bool operator!=(const picture & rhs) const;
40 
42  std::vector<noos::types::byte> bytearray() const;
43 
45  std::string type() const;
46 
48  bool save(const std::string filepath);
49 
50 private:
51  typedef char byte;
52 
54  picture() = delete;
55 
57  void opencb_(std::ifstream & bytestream);
58 
60  std::vector<noos::types::byte> bytearray_;
61  std::string imgtype_;
62 };
63 }
64 }
65 #endif
bool operator!=(const picture &rhs) const
Not picture equality.
Definition: asio_handler.hpp:14
std::vector< noos::types::byte > bytearray() const
Get picture as array of bytes.
class which wraps around raw bytes of a picture
Definition: picture.hpp:17
bool save(const std::string filepath)
Save picture to filepath.
bool operator==(const picture &rhs) const
Picture equality.
picture & operator=(const picture &)=default
Assignment operator.
std::string type() const
Get image type (JPG/PNG supported)