Merge pull request #3819 from arnova/subtitles_for_stacks
[vuplus_xbmc] / xbmc / interfaces / legacy / Dictionary.h
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #pragma once
22
23 #include <map>
24 #include "AddonString.h"
25
26 namespace XBMCAddon
27 {
28   // This is a hack in order to handle int's as strings. The correct fix for
29   // this is to get rid of Alternative all togther and make the codegenerator
30   // finally handle overloading correctly.
31   typedef String StringOrInt;
32
33   /**
34    * This is a bit of a hack for dynamically typed languages. In somce
35    * cases python addon api calls handle dictionaries with variable
36    * value types. In this case we coerce all of these types into
37    * strings and then convert them back in the api. Yes, this is messy
38    * and maybe we should use the CVariant here. But for now the 
39    * native api handles these calls by converting the string to the
40    * appropriate types.
41    */
42   template<class T> class Dictionary : public std::map<String,T> {};
43
44   typedef Dictionary<StringOrInt> Properties;
45 }