[DEBUG] Remove some unused element of c++11 in MacOs

This commit is contained in:
Edouard DUPIN 2013-11-28 00:53:41 +01:00
parent 9f47018aa4
commit 216f3a5528
7 changed files with 56 additions and 53 deletions

View File

@ -158,6 +158,12 @@ etk::CCout& etk::CCout::operator << (char32_t _t)
return *this;
}
etk::CCout& etk::CCout::operator << (size_t _t)
{
snprintf(tmp, MAX_LOG_SIZE_TMP, "%lld", (uint64_t)_t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
etk::CCout& etk::CCout::operator << (int8_t _t)
{
snprintf(tmp, MAX_LOG_SIZE_TMP, "%d", _t);

View File

@ -31,7 +31,8 @@ namespace etk {
public:
CCout(void);
~CCout(void);
CCout& operator << (char32_t _t);;
CCout& operator << (char32_t _t);
CCout& operator << (size_t _t);
CCout& operator << (int8_t _t);
CCout& operator << (int16_t _t);
CCout& operator << (int32_t _t);

View File

@ -215,7 +215,7 @@ std::string std::to_string(bool _val) {
}
return "false";
}
#ifdef __TARGET_OS__Android
#if (defined(__TARGET_OS__Android) || defined(__TARGET_OS__MacOs))
std::string std::to_string(int _val) {
char tmpVal[256];
sprintf(tmpVal, "%d", _val);
@ -253,12 +253,12 @@ std::string std::to_string(bool _val) {
}
std::string std::to_string(double _val) {
char tmpVal[256];
sprintf(tmpVal, "%d", _val);
sprintf(tmpVal, "%f", _val);
return tmpVal;
}
std::string std::to_string(long double _val) {
char tmpVal[256];
sprintf(tmpVal, "%ld", _val);
sprintf(tmpVal, "%lf", _val);
return tmpVal;
}
#endif
@ -530,10 +530,10 @@ std::vector<std::string> string_split(const std::string& _input, char _val) {
return list;
}
#ifdef __TARGET_OS__Android
#if (defined(__TARGET_OS__Android) || defined(__TARGET_OS__MacOs))
double std::stod(const std::string& _str, size_t* _idx) {
double ret = 0;
sscanf(_str.c_str(), "%lf", &ret);
sscanf(_str.c_str(), "%Lf", &ret);
return ret;
}
@ -557,7 +557,7 @@ long std::stol(const std::string& _str, size_t* _idx, int _base) {
long double std::stold(const std::string& _str, size_t* _idx) {
long double ret = 0;
sscanf(_str.c_str(), "%llf", &ret);
sscanf(_str.c_str(), "%Lf", &ret);
return ret;
}

View File

@ -41,7 +41,7 @@ template<class T> std::u32string to_u32string(T t, std::ios_base & (*f)(std::ios
}
namespace std {
std::string to_string(bool _val);
#ifdef __TARGET_OS__Android
#if (defined(__TARGET_OS__Android) || defined(__TARGET_OS__MacOs))
std::string to_string(int _val);
std::string to_string(long _val);
std::string to_string(long long _val);
@ -65,7 +65,7 @@ std::u32string to_u32string(double _val);
std::u32string to_u32string(long double _val);
namespace std {
#ifdef __TARGET_OS__Android
#if (defined(__TARGET_OS__Android) || defined(__TARGET_OS__MacOs))
double stod(const std::string& _str, size_t* _idx = 0);
float stof(const std::string& _str, size_t* _idx = 0);
int stoi(const std::string& _str, size_t* _idx = 0, int _base = 10);

View File

@ -74,11 +74,11 @@ namespace etk {
m_floats[1] = false;
// copy to permit to modify it :
std::string tmpStr = _str;
if (tmpStr.front() == '(') {
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr.back() == ')') {
tmpStr.pop_back();
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
@ -98,11 +98,11 @@ namespace etk {
m_floats[1] = false;
// copy to permit to modify it :
std::u32string tmpStr = _str;
if (tmpStr.front() == '(') {
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr.back() == ')') {
tmpStr.pop_back();
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
@ -142,11 +142,11 @@ namespace etk {
m_floats[1] = 0;
// copy to permit to modify it :
std::string tmpStr = _str;
if (tmpStr.front() == '(') {
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr.back() == ')') {
tmpStr.pop_back();
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
@ -167,11 +167,11 @@ namespace etk {
m_floats[1] = 0;
// copy to permit to modify it :
std::u32string tmpStr = _str;
if (tmpStr.front() == '(') {
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr.back() == ')') {
tmpStr.pop_back();
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
@ -214,11 +214,11 @@ namespace etk {
m_floats[1] = 0;
// copy to permit to modify it :
std::string tmpStr = _str;
if (tmpStr.front() == '(') {
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr.back() == ')') {
tmpStr.pop_back();
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
@ -239,11 +239,11 @@ namespace etk {
m_floats[1] = 0;
// copy to permit to modify it :
std::u32string tmpStr = _str;
if (tmpStr.front() == '(') {
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr.back() == ')') {
tmpStr.pop_back();
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
@ -283,11 +283,11 @@ namespace etk {
m_floats[1] = 0;
// copy to permit to modify it :
std::string tmpStr = _str;
if (tmpStr.front() == '(') {
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr.back() == ')') {
tmpStr.pop_back();
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {
@ -307,11 +307,11 @@ namespace etk {
m_floats[1] = 0;
// copy to permit to modify it :
std::u32string tmpStr = _str;
if (tmpStr.front() == '(') {
if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin());
}
if (tmpStr.back() == ')') {
tmpStr.pop_back();
if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.erase(tmpStr.end()-1);
}
size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) {

View File

@ -310,7 +310,7 @@ void etk::initDefaultFolder(const char* _applName) {
// remove bin/applName
baseFolderData = binaryPath;
#ifdef __TARGET_OS__MacOs
baseFolderData += "/../../Resources/";
baseFolderData += "/../Resources/";
#else
baseFolderData += "/../share";
baseFolderData += binaryName;
@ -897,7 +897,7 @@ std::string etk::FSNode::getRelativeFolder(void) const {
case etk::FSN_UNKNOW:
case etk::FSN_FOLDER:
case etk::FSN_LINK:
if (tmppp.back() == '/') {
if (tmppp[tmppp.size()-1] == '/') {
TK_DBG_MODE(" ==> : " << tmppp );
return tmppp;
} else {
@ -988,8 +988,8 @@ uint64_t etk::FSNode::timeCreated(void) const {
std::string etk::FSNode::timeCreatedString(void) const {
time_t tmpVal = (int32_t)m_timeCreate;
std::string tmpTime = ctime(&tmpVal);
if (tmpTime.back() == '\n') {
tmpTime.pop_back();
if (tmpTime[tmpTime.size()-1] == '\n') {
tmpTime.erase(tmpTime.end()-1);
}
return tmpTime;
}
@ -1004,8 +1004,8 @@ uint64_t etk::FSNode::timeModified(void) const {
std::string etk::FSNode::timeModifiedString(void) const {
time_t tmpVal = (int32_t)m_timeModify;
std::string tmpTime = ctime(&tmpVal);
if (tmpTime.back() == '\n') {
tmpTime.pop_back();
if (tmpTime[tmpTime.size()-1] == '\n') {
tmpTime.erase(tmpTime.end()-1);
}
return tmpTime;
}
@ -1020,8 +1020,8 @@ uint64_t etk::FSNode::timeAccessed(void) const {
std::string etk::FSNode::timeAccessedString(void) const {
time_t tmpVal = (int32_t)m_timeAccess;
std::string tmpTime = ctime(&tmpVal);
if (tmpTime.back() == '\n') {
tmpTime.pop_back();
if (tmpTime[tmpTime.size()-1] == '\n') {
tmpTime.erase(tmpTime.end()-1);
}
return tmpTime;
}

View File

@ -8,18 +8,7 @@
#ifndef __ETK_TYPES_H__
#define __ETK_TYPES_H__
/*
#ifdef __TARGET_OS__Android
// NOTE : This is for compatibility with the C++ stdlib (missing this declaration on android ...
namespace std {
typedef struct {
int dummy;
} mbstate_t;
};
#include <wchar.h>
#include <stdio.h>
#endif
*/
#include <iostream>
#include <stdlib.h>
@ -58,5 +47,12 @@
#include <etk/UChar.h>
#include <string>
#ifdef __TARGET_OS__MacOs
namespace std {
typedef std::basic_string<char32_t> u32string;
};
#endif
typedef float float_t;
#endif