[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / utils / LabelFormatter.h
bloba10eae6a84da175d955492fed0fc72f5342f572a
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 <string>
12 #include <vector>
14 namespace MUSIC_INFO
16 class CMusicInfoTag;
19 class CFileItem; // forward
21 struct LABEL_MASKS
23 LABEL_MASKS(const std::string& strLabelFile="", const std::string& strLabel2File="", const std::string& strLabelFolder="", const std::string& strLabel2Folder="") :
24 m_strLabelFile(strLabelFile),
25 m_strLabel2File(strLabel2File),
26 m_strLabelFolder(strLabelFolder),
27 m_strLabel2Folder(strLabel2Folder)
29 std::string m_strLabelFile;
30 std::string m_strLabel2File;
31 std::string m_strLabelFolder;
32 std::string m_strLabel2Folder;
35 class CLabelFormatter
37 public:
38 CLabelFormatter(const std::string &mask, const std::string &mask2);
40 void FormatLabel(CFileItem *item) const;
41 void FormatLabel2(CFileItem *item) const;
42 void FormatLabels(CFileItem *item) const // convenient shorthand
44 FormatLabel(item);
45 FormatLabel2(item);
48 bool FillMusicTag(const std::string &fileName, MUSIC_INFO::CMusicInfoTag *tag) const;
50 private:
51 class CMaskString
53 public:
54 CMaskString(const std::string &prefix, char content, const std::string &postfix) :
55 m_prefix(prefix),
56 m_postfix(postfix),
57 m_content(content)
58 {};
59 std::string m_prefix;
60 std::string m_postfix;
61 char m_content;
64 // functions for assembling the mask vectors
65 void AssembleMask(unsigned int label, const std::string &mask);
66 void SplitMask(unsigned int label, const std::string &mask);
68 // functions for retrieving content based on our mask vectors
69 std::string GetContent(unsigned int label, const CFileItem *item) const;
70 std::string GetMaskContent(const CMaskString &mask, const CFileItem *item) const;
71 void FillMusicMaskContent(const char mask, const std::string &value, MUSIC_INFO::CMusicInfoTag *tag) const;
73 std::vector<std::string> m_staticContent[2];
74 std::vector<CMaskString> m_dynamicContent[2];
75 bool m_hideFileExtensions;