1 #ifndef RAPP_OBJECT_PICTURE
2 #define RAPP_OBJECT_PICTURE
20 std::ifstream bytestream(filepath,
21 std::ios::in | std::ios::binary | std::ios::ate);
22 if (!bytestream.is_open())
23 throw std::runtime_error(
"could not open bytestream for "+filepath);
59 bool save(
const std::string filepath)
61 std::ofstream os(filepath, std::ios::out | std::ofstream::binary);
65 std::ostreambuf_iterator<rapp::types::byte>(os));
83 bytestream.seekg(0, std::ios_base::end);
84 std::streampos fileSize = bytestream.tellg();
86 bytestream.seekg(0, std::ios_base::beg);
class which wraps around raw bytes of a picture
bool operator==(const picture &rhs) const
picture equality
picture(std::ifstream &bytestream)
Construct using an open file stream.
picture & operator=(const picture &)=default
Assignment operator.
std::vector< rapp::types::byte > bytearray() const
Get picture as array of bytes.
void opencb_(std::ifstream &bytestream)
std::string type() const
try and get image type (JPG/PNG supported)
picture(const std::string filepath)
Construct from a file-path.
bool save(const std::string filepath)
Save picture to filepath.
std::vector< rapp::types::byte > bytearray_