1 /*
2  *  Copyright (C) 2015-2018 Team Kodi
3  *  This file is part of Kodi - https://kodi.tv
4  *
5  *  SPDX-License-Identifier: GPL-2.0-or-later
6  *  See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "IArchivable.h"
12 
13 #include <stdint.h>
14 #include <string>
15 #include <vector>
16 
17 class EmbeddedArtInfo : public IArchivable
18 {
19 public:
20   EmbeddedArtInfo() = default;
21   EmbeddedArtInfo(size_t size, const std::string &mime, const std::string& type = "");
22   virtual ~EmbeddedArtInfo() = default;
23 
24   // implementation of IArchivable
25   void Archive(CArchive& ar) override;
26 
27   void Set(size_t size, const std::string &mime, const std::string& type = "");
28   void Clear();
29   bool Empty() const;
30   bool Matches(const EmbeddedArtInfo &right) const;
SetType(const std::string & type)31   void SetType(const std::string& type) { m_type = type; }
32 
33   size_t m_size = 0;
34   std::string m_mime;
35   std::string m_type;
36 };
37 
38 class EmbeddedArt : public EmbeddedArtInfo
39 {
40 public:
41   EmbeddedArt() = default;
42   EmbeddedArt(const uint8_t *data, size_t size,
43               const std::string &mime, const std::string& type = "");
44 
45   void Set(const uint8_t *data, size_t size,
46            const std::string &mime, const std::string& type = "");
47 
48   std::vector<uint8_t> m_data;
49 };
50