[DEBUG] template specific implementation with gcc error

This commit is contained in:
Edouard DUPIN 2014-08-21 05:32:13 +02:00
parent 2c6a1b8fc8
commit 9da43a7107
4 changed files with 542 additions and 546 deletions

View File

@ -427,33 +427,34 @@ std::string etk::regexp::strTick(int32_t _pos) {
template<> std::string etk::to_string<etk::RegExp<std::string>>(const etk::RegExp<std::string>& _val) {
return _val.getRegExp();
}
template<> std::string etk::to_string<etk::RegExp<std::u32string>>(const etk::RegExp<std::u32string>& _val) {
return _val.getRegExp();
}
template<> std::u32string etk::to_u32string<etk::RegExp<std::string>>(const etk::RegExp<std::string>& _val) {
return _val.getURegExp();
}
template<> std::u32string etk::to_u32string<etk::RegExp<std::u32string>>(const etk::RegExp<std::u32string>& _val) {
return _val.getURegExp();
}
template<> bool etk::from_string<etk::RegExp<std::string>>(etk::RegExp<std::string>& _variableRet, const std::u32string& _value) {
_variableRet.compile(_value);
return true;
}
template<> bool etk::from_string<etk::RegExp<std::u32string>>(etk::RegExp<std::u32string>& _variableRet, const std::u32string& _value) {
_variableRet.compile(_value);
return true;
}
template<> bool etk::from_string<etk::RegExp<std::string>>(etk::RegExp<std::string>& _variableRet, const std::string& _value) {
_variableRet.compile(_value);
return true;
}
template<> bool etk::from_string<etk::RegExp<std::u32string>>(etk::RegExp<std::u32string>& _variableRet, const std::string& _value) {
_variableRet.compile(_value);
return true;
}
namespace etk {
template<> std::string to_string<etk::RegExp<std::string>>(const etk::RegExp<std::string>& _val) {
return _val.getRegExp();
}
template<> std::string to_string<etk::RegExp<std::u32string>>(const etk::RegExp<std::u32string>& _val) {
return _val.getRegExp();
}
template<> std::u32string to_u32string<etk::RegExp<std::string>>(const etk::RegExp<std::string>& _val) {
return _val.getURegExp();
}
template<> std::u32string to_u32string<etk::RegExp<std::u32string>>(const etk::RegExp<std::u32string>& _val) {
return _val.getURegExp();
}
template<> bool from_string<etk::RegExp<std::string>>(etk::RegExp<std::string>& _variableRet, const std::u32string& _value) {
_variableRet.compile(_value);
return true;
}
template<> bool from_string<etk::RegExp<std::u32string>>(etk::RegExp<std::u32string>& _variableRet, const std::u32string& _value) {
_variableRet.compile(_value);
return true;
}
template<> bool from_string<etk::RegExp<std::string>>(etk::RegExp<std::string>& _variableRet, const std::string& _value) {
_variableRet.compile(_value);
return true;
}
template<> bool from_string<etk::RegExp<std::u32string>>(etk::RegExp<std::u32string>& _variableRet, const std::string& _value) {
_variableRet.compile(_value);
return true;
}
};

View File

@ -362,91 +362,87 @@ namespace etk {
TK_VERBOSE("Parse : \"" << _str << "\" ==> " << *this);
}
template<> std::string to_string<vec2>(const vec2& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ")";
return str;
}
template<> std::u32string to_u32string<vec2>(const vec2& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> std::string to_string<ivec2>(const ivec2& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ")";
return str;
}
template<> std::u32string to_u32string<ivec2>(const ivec2& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> std::string to_string<uivec2>(const uivec2& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ")";
return str;
}
template<> std::u32string to_u32string<uivec2>(const uivec2& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> std::string to_string<bvec2>(const bvec2& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ")";
return str;
}
template<> std::u32string to_u32string<bvec2>(const bvec2& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> bool from_string<vec2>(vec2& _variableRet, const std::string& _value) {
_variableRet = vec2(_value);
return true;
}
template<> bool from_string<vec2>(vec2& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> bool from_string<ivec2>(ivec2& _variableRet, const std::string& _value) {
_variableRet = ivec2(_value);
return true;
}
template<> bool from_string<ivec2>(ivec2& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> bool from_string<uivec2>(uivec2& _variableRet, const std::string& _value) {
_variableRet = uivec2(_value);
return true;
}
template<> bool from_string<uivec2>(uivec2& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> bool from_string<bvec2>(bvec2& _variableRet, const std::string& _value) {
_variableRet = bvec2(_value);
return true;
}
template<> bool from_string<bvec2>(bvec2& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
};
template<> std::string etk::to_string<vec2>(const vec2& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ")";
return str;
}
template<> std::u32string etk::to_u32string<vec2>(const vec2& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> std::string etk::to_string<ivec2>(const ivec2& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ")";
return str;
}
template<> std::u32string etk::to_u32string<ivec2>(const ivec2& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> std::string etk::to_string<uivec2>(const uivec2& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ")";
return str;
}
template<> std::u32string etk::to_u32string<uivec2>(const uivec2& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> std::string etk::to_string<bvec2>(const bvec2& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ")";
return str;
}
template<> std::u32string etk::to_u32string<bvec2>(const bvec2& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> bool etk::from_string<vec2>(vec2& _variableRet, const std::string& _value) {
_variableRet = vec2(_value);
return true;
}
template<> bool etk::from_string<vec2>(vec2& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> bool etk::from_string<ivec2>(ivec2& _variableRet, const std::string& _value) {
_variableRet = ivec2(_value);
return true;
}
template<> bool etk::from_string<ivec2>(ivec2& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> bool etk::from_string<uivec2>(uivec2& _variableRet, const std::string& _value) {
_variableRet = uivec2(_value);
return true;
}
template<> bool etk::from_string<uivec2>(uivec2& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> bool etk::from_string<bvec2>(bvec2& _variableRet, const std::string& _value) {
_variableRet = bvec2(_value);
return true;
}
template<> bool etk::from_string<bvec2>(bvec2& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}

View File

@ -110,235 +110,236 @@ vec3 quaternionToEulerXYZ(const btQuaternion& _quat) {
atan2(2.0*(xxx*yyy + zzz*www), (xxx2-yyy2-zzz2+www2) ) );
}
template<> std::string etk::to_string<vec3>(const vec3& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ",";
str += etk::to_string(_obj.z());
str += ")";
return str;
}
template<> std::u32string etk::to_u32string<vec3>(const vec3& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> std::string etk::to_string<ivec3>(const ivec3& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ",";
str += etk::to_string(_obj.z());
str += ")";
return str;
}
template<> std::u32string etk::to_u32string<ivec3>(const ivec3& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> std::string etk::to_string<uivec3>(const uivec3& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ",";
str += etk::to_string(_obj.z());
str += ")";
return str;
}
template<> std::u32string etk::to_u32string<uivec3>(const uivec3& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> std::string etk::to_string<bvec3>(const bvec3& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ",";
str += etk::to_string(_obj.z());
str += ")";
return str;
}
template<> std::u32string etk::to_u32string<bvec3>(const bvec3& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> bool etk::from_string<vec3>(vec3& _variableRet, const std::string& _value) {
float floats[3];
floats[0] = 0;
floats[1] = 0;
floats[2] = 0;
// copy to permit to modify it :
std::string tmpStr = _value;
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
namespace etk {
template<> std::string to_string<vec3>(const vec3& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ",";
str += etk::to_string(_obj.z());
str += ")";
return str;
}
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
template<> std::u32string to_u32string<vec3>(const vec3& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[0] = etk::string_to_float(tmpStr);
floats[1] = floats[0];
floats[2] = floats[1];
} else {
floats[0] = etk::string_to_float(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
posComa = tmpStr.find(',');
template<> std::string to_string<ivec3>(const ivec3& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ",";
str += etk::to_string(_obj.z());
str += ")";
return str;
}
template<> std::u32string to_u32string<ivec3>(const ivec3& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> std::string to_string<uivec3>(const uivec3& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ",";
str += etk::to_string(_obj.z());
str += ")";
return str;
}
template<> std::u32string to_u32string<uivec3>(const uivec3& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> std::string to_string<bvec3>(const bvec3& _obj) {
std::string str;
str = "(";
str += etk::to_string(_obj.x());
str += ",";
str += etk::to_string(_obj.y());
str += ",";
str += etk::to_string(_obj.z());
str += ")";
return str;
}
template<> std::u32string to_u32string<bvec3>(const bvec3& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> bool from_string<vec3>(vec3& _variableRet, const std::string& _value) {
float floats[3];
floats[0] = 0;
floats[1] = 0;
floats[2] = 0;
// copy to permit to modify it :
std::string tmpStr = _value;
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[1] = etk::string_to_float(tmpStr);
floats[0] = etk::string_to_float(tmpStr);
floats[1] = floats[0];
floats[2] = floats[1];
} else {
floats[1] = etk::string_to_float(std::string(tmpStr, 0, posComa));
floats[0] = etk::string_to_float(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
floats[2] = etk::string_to_float(tmpStr);
posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[1] = etk::string_to_float(tmpStr);
floats[2] = floats[1];
} else {
floats[1] = etk::string_to_float(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
floats[2] = etk::string_to_float(tmpStr);
}
}
_variableRet.setValue(floats[0], floats[1], floats[2]);
TK_VERBOSE("Parse : '" << _value << "' ==> " << _variableRet);
return true;
}
_variableRet.setValue(floats[0], floats[1], floats[2]);
TK_VERBOSE("Parse : '" << _value << "' ==> " << _variableRet);
return true;
}
template<> bool etk::from_string<vec3>(vec3& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> bool etk::from_string<ivec3>(ivec3& _variableRet, const std::string& _value) {
int32_t floats[3];
floats[0] = 0;
floats[1] = 0;
floats[2] = 0;
// copy to permit to modify it :
std::string tmpStr = _value;
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
template<> bool from_string<vec3>(vec3& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[0] = etk::string_to_int32_t(tmpStr);
floats[1] = floats[0];
floats[2] = floats[1];
} else {
floats[0] = etk::string_to_int32_t(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
posComa = tmpStr.find(',');
template<> bool from_string<ivec3>(ivec3& _variableRet, const std::string& _value) {
int32_t floats[3];
floats[0] = 0;
floats[1] = 0;
floats[2] = 0;
// copy to permit to modify it :
std::string tmpStr = _value;
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[1] = etk::string_to_int32_t(tmpStr);
floats[0] = etk::string_to_int32_t(tmpStr);
floats[1] = floats[0];
floats[2] = floats[1];
} else {
floats[1] = etk::string_to_int32_t(std::string(tmpStr, 0, posComa));
floats[0] = etk::string_to_int32_t(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
floats[2] = etk::string_to_int32_t(tmpStr);
posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[1] = etk::string_to_int32_t(tmpStr);
floats[2] = floats[1];
} else {
floats[1] = etk::string_to_int32_t(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
floats[2] = etk::string_to_int32_t(tmpStr);
}
}
_variableRet.setValue(floats[0], floats[1], floats[2]);
TK_VERBOSE("Parse : '" << _value << "' ==> " << _variableRet);
return true;
}
_variableRet.setValue(floats[0], floats[1], floats[2]);
TK_VERBOSE("Parse : '" << _value << "' ==> " << _variableRet);
return true;
}
template<> bool etk::from_string<ivec3>(ivec3& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> bool etk::from_string<uivec3>(uivec3& _variableRet, const std::string& _value) {
uint32_t floats[3];
floats[0] = 0;
floats[1] = 0;
floats[2] = 0;
// copy to permit to modify it :
std::string tmpStr = _value;
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
template<> bool from_string<ivec3>(ivec3& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[0] = etk::string_to_int32_t(tmpStr);
floats[1] = floats[0];
floats[2] = floats[1];
} else {
floats[0] = etk::string_to_int32_t(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
posComa = tmpStr.find(',');
template<> bool from_string<uivec3>(uivec3& _variableRet, const std::string& _value) {
uint32_t floats[3];
floats[0] = 0;
floats[1] = 0;
floats[2] = 0;
// copy to permit to modify it :
std::string tmpStr = _value;
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[1] = etk::string_to_int32_t(tmpStr);
floats[0] = etk::string_to_int32_t(tmpStr);
floats[1] = floats[0];
floats[2] = floats[1];
} else {
floats[1] = etk::string_to_int32_t(std::string(tmpStr, 0, posComa));
floats[0] = etk::string_to_int32_t(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
floats[2] = etk::string_to_int32_t(tmpStr);
posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[1] = etk::string_to_int32_t(tmpStr);
floats[2] = floats[1];
} else {
floats[1] = etk::string_to_int32_t(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
floats[2] = etk::string_to_int32_t(tmpStr);
}
}
_variableRet.setValue(floats[0], floats[1], floats[2]);
TK_VERBOSE("Parse : '" << _value << "' ==> " << _variableRet);
return true;
}
_variableRet.setValue(floats[0], floats[1], floats[2]);
TK_VERBOSE("Parse : '" << _value << "' ==> " << _variableRet);
return true;
}
template<> bool etk::from_string<uivec3>(uivec3& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> bool etk::from_string<bvec3>(bvec3& _variableRet, const std::string& _value) {
bool floats[3];
floats[0] = false;
floats[1] = false;
floats[2] = false;
// copy to permit to modify it :
std::string tmpStr = _value;
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
template<> bool from_string<uivec3>(uivec3& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[0] = etk::string_to_bool(tmpStr);
floats[1] = floats[0];
floats[2] = floats[1];
} else {
floats[0] = etk::string_to_bool(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
posComa = tmpStr.find(',');
template<> bool from_string<bvec3>(bvec3& _variableRet, const std::string& _value) {
bool floats[3];
floats[0] = false;
floats[1] = false;
floats[2] = false;
// copy to permit to modify it :
std::string tmpStr = _value;
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[1] = etk::string_to_bool(tmpStr);
floats[0] = etk::string_to_bool(tmpStr);
floats[1] = floats[0];
floats[2] = floats[1];
} else {
floats[1] = etk::string_to_bool(std::string(tmpStr, 0, posComa));
floats[0] = etk::string_to_bool(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
floats[2] = etk::string_to_bool(tmpStr);
posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
// no coma ...
// in every case, we parse the first element :
floats[1] = etk::string_to_bool(tmpStr);
floats[2] = floats[1];
} else {
floats[1] = etk::string_to_bool(std::string(tmpStr, 0, posComa));
tmpStr.erase(0,posComa+1);
floats[2] = etk::string_to_bool(tmpStr);
}
}
_variableRet.setValue(floats[0], floats[1], floats[2]);
TK_VERBOSE("Parse : '" << _value << "' ==> " << _variableRet);
return true;
}
_variableRet.setValue(floats[0], floats[1], floats[2]);
TK_VERBOSE("Parse : '" << _value << "' ==> " << _variableRet);
return true;
}
template<> bool etk::from_string<bvec3>(bvec3& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> bool from_string<bvec3>(bvec3& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
};

View File

@ -230,89 +230,89 @@ bool utf8::theoricFirst(const char _input) {
#undef __class__
#define __class__ "etk"
template<> std::string etk::to_string<std::u32string>(const std::u32string& _input) {
std::string out;
for (size_t iii=0; iii<_input.size(); ++iii) {
namespace etk {
template<> std::string to_string<std::u32string>(const std::u32string& _input) {
std::string out;
for (size_t iii=0; iii<_input.size(); ++iii) {
char output[10];
u32char::convertUtf8(_input[iii], output);
out += output;
}
return out;
}
template<> std::string to_string<char32_t>(const char32_t& _input) {
std::string out;
char output[10];
u32char::convertUtf8(_input[iii], output);
u32char::convertUtf8(_input, output);
out += output;
return out;
}
return out;
}
template<> std::string etk::to_string<char32_t>(const char32_t& _input) {
std::string out;
char output[10];
u32char::convertUtf8(_input, output);
out += output;
return out;
}
template<> std::string etk::to_string<std::string>(const std::string& _val) {
return _val;
}
template<> std::string etk::to_string<bool>(const bool& _val) {
if (_val == true) {
return "true";
template<> std::string to_string<std::string>(const std::string& _val) {
return _val;
}
return "false";
}
template<> std::string etk::to_string<int8_t>(const int8_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%d", _val);
return tmpVal;
}
template<> std::string etk::to_string<int16_t>(const int16_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%d", _val);
return tmpVal;
}
template<> std::string etk::to_string<int32_t>(const int32_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%d", _val);
return tmpVal;
}
template<> std::string etk::to_string<int64_t>(const int64_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%ld", _val);
return tmpVal;
}
template<> std::string etk::to_string<uint8_t>(const uint8_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%u", _val);
return tmpVal;
}
template<> std::string etk::to_string<uint16_t>(const uint16_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%u", _val);
return tmpVal;
}
template<> std::string etk::to_string<uint32_t>(const uint32_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%u", _val);
return tmpVal;
}
template<> std::string etk::to_string<uint64_t>(const uint64_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%lu", _val);
return tmpVal;
}
template<> std::string etk::to_string<float>(const float& _val) {
char tmpVal[256];
sprintf(tmpVal, "%f", _val);
return tmpVal;
}
template<> std::string etk::to_string<double>(const double& _val) {
char tmpVal[256];
sprintf(tmpVal, "%f", _val);
return tmpVal;
}
template<> std::string etk::to_string<long double>(const long double& _val) {
char tmpVal[256];
sprintf(tmpVal, "%Lf", _val);
return tmpVal;
}
template<> std::string to_string<bool>(const bool& _val) {
if (_val == true) {
return "true";
}
return "false";
}
template<> std::string to_string<int8_t>(const int8_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%d", _val);
return tmpVal;
}
template<> std::string to_string<int16_t>(const int16_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%d", _val);
return tmpVal;
}
template<> std::string to_string<int32_t>(const int32_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%d", _val);
return tmpVal;
}
template<> std::string to_string<int64_t>(const int64_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%ld", _val);
return tmpVal;
}
template<> std::string to_string<uint8_t>(const uint8_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%u", _val);
return tmpVal;
}
template<> std::string to_string<uint16_t>(const uint16_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%u", _val);
return tmpVal;
}
template<> std::string to_string<uint32_t>(const uint32_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%u", _val);
return tmpVal;
}
template<> std::string to_string<uint64_t>(const uint64_t& _val) {
char tmpVal[256];
sprintf(tmpVal, "%lu", _val);
return tmpVal;
}
template<> std::string to_string<float>(const float& _val) {
char tmpVal[256];
sprintf(tmpVal, "%f", _val);
return tmpVal;
}
template<> std::string to_string<double>(const double& _val) {
char tmpVal[256];
sprintf(tmpVal, "%f", _val);
return tmpVal;
}
template<> std::string to_string<long double>(const long double& _val) {
char tmpVal[256];
sprintf(tmpVal, "%Lf", _val);
return tmpVal;
}
};
static std::u32string transform_to_u32string(const char* _input) {
if (_input == NULL) {
@ -365,48 +365,53 @@ static std::u32string transform_to_u32string(const char* _input) {
}
return out;
}
template<> std::u32string etk::to_u32string<char*>(char* const & _input) {
return transform_to_u32string(_input);
}
template<> std::u32string etk::to_u32string<std::string>(const std::string& _input) {
return transform_to_u32string(_input.c_str());
}
template<> std::u32string etk::to_u32string<int8_t>(const int8_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string etk::to_u32string<int16_t>(const int16_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string etk::to_u32string<int32_t>(const int32_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string etk::to_u32string<int64_t>(const int64_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string etk::to_u32string<uint8_t>(const uint8_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string etk::to_u32string<uint16_t>(const uint16_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string etk::to_u32string<uint32_t>(const uint32_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string etk::to_u32string<uint64_t>(const uint64_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string etk::to_u32string<float>(const float& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string etk::to_u32string<double>(const double& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string etk::to_u32string<long double>(const long double& _val) {
return etk::to_u32string(etk::to_string(_val));
namespace etk {
template<> std::u32string to_u32string<char*>(char* const & _input) {
return transform_to_u32string(_input);
}
template<> std::u32string to_u32string<std::string>(const std::string& _input) {
return transform_to_u32string(_input.c_str());
}
template<> std::u32string to_u32string<int8_t>(const int8_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string to_u32string<int16_t>(const int16_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string to_u32string<int32_t>(const int32_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string to_u32string<int64_t>(const int64_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string to_u32string<uint8_t>(const uint8_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string to_u32string<uint16_t>(const uint16_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string to_u32string<uint32_t>(const uint32_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string to_u32string<uint64_t>(const uint64_t& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string to_u32string<float>(const float& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string to_u32string<double>(const double& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string to_u32string<long double>(const long double& _val) {
return etk::to_u32string(etk::to_string(_val));
};
template<> std::u32string to_u32string<bool>(const bool& _val) {
if (_val == true) {
return U"true";
}
return U"false";
}
};
bool etk::string_to_bool(const std::u32string& _str) {
@ -463,13 +468,6 @@ bool etk::string_to_bool(const std::string& _str) {
return false;
}
template<> std::u32string etk::to_u32string<bool>(const bool& _val) {
if (_val == true) {
return U"true";
}
return U"false";
}
bool etk::compare_no_case(const std::u32string& _obj, const std::u32string& _val) {
if (_val.size() != _obj.size()) {
return false;
@ -884,113 +882,113 @@ void etk::sort(std::vector<std::u32string *> &_list) {
_list.insert(_list.begin()+findPos, tmpList[iii]);
}
}
template<> bool etk::from_string<std::u32string>(std::u32string& _variableRet, const std::string& _value) {
_variableRet = etk::to_u32string(_value);
return true;
}
template<> bool etk::from_string<std::string>(std::string& _variableRet, const std::string& _value) {
_variableRet = _value;
return true;
}
template<> bool etk::from_string<int8_t>(int8_t& _variableRet, const std::string& _value) {
_variableRet = string_to_int8_t(_value);
return true;
}
template<> bool etk::from_string<int16_t>(int16_t& _variableRet, const std::string& _value) {
_variableRet = string_to_int16_t(_value);
return true;
}
template<> bool etk::from_string<int32_t>(int32_t& _variableRet, const std::string& _value) {
_variableRet = string_to_int32_t(_value);
return true;
}
template<> bool etk::from_string<int64_t>(int64_t& _variableRet, const std::string& _value) {
_variableRet = string_to_int64_t(_value);
return true;
}
template<> bool etk::from_string<uint8_t>(uint8_t& _variableRet, const std::string& _value) {
_variableRet = string_to_uint8_t(_value);
return true;
}
template<> bool etk::from_string<uint16_t>(uint16_t& _variableRet, const std::string& _value) {
_variableRet = string_to_uint16_t(_value);
return true;
}
template<> bool etk::from_string<uint32_t>(uint32_t& _variableRet, const std::string& _value) {
_variableRet = string_to_uint32_t(_value);
return true;
}
template<> bool etk::from_string<uint64_t>(uint64_t& _variableRet, const std::string& _value) {
_variableRet = string_to_uint64_t(_value);
return true;
}
template<> bool etk::from_string<float>(float& _variableRet, const std::string& _value) {
_variableRet = string_to_float(_value);
return true;
}
template<> bool etk::from_string<double>(double& _variableRet, const std::string& _value) {
_variableRet = string_to_double(_value);
return true;
}
template<> bool etk::from_string<long double>(long double& _variableRet, const std::string& _value) {
_variableRet = string_to_long_double(_value);
return true;
}
template<> bool etk::from_string<bool>(bool& _variableRet, const std::string& _value) {
_variableRet = string_to_bool(_value);
return true;
}
template<> bool etk::from_string<int8_t>(int8_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_int8_t(_value);
return true;
}
template<> bool etk::from_string<int16_t>(int16_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_int16_t(_value);
return true;
}
template<> bool etk::from_string<int32_t>(int32_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_int32_t(_value);
return true;
}
template<> bool etk::from_string<int64_t>(int64_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_int64_t(_value);
return true;
}
template<> bool etk::from_string<uint8_t>(uint8_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_uint8_t(_value);
return true;
}
template<> bool etk::from_string<uint16_t>(uint16_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_uint16_t(_value);
return true;
}
template<> bool etk::from_string<uint32_t>(uint32_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_uint32_t(_value);
return true;
}
template<> bool etk::from_string<uint64_t>(uint64_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_uint64_t(_value);
return true;
}
template<> bool etk::from_string<float>(float& _variableRet, const std::u32string& _value) {
_variableRet = string_to_float(_value);
return true;
}
template<> bool etk::from_string<double>(double& _variableRet, const std::u32string& _value) {
_variableRet = string_to_double(_value);
return true;
}
template<> bool etk::from_string<long double>(long double& _variableRet, const std::u32string& _value) {
_variableRet = string_to_long_double(_value);
return true;
}
template<> bool etk::from_string<bool>(bool& _variableRet, const std::u32string& _value) {
_variableRet = string_to_bool(_value);
return true;
}
namespace etk {
template<> bool from_string<std::u32string>(std::u32string& _variableRet, const std::string& _value) {
_variableRet = etk::to_u32string(_value);
return true;
}
template<> bool from_string<std::string>(std::string& _variableRet, const std::string& _value) {
_variableRet = _value;
return true;
}
template<> bool from_string<int8_t>(int8_t& _variableRet, const std::string& _value) {
_variableRet = string_to_int8_t(_value);
return true;
}
template<> bool from_string<int16_t>(int16_t& _variableRet, const std::string& _value) {
_variableRet = string_to_int16_t(_value);
return true;
}
template<> bool from_string<int32_t>(int32_t& _variableRet, const std::string& _value) {
_variableRet = string_to_int32_t(_value);
return true;
}
template<> bool from_string<int64_t>(int64_t& _variableRet, const std::string& _value) {
_variableRet = string_to_int64_t(_value);
return true;
}
template<> bool from_string<uint8_t>(uint8_t& _variableRet, const std::string& _value) {
_variableRet = string_to_uint8_t(_value);
return true;
}
template<> bool from_string<uint16_t>(uint16_t& _variableRet, const std::string& _value) {
_variableRet = string_to_uint16_t(_value);
return true;
}
template<> bool from_string<uint32_t>(uint32_t& _variableRet, const std::string& _value) {
_variableRet = string_to_uint32_t(_value);
return true;
}
template<> bool from_string<uint64_t>(uint64_t& _variableRet, const std::string& _value) {
_variableRet = string_to_uint64_t(_value);
return true;
}
template<> bool from_string<float>(float& _variableRet, const std::string& _value) {
_variableRet = string_to_float(_value);
return true;
}
template<> bool from_string<double>(double& _variableRet, const std::string& _value) {
_variableRet = string_to_double(_value);
return true;
}
template<> bool from_string<long double>(long double& _variableRet, const std::string& _value) {
_variableRet = string_to_long_double(_value);
return true;
}
template<> bool from_string<bool>(bool& _variableRet, const std::string& _value) {
_variableRet = string_to_bool(_value);
return true;
}
template<> bool from_string<int8_t>(int8_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_int8_t(_value);
return true;
}
template<> bool from_string<int16_t>(int16_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_int16_t(_value);
return true;
}
template<> bool from_string<int32_t>(int32_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_int32_t(_value);
return true;
}
template<> bool from_string<int64_t>(int64_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_int64_t(_value);
return true;
}
template<> bool from_string<uint8_t>(uint8_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_uint8_t(_value);
return true;
}
template<> bool from_string<uint16_t>(uint16_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_uint16_t(_value);
return true;
}
template<> bool from_string<uint32_t>(uint32_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_uint32_t(_value);
return true;
}
template<> bool from_string<uint64_t>(uint64_t& _variableRet, const std::u32string& _value) {
_variableRet = string_to_uint64_t(_value);
return true;
}
template<> bool from_string<float>(float& _variableRet, const std::u32string& _value) {
_variableRet = string_to_float(_value);
return true;
}
template<> bool from_string<double>(double& _variableRet, const std::u32string& _value) {
_variableRet = string_to_double(_value);
return true;
}
template<> bool from_string<long double>(long double& _variableRet, const std::u32string& _value) {
_variableRet = string_to_long_double(_value);
return true;
}
template<> bool from_string<bool>(bool& _variableRet, const std::u32string& _value) {
_variableRet = string_to_bool(_value);
return true;
}
};
std::ostream& std::operator <<(std::ostream& _os, const std::string& _obj) {