mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-03 19:31:43 +02:00
moved compatibility stuff into compat.h
This commit is contained in:
parent
dd6941b08f
commit
d0a22c0d3c
2 changed files with 46 additions and 16 deletions
46
common/compat.h
Normal file
46
common/compat.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
#ifndef COMPAT_H
|
||||
#define COMPAT_H
|
||||
|
||||
#ifdef ANDROID
|
||||
#define NO_TO_STRING
|
||||
#define NO_STOUL
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef NO_TO_STRING
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#ifdef NO_STOUL
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
|
||||
namespace cpt
|
||||
{
|
||||
template<typename T>
|
||||
static std::string to_string(const T& t)
|
||||
{
|
||||
#ifdef NO_TO_STRING
|
||||
std::stringstream ss;
|
||||
ss << t;
|
||||
return ss.str();
|
||||
#else
|
||||
return std::to_string(t);
|
||||
#endif
|
||||
}
|
||||
|
||||
static long stoul(const std::string& s)
|
||||
{
|
||||
#ifdef NO_STOUL
|
||||
return atol(s.c_str());
|
||||
#else
|
||||
return std::stoul(s);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -159,22 +159,6 @@ static std::string getMacAddress(int sock)
|
|||
}
|
||||
|
||||
|
||||
namespace utl
|
||||
{
|
||||
template<typename T>
|
||||
static std::string to_string(const T& t)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << t;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
static long stoul(const std::string& s)
|
||||
{
|
||||
return atol(s.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue