[cosmetic] cleanup copyright headers
[vuplus_xbmc] / xbmc / windowing / egl / wayland / WaylandLibraries.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2011-2013 Team XBMC
5  *      http://xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22 #include <boost/noncopyable.hpp>
23
24 #include "windowing/DllWaylandClient.h"
25 #include "windowing/DllWaylandEgl.h"
26 #include "windowing/DllXKBCommon.h"
27
28 namespace xbmc
29 {
30 namespace wayland
31 {
32 template <class DllInterface, class Dll>
33 class AutoloadDll :
34   boost::noncopyable
35 {
36   public:
37
38     AutoloadDll();
39     ~AutoloadDll();
40     DllInterface & Get();
41
42   private:
43
44     Dll m_dll;
45 };
46
47 class Libraries :
48   boost::noncopyable
49 {
50 public:
51
52   IDllWaylandClient & ClientLibrary();
53   IDllWaylandEGL & EGLLibrary();
54   IDllXKBCommon & XKBCommonLibrary();
55
56 private:
57
58   AutoloadDll<IDllWaylandClient, DllWaylandClient> m_clientLibrary;
59   AutoloadDll<IDllWaylandEGL, DllWaylandEGL> m_eglLibrary;
60   AutoloadDll<IDllXKBCommon, DllXKBCommon> m_xkbCommonLibrary;
61 };
62
63 void LoadLibrary(DllDynamic &dll);
64
65 template <class DllInterface, class Dll>
66 AutoloadDll<DllInterface, Dll>::AutoloadDll()
67 {
68   LoadLibrary(m_dll);
69 }
70
71 template <class DllInterface, class Dll>
72 DllInterface &
73 AutoloadDll<DllInterface, Dll>::Get()
74 {
75   return m_dll;
76 }
77
78 template <class DllInterface, class Dll>
79 AutoloadDll<DllInterface, Dll>::~AutoloadDll()
80 {
81   m_dll.Unload();
82 }
83 }
84 }