[DEV] android update

This commit is contained in:
Edouard DUPIN 2013-11-19 21:07:55 +01:00
parent a130375b47
commit 4de67305e4
6 changed files with 66 additions and 9 deletions

View File

@ -215,6 +215,53 @@ std::string std::to_string(bool _val) {
} }
return "false"; return "false";
} }
#ifdef __TARGET_OS__Android
std::string std::to_string(int _val) {
char tmpVal[256];
sprintf(tmpVal, "%d", _val);
return tmpVal;
}
std::string std::to_string(long _val) {
char tmpVal[256];
sprintf(tmpVal, "%ld", _val);
return tmpVal;
}
std::string std::to_string(long long _val) {
char tmpVal[256];
sprintf(tmpVal, "%lld", _val);
return tmpVal;
}
std::string std::to_string(unsigned _val) {
char tmpVal[256];
sprintf(tmpVal, "%u", _val);
return tmpVal;
}
std::string std::to_string(unsigned long _val) {
char tmpVal[256];
sprintf(tmpVal, "%lu", _val);
return tmpVal;
}
std::string std::to_string(unsigned long long _val) {
char tmpVal[256];
sprintf(tmpVal, "%llu", _val);
return tmpVal;
}
std::string std::to_string(float _val) {
char tmpVal[256];
sprintf(tmpVal, "%f", _val);
return tmpVal;
}
std::string std::to_string(double _val) {
char tmpVal[256];
sprintf(tmpVal, "%d", _val);
return tmpVal;
}
std::string std::to_string(long double _val) {
char tmpVal[256];
sprintf(tmpVal, "%ld", _val);
return tmpVal;
}
#endif
std::u32string to_u32string(bool _val) { std::u32string to_u32string(bool _val) {
if (_val == true) { if (_val == true) {

View File

@ -10,9 +10,10 @@
#define __ETK_USTRING_H__ #define __ETK_USTRING_H__
#include <etk/debug.h> #include <etk/debug.h>
#include <string>
#include <vector> #include <vector>
#include <sstream> #include <sstream>
#include <iostream>
#include <string>
namespace etk { namespace etk {
@ -41,7 +42,15 @@ 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 #ifdef __TARGET_OS__Android
std::string to_string(int _val);
std::string to_string(long _val);
std::string to_string(long long _val);
std::string to_string(unsigned _val);
std::string to_string(unsigned long _val);
std::string to_string(unsigned long long _val);
std::string to_string(float _val);
std::string to_string(double _val);
std::string to_string(long double _val);
#endif #endif
} }
std::u32string to_u32string(bool _val); std::u32string to_u32string(bool _val);

View File

View File

@ -58,7 +58,7 @@ void debug::displayTime(void)
#ifdef __TARGET_OS__Android #ifdef __TARGET_OS__Android
enum etk::logLevel g_requestedLevel = etk::logLevelError; enum etk::logLevel g_requestedLevel = etk::logLevelDebug;
#else #else
enum etk::logLevel g_requestedLevel = etk::logLevelWarning; enum etk::logLevel g_requestedLevel = etk::logLevelWarning;
#endif #endif

View File

@ -257,7 +257,7 @@ void etk::initDefaultFolder(const char* _applName) {
char * basicPath = getenv("HOME"); char * basicPath = getenv("HOME");
if (NULL == basicPath) { if (NULL == basicPath) {
TK_ERROR("ERROR while trying to get the path of the home folder"); TK_WARNING("ERROR while trying to get the path of the home folder");
#if defined(__TARGET_OS__Windows) #if defined(__TARGET_OS__Windows)
baseFolderHome = "c:/"; baseFolderHome = "c:/";
#elif defined(__TARGET_OS__Android) #elif defined(__TARGET_OS__Android)
@ -709,12 +709,12 @@ void etk::FSNode::generateFileSystemPath(void) {
} else if (themeName != "default") { } else if (themeName != "default") {
// Selected theme : // Selected theme :
// check in the user data : // check in the user data :
m_systemFileName = baseFolderDataUser + "theme/" + themeName + "/" + basicName; m_systemFileName = simplifyPath(baseFolderDataUser + "theme/" + themeName + "/" + basicName);
if (directCheckFile(m_systemFileName) == true) { if (directCheckFile(m_systemFileName) == true) {
return; return;
} }
// check in the Appl data : // check in the Appl data :
m_systemFileName = baseFolderData + "theme/" + themeName + "/" + basicName; m_systemFileName = simplifyPath(baseFolderData + "theme/" + themeName + "/" + basicName);
if (directCheckFile(m_systemFileName, true) == true) { if (directCheckFile(m_systemFileName, true) == true) {
m_type = etk::FSN_TYPE_THEME_DATA; m_type = etk::FSN_TYPE_THEME_DATA;
return; return;
@ -723,12 +723,12 @@ void etk::FSNode::generateFileSystemPath(void) {
themeName = "default"; themeName = "default";
// default theme : // default theme :
// check in the user data : // check in the user data :
m_systemFileName = baseFolderDataUser + "theme/" + themeName + "/" + basicName; m_systemFileName = simplifyPath(baseFolderDataUser + "theme/" + themeName + "/" + basicName);
if (true==directCheckFile(m_systemFileName)) { if (true==directCheckFile(m_systemFileName)) {
return; return;
} }
// check in the Appl data : In every case we return this one ... // check in the Appl data : In every case we return this one ...
m_systemFileName = baseFolderData + "theme/" + themeName + "/" + basicName; m_systemFileName = simplifyPath(baseFolderData + "theme/" + themeName + "/" + basicName);
if (true==directCheckFile(m_systemFileName, true)) { if (true==directCheckFile(m_systemFileName, true)) {
m_type = etk::FSN_TYPE_THEME_DATA; m_type = etk::FSN_TYPE_THEME_DATA;
return; return;

View File

@ -8,7 +8,7 @@
#ifndef __ETK_TYPES_H__ #ifndef __ETK_TYPES_H__
#define __ETK_TYPES_H__ #define __ETK_TYPES_H__
/*
#ifdef __TARGET_OS__Android #ifdef __TARGET_OS__Android
// NOTE : This is for compatibility with the C++ stdlib (missing this declaration on android ... // NOTE : This is for compatibility with the C++ stdlib (missing this declaration on android ...
namespace std { namespace std {
@ -19,6 +19,7 @@
#include <wchar.h> #include <wchar.h>
#include <stdio.h> #include <stdio.h>
#endif #endif
*/
#include <iostream> #include <iostream>
#include <stdlib.h> #include <stdlib.h>