1 /*
2  *  Copyright (C) 2016-2020 Garrett Brown
3  *  Copyright (C) 2016-2020 Team Kodi
4  *
5  *  SPDX-License-Identifier: GPL-2.0-or-later
6  *  See LICENSE.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "ButtonMapTypes.h"
12 
13 #include <map>
14 #include <set>
15 #include <string>
16 
17 namespace JOYSTICK
18 {
19   // --- CJoystickFamily -------------------------------------------------------
20 
21   class CJoystickFamily
22   {
23   public:
24     CJoystickFamily(const std::string& familyName);
25     CJoystickFamily(const CJoystickFamily& other);
26 
27     bool operator<(const CJoystickFamily& other) const;
28 
FamilyName()29     const std::string& FamilyName() const { return m_familyName; }
IsValid()30     bool IsValid() const { return !m_familyName.empty(); }
31 
32   private:
33     const std::string m_familyName;
34   };
35 
36   // --- CJoystickFamilyManager ------------------------------------------------
37 
38   class CJoystickFamilyManager
39   {
40   public:
41     CJoystickFamilyManager() = default;
42 
43     bool Initialize(const std::string& addonPath);
Deinitialize()44     void Deinitialize() { m_families.clear(); }
45 
46     const std::string& GetFamily(const std::string& name, const std::string& provider) const;
47 
48   private:
49     bool LoadFamilies(const std::string& path);
50 
51     JoystickFamilyMap m_families;
52   };
53 }
54