[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; 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) etk::CCout& etk::CCout::operator << (int8_t _t)
{ {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%d", _t); snprintf(tmp, MAX_LOG_SIZE_TMP, "%d", _t);

View File

@ -31,7 +31,8 @@ namespace etk {
public: public:
CCout(void); CCout(void);
~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 << (int8_t _t);
CCout& operator << (int16_t _t); CCout& operator << (int16_t _t);
CCout& operator << (int32_t _t); CCout& operator << (int32_t _t);

View File

@ -215,7 +215,7 @@ std::string std::to_string(bool _val) {
} }
return "false"; return "false";
} }
#ifdef __TARGET_OS__Android #if (defined(__TARGET_OS__Android) || defined(__TARGET_OS__MacOs))
std::string std::to_string(int _val) { std::string std::to_string(int _val) {
char tmpVal[256]; char tmpVal[256];
sprintf(tmpVal, "%d", _val); sprintf(tmpVal, "%d", _val);
@ -253,12 +253,12 @@ std::string std::to_string(bool _val) {
} }
std::string std::to_string(double _val) { std::string std::to_string(double _val) {
char tmpVal[256]; char tmpVal[256];
sprintf(tmpVal, "%d", _val); sprintf(tmpVal, "%f", _val);
return tmpVal; return tmpVal;
} }
std::string std::to_string(long double _val) { std::string std::to_string(long double _val) {
char tmpVal[256]; char tmpVal[256];
sprintf(tmpVal, "%ld", _val); sprintf(tmpVal, "%lf", _val);
return tmpVal; return tmpVal;
} }
#endif #endif
@ -530,10 +530,10 @@ std::vector<std::string> string_split(const std::string& _input, char _val) {
return list; 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 std::stod(const std::string& _str, size_t* _idx) {
double ret = 0; double ret = 0;
sscanf(_str.c_str(), "%lf", &ret); sscanf(_str.c_str(), "%Lf", &ret);
return 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 std::stold(const std::string& _str, size_t* _idx) {
long double ret = 0; long double ret = 0;
sscanf(_str.c_str(), "%llf", &ret); sscanf(_str.c_str(), "%Lf", &ret);
return 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 { namespace std {
std::string to_string(bool _val); 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(int _val);
std::string to_string(long _val); std::string to_string(long _val);
std::string to_string(long 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); std::u32string to_u32string(long double _val);
namespace std { 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); double stod(const std::string& _str, size_t* _idx = 0);
float stof(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); 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; m_floats[1] = false;
// copy to permit to modify it : // copy to permit to modify it :
std::string tmpStr = _str; std::string tmpStr = _str;
if (tmpStr.front() == '(') { if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin()); tmpStr.erase(tmpStr.begin());
} }
if (tmpStr.back() == ')') { if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.pop_back(); tmpStr.erase(tmpStr.end()-1);
} }
size_t posComa = tmpStr.find(','); size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) { if (posComa == std::string::npos) {
@ -98,11 +98,11 @@ namespace etk {
m_floats[1] = false; m_floats[1] = false;
// copy to permit to modify it : // copy to permit to modify it :
std::u32string tmpStr = _str; std::u32string tmpStr = _str;
if (tmpStr.front() == '(') { if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin()); tmpStr.erase(tmpStr.begin());
} }
if (tmpStr.back() == ')') { if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.pop_back(); tmpStr.erase(tmpStr.end()-1);
} }
size_t posComa = tmpStr.find(','); size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) { if (posComa == std::string::npos) {
@ -142,11 +142,11 @@ namespace etk {
m_floats[1] = 0; m_floats[1] = 0;
// copy to permit to modify it : // copy to permit to modify it :
std::string tmpStr = _str; std::string tmpStr = _str;
if (tmpStr.front() == '(') { if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin()); tmpStr.erase(tmpStr.begin());
} }
if (tmpStr.back() == ')') { if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.pop_back(); tmpStr.erase(tmpStr.end()-1);
} }
size_t posComa = tmpStr.find(','); size_t posComa = tmpStr.find(',');
@ -167,11 +167,11 @@ namespace etk {
m_floats[1] = 0; m_floats[1] = 0;
// copy to permit to modify it : // copy to permit to modify it :
std::u32string tmpStr = _str; std::u32string tmpStr = _str;
if (tmpStr.front() == '(') { if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin()); tmpStr.erase(tmpStr.begin());
} }
if (tmpStr.back() == ')') { if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.pop_back(); tmpStr.erase(tmpStr.end()-1);
} }
size_t posComa = tmpStr.find(','); size_t posComa = tmpStr.find(',');
@ -214,11 +214,11 @@ namespace etk {
m_floats[1] = 0; m_floats[1] = 0;
// copy to permit to modify it : // copy to permit to modify it :
std::string tmpStr = _str; std::string tmpStr = _str;
if (tmpStr.front() == '(') { if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin()); tmpStr.erase(tmpStr.begin());
} }
if (tmpStr.back() == ')') { if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.pop_back(); tmpStr.erase(tmpStr.end()-1);
} }
size_t posComa = tmpStr.find(','); size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) { if (posComa == std::string::npos) {
@ -239,11 +239,11 @@ namespace etk {
m_floats[1] = 0; m_floats[1] = 0;
// copy to permit to modify it : // copy to permit to modify it :
std::u32string tmpStr = _str; std::u32string tmpStr = _str;
if (tmpStr.front() == '(') { if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin()); tmpStr.erase(tmpStr.begin());
} }
if (tmpStr.back() == ')') { if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.pop_back(); tmpStr.erase(tmpStr.end()-1);
} }
size_t posComa = tmpStr.find(','); size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) { if (posComa == std::string::npos) {
@ -283,11 +283,11 @@ namespace etk {
m_floats[1] = 0; m_floats[1] = 0;
// copy to permit to modify it : // copy to permit to modify it :
std::string tmpStr = _str; std::string tmpStr = _str;
if (tmpStr.front() == '(') { if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin()); tmpStr.erase(tmpStr.begin());
} }
if (tmpStr.back() == ')') { if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.pop_back(); tmpStr.erase(tmpStr.end()-1);
} }
size_t posComa = tmpStr.find(','); size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) { if (posComa == std::string::npos) {
@ -307,11 +307,11 @@ namespace etk {
m_floats[1] = 0; m_floats[1] = 0;
// copy to permit to modify it : // copy to permit to modify it :
std::u32string tmpStr = _str; std::u32string tmpStr = _str;
if (tmpStr.front() == '(') { if (tmpStr[0] == '(') {
tmpStr.erase(tmpStr.begin()); tmpStr.erase(tmpStr.begin());
} }
if (tmpStr.back() == ')') { if (tmpStr[tmpStr.size()-1] == ')') {
tmpStr.pop_back(); tmpStr.erase(tmpStr.end()-1);
} }
size_t posComa = tmpStr.find(','); size_t posComa = tmpStr.find(',');
if (posComa == std::string::npos) { if (posComa == std::string::npos) {

View File

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

View File

@ -8,18 +8,7 @@
#ifndef __ETK_TYPES_H__ #ifndef __ETK_TYPES_H__
#define __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 <iostream>
#include <stdlib.h> #include <stdlib.h>
@ -58,5 +47,12 @@
#include <etk/UChar.h> #include <etk/UChar.h>
#include <string>
#ifdef __TARGET_OS__MacOs
namespace std {
typedef std::basic_string<char32_t> u32string;
};
#endif
typedef float float_t; typedef float float_t;
#endif #endif