foobar2000 SDK  2015-08-03
traits.h
Go to the documentation of this file.
1 namespace pfc {
2 
3  class traits_default {
4  public:
5  enum {
6  realloc_safe = false,
7  needs_destructor = true,
10  };
11  };
12 
14  public:
15  enum {
16  realloc_safe = true,
20  };
21  };
22 
24  public:
25  enum {
26  realloc_safe = true,
27  needs_destructor = false,
30  };
31  };
32 
33  class traits_vtable {
34  public:
35  enum {
36  realloc_safe = true,
40  };
41  };
42 
43  template<typename T> class traits_t : public traits_default {};
44 
45  template<typename traits1,typename traits2>
47  public:
48  enum {
49  realloc_safe = (traits1::realloc_safe && traits2::realloc_safe),
50  needs_destructor = (traits1::needs_destructor || traits2::needs_destructor),
51  needs_constructor = (traits1::needs_constructor || traits2::needs_constructor),
52  constructor_may_fail = (traits1::constructor_may_fail || traits2::constructor_may_fail),
53  };
54  };
55 
56  template<typename type1, typename type2>
57  class traits_combined : public combine_traits<traits_t<type1>,traits_t<type2> > {};
58 
59  template<typename T> class traits_t<T*> : public traits_rawobject {};
60 
61  template<> class traits_t<char> : public traits_rawobject {};
62  template<> class traits_t<unsigned char> : public traits_rawobject {};
63  template<> class traits_t<signed char> : public traits_rawobject {};
64  template<> class traits_t<wchar_t> : public traits_rawobject {};
65  template<> class traits_t<short> : public traits_rawobject {};
66  template<> class traits_t<unsigned short> : public traits_rawobject {};
67  template<> class traits_t<int> : public traits_rawobject {};
68  template<> class traits_t<unsigned int> : public traits_rawobject {};
69  template<> class traits_t<long> : public traits_rawobject {};
70  template<> class traits_t<unsigned long> : public traits_rawobject {};
71  template<> class traits_t<long long> : public traits_rawobject {};
72  template<> class traits_t<unsigned long long> : public traits_rawobject {};
73  template<> class traits_t<bool> : public traits_rawobject {};
74 
75  template<> class traits_t<float> : public traits_rawobject {};
76  template<> class traits_t<double> : public traits_rawobject {};
77 
78  template<> class traits_t<GUID> : public traits_rawobject {};
79 
80  template<typename T,t_size p_count>
81  class traits_t<T[p_count]> : public traits_t<T> {};
82 
83 }
Definition: pfc.h:71