[DEV] android build correction

This commit is contained in:
Edouard DUPIN 2013-11-17 20:34:43 +01:00
parent 4f25fd3ddc
commit a130375b47
3 changed files with 52 additions and 1244 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,254 +15,6 @@
#include <sstream> #include <sstream>
namespace etk { namespace etk {
/*
std::u32string to_string(int _val);
std::u32string to_string(long _val);
std::u32string to_string(long long _val);
std::u32string to_string(unsigned _val);
std::u32string to_string(unsigned long _val);
std::u32string to_string(unsigned long long _val);
std::u32string to_string(float _val);
std::u32string to_string(double _val);
std::u32string to_string(long double _val);
*/
//typedef std::u32string UString;
#if 0
class UString {
public:
enum printMode {
printModeBinary,
printModeOctal,
printModeDecimal,
printModeHexadecimal,
printModeString,
};
private :
std::vector<char32_t> m_data; //!< internal data is stored in the Unicode properties ...
public:
// Constructeurs
UString(void);
// destructor :
~UString(void) { };
// recopy operator :
UString(const std::string& _obj);
// single element adding
UString(const bool _inputData, enum printMode _mode=printModeString, bool _preset=false);
UString(char32_t _inputData);
UString(const char* _data, enum unicode::charset _inputCharset);
UString(const float _inputData);
UString(const double _inputData);
UString(const int8_t& _inputData, enum printMode _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) {
set((int64_t)_inputData, _mode, _preset, _leadingZero);
};
UString(const int16_t& _inputData, enum printMode _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) {
set((int64_t)_inputData, _mode, _preset, _leadingZero);
};
UString(const int32_t& _inputData, enum printMode _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) {
set((int64_t)_inputData, _mode, _preset, _leadingZero);
};
UString(const int64_t& _inputData, enum printMode _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) {
set(_inputData, _mode, _preset, _leadingZero);
};
UString(const uint8_t& _inputData, enum printMode _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) {
set((uint64_t)_inputData, _mode, _preset, _leadingZero);
};
UString(const uint16_t& _inputData, enum printMode _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) {
set((uint64_t)_inputData, _mode, _preset, _leadingZero);
};
UString(const uint32_t& _inputData, enum printMode _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) {
set((uint64_t)_inputData, _mode, _preset, _leadingZero);
};
UString(const uint64_t& _inputData, enum printMode _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) {
set(_inputData, _mode, _preset, _leadingZero);
};
// multiple element add
UString(const char32_t* _inputData, int32_t _len = -1);
UString(const char* _inputData, int32_t _len = -1);
UString(const std::vector<char>& _inputData);
UString(const std::vector<int8_t>& _inputData);
UString(const std::vector<char32_t>& _inputData);
// generic setter
void set(const char32_t* _inputData, int32_t _len=-1);
void set(const char* _inputData, int32_t _len=-1);
void set(const std::vector<char>& _inputData);
void set(const std::vector<int8_t>& _inputData);
void set(const std::vector<char32_t>& _inputData);
private:
void setNumber(bool _negative, const uint64_t& _inputData, enum printMode _mode, bool _preset, int32_t _leadingZero);
public:
void set(const int64_t& _inputData, enum printMode _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0);
void set(const uint64_t& _inputData, enum printMode _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0);
/*****************************************************
* = assigment
*****************************************************/
const std::string& operator= (const std::string& _obj );
/*****************************************************
* == operator
*****************************************************/
bool operator== (const std::string& _obj) const;
bool compareNoCase(const std::string& _obj) const;
/*****************************************************
* != operator
*****************************************************/
bool operator!= (const std::string& _obj) const;
/*****************************************************
* > < >= <= operator
*****************************************************/
bool operator> (const std::string& _obj) const;
bool operator>= (const std::string& _obj) const;
bool operator< (const std::string& _obj) const;
bool operator<= (const std::string& _obj) const;
/*****************************************************
* += operator
*****************************************************/
const std::string& operator+= (const std::string& _obj);
//const std::string& operator+= (char32_t _obj);
/*****************************************************
* + operator
*****************************************************/
std::string operator+ (const std::string &_obj) const;
/*****************************************************
* << operator
*****************************************************/
/*
const std::string& operator <<= (const char input);
const std::string& operator <<= (const int input);
const std::string& operator <<= (const unsigned int input);
*/
/*****************************************************
* >> operator
*****************************************************/
/*****************************************************
* Cout << operator
*****************************************************/
friend etk::CCout& operator <<( etk::CCout& _os,const std::string& _obj);
/*****************************************************
* [] operator
*****************************************************/
char32_t operator[] (esize_t _pos) const {
return m_data[_pos];
}
char32_t operator[] (esize_t _pos) {
return m_data[_pos];
}
/*****************************************************
* toolbox
*****************************************************/
// Start With ...
bool startWith(const std::string& _data, bool _caseSensitive=true) const ;
// End With ...
bool endWith(const std::string& _data, bool _caseSensitive=true) const ;
// Find element
int32_t findForward(const char32_t _data, int32_t _startPos=0) const;
int32_t findBack(const char32_t _data, int32_t _startPos=0x7FFFFFFF) const;
bool isEmpty(void) const;
int32_t size(void) const;
/*****************************************************
* Generic modification function
*****************************************************/
void add(int32_t _currentID, const char* _inputData);
void add(int32_t _currentID, const char32_t* _inputData);
void add(int32_t _currentID, const char32_t _inputData);
void remove(int32_t _currentID, int32_t _len = 1);
void clear(void);
void append(char32_t _inputData);
/**
* @brief Split a string in multiple separate by a specific char
* @param[in] _val Separate value of the string
* @return The list of all sthe string splited.
*/
std::vector<std::string> split(char32_t _val);
/**
* @brief Replace a char with an other
* @param[in] _out element to replace.
* @param[in] _in Element to set.
*/
void replace(char32_t _out, char32_t _in);
std::vector<char32_t> getVector(void);
char32_t* pointer(void) { return &m_data[0]; };
etk::Char c_str(void) const;
void lower(void);
std::string toLower(void) const;
void upper(void);
std::string toUpper(void) const;
/**
* @brief transform tab in \t and '\r' in \r
* @return the new string
*/
//std::string WrapHidenChar(void) const;
// Sting operation :
std::string extract(int32_t _posStart=0, int32_t _posEnd=0x7FFFFFFF) const;
std::string extractLine(int32_t _pos=0) const;
/**
* @brief Transform the current string in an int64_t
* @return the requested int
*/
int64_t toInt64(void) const;
/**
* @brief Transform the current string in an int32_t (if the number is higher, then it is limited at the int32_t max)
* @return the requested int
*/
int32_t toInt32(void) const;
/**
* @brief Transform the current string in an int16_t (if the number is higher, then it is limited at the int16_t max)
* @return the requested int
*/
int16_t toInt16(void) const;
/**
* @brief Transform the current string in an int8_t (if the number is higher, then it is limited at the int8_t max)
* @return the requested int
*/
int8_t toInt8(void) const;
/**
* @brief Transform the current string in an uint64_t
* @return the requested int
*/
uint64_t toUInt64(void) const;
/**
* @brief Transform the current string in an uint32_t (if the number is higher, then it is limited at the uint32_t max)
* @return the requested int
*/
uint32_t toUInt32(void) const;
/**
* @brief Transform the current string in an uint16_t (if the number is higher, then it is limited at the uint16_t max)
* @return the requested int
*/
uint16_t toUInt16(void) const;
/**
* @brief Transform the current string in an uint8_t (if the number is higher, then it is limited at the uint8_t max)
* @return the requested int
*/
uint8_t toUInt8(void) const;
/**
* @brief Transform the current string in a double
* @return the requested double
*/
double toDouble(void) const;
/**
* @brief Transform the current string in a float
* @return the requested float
*/
float toFloat(void) const;
/**
* @brief Transform the current string in a boolean
* @return the requested bool
*/
bool toBool(void) const;
};
#endif
etk::CCout& operator <<(etk::CCout& _os, const std::string& _obj); etk::CCout& operator <<(etk::CCout& _os, const std::string& _obj);
etk::CCout& operator <<(etk::CCout& _os, const std::vector<std::string>& _obj); etk::CCout& operator <<(etk::CCout& _os, const std::vector<std::string>& _obj);
@ -288,6 +40,9 @@ 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
#endif
} }
std::u32string to_u32string(bool _val); std::u32string to_u32string(bool _val);
std::u32string to_u32string(int _val); std::u32string to_u32string(int _val);
@ -300,6 +55,18 @@ std::u32string to_u32string(float _val);
std::u32string to_u32string(double _val); std::u32string to_u32string(double _val);
std::u32string to_u32string(long double _val); std::u32string to_u32string(long double _val);
namespace std {
#ifdef __TARGET_OS__Android
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);
long stol(const std::string& _str, size_t* _idx = 0, int _base = 10);
long double stold(const std::string& _str, size_t* _idx = 0);
long long stoll(const std::string& _str, size_t* _idx = 0, int _base = 10);
unsigned long stoul(const std::string& _str, size_t* _idx = 0, int _base = 10);
unsigned long long stoull(const std::string& _str, size_t* _idx = 0, int _base = 10);
#endif
}
double stod(const std::u32string& _str, size_t* _idx = 0); double stod(const std::u32string& _str, size_t* _idx = 0);
float stof(const std::u32string& _str, size_t* _idx = 0); float stof(const std::u32string& _str, size_t* _idx = 0);
int stoi(const std::u32string& _str, size_t* _idx = 0, int _base = 10); int stoi(const std::u32string& _str, size_t* _idx = 0, int _base = 10);

View File

@ -120,7 +120,7 @@ static std::string baseRunPath = "/";
#ifdef __TARGET_OS__Android #ifdef __TARGET_OS__Android
static etk::Archive* s_APKArchive = NULL; static etk::Archive* s_APKArchive = NULL;
static void loadAPK(std::u32string& _apkPath) static void loadAPK(std::string& _apkPath)
{ {
TK_DEBUG("Loading APK \"" << _apkPath << "\""); TK_DEBUG("Loading APK \"" << _apkPath << "\"");
s_APKArchive = etk::Archive::load(_apkPath); s_APKArchive = etk::Archive::load(_apkPath);
@ -761,7 +761,7 @@ void etk::FSNode::updateFileSystemProperty(void) {
// = Check if it was a folder : = // = Check if it was a folder : =
// ---------------------------------------- // ----------------------------------------
std::string folderName = "/"; std::string folderName = "/";
if (true == m_systemFileName.endWith(folderName)) { if (true == end_with(m_systemFileName, folderName)) {
folderName = m_systemFileName; folderName = m_systemFileName;
} else { } else {
folderName = m_systemFileName + "/"; folderName = m_systemFileName + "/";
@ -1243,15 +1243,15 @@ void etk::FSNode::folderGetRecursiveFiles(std::vector<std::string>& _output, boo
} }
for (int iii=0; iii<s_APKArchive->size(); iii++) { for (int iii=0; iii<s_APKArchive->size(); iii++) {
std::string filename = s_APKArchive->getName(iii); std::string filename = s_APKArchive->getName(iii);
if (filename.startWith(FolderName) == true) { if (start_with(filename, FolderName) == true) {
std::string tmpString; std::string tmpString;
if(m_type == etk::FSN_TYPE_DATA) { if(m_type == etk::FSN_TYPE_DATA) {
tmpString = "DATA:"; tmpString = "DATA:";
} else { } else {
tmpString = "THEME:"; tmpString = "THEME:";
} }
if (true == filename.startWith(assetsName)) { if (start_with(filename, assetsName) == true) {
filename.remove(0,assetsName.size()); filename.erase(0,assetsName.size());
} }
tmpString += filename; tmpString += filename;
_output.push_back(tmpString); _output.push_back(tmpString);