foobar2000 SDK  2015-08-03
coreversion.h
Go to the documentation of this file.
1 class NOVTABLE core_version_info : public service_base {
2 public:
3  virtual const char * get_version_string() = 0;
4  static const char * g_get_version_string() {return static_api_ptr_t<core_version_info>()->get_version_string();}
5  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(core_version_info);
6 };
7 
9  t_uint32 m_major, m_minor1, m_minor2, m_minor3;
10 };
11 
13 class NOVTABLE core_version_info_v2 : public core_version_info {
14 public:
15  virtual const char * get_name() = 0;//"foobar2000"
16  virtual const char * get_version_as_text() = 0;//"N.N.N.N"
17  virtual t_core_version_data get_version() = 0;
18 
20  bool test_version(t_uint32 major, t_uint32 minor1, t_uint32 minor2, t_uint32 minor3) {
21  const t_core_version_data v = get_version();
22  if (v.m_major < major) return false;
23  else if (v.m_major > major) return true;
24  // major version matches
25  else if (v.m_minor1 < minor1) return false;
26  else if (v.m_minor1 > minor1) return true;
27  // minor1 version matches
28  else if (v.m_minor2 < minor2) return false;
29  else if (v.m_minor2 > minor2) return true;
30  // minor2 version matches
31  else if (v.m_minor3 < minor3) return false;
32  else return true;
33  }
34 
35  FB2K_MAKE_SERVICE_INTERFACE(core_version_info_v2, core_version_info);
36 };
New (0.9.4.2)
Definition: coreversion.h:13
static const char * g_get_version_string()
Definition: coreversion.h:4
bool test_version(t_uint32 major, t_uint32 minor1, t_uint32 minor2, t_uint32 minor3)
Determine whether running foobar2000 version is newer or equal to the specified version, eg. test_version(0,9,5,0) for 0.9.5.
Definition: coreversion.h:20
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
Helper template used to easily access core services. Usage: static_api_ptr_t<myclass> api; api->doso...
Definition: service.h:533
uint32_t t_uint32
Definition: int_types.h:5