Merge pull request #26166 from ksooo/improve-plugin-ctx-menus
[xbmc.git] / xbmc / pictures / PictureInfoTag.h
blob796a741017fc13a1acb984e4ddcdc2fc9e190b49
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "XBDateTime.h"
12 #include "pictures/metadata/ImageMetadata.h"
13 #include "utils/IArchivable.h"
14 #include "utils/ISerializable.h"
15 #include "utils/ISortable.h"
17 #include <string>
18 #include <vector>
20 namespace KODI
22 namespace ADDONS
24 class CImageDecoder;
25 } /* namespace ADDONS */
26 } /* namespace KODI */
28 class CVariant;
30 class CPictureInfoTag : public IArchivable, public ISerializable, public ISortable
32 friend class KODI::ADDONS::CImageDecoder;
34 public:
35 CPictureInfoTag() { Reset(); }
36 virtual ~CPictureInfoTag() = default;
37 void Reset();
38 void Archive(CArchive& ar) override;
39 void Serialize(CVariant& value) const override;
40 void ToSortable(SortItem& sortable, Field field) const override;
41 const std::string GetInfo(int info) const;
43 bool Loaded() const { return m_isLoaded; }
44 bool Load(const std::string &path);
46 void SetInfo(const std::string& key, const std::string& value);
48 /**
49 * GetDateTimeTaken() -- Returns the EXIF DateTimeOriginal for current picture
51 * The exif library returns DateTimeOriginal if available else the other
52 * DateTime tags.
54 const CDateTime& GetDateTimeTaken() const;
55 private:
56 static int TranslateString(const std::string &info);
58 ImageMetadata m_imageMetadata;
59 bool m_isLoaded; // Set to true if metadata has been loaded from the picture file successfully
60 bool m_isInfoSetExternally; // Set to true if metadata has been set by an external call to SetInfo
61 CDateTime m_dateTimeTaken;
62 void ConvertDateTime();