[DEV] change enum naming
This commit is contained in:
parent
8806c4e44f
commit
51606313ab
@ -93,7 +93,7 @@ float etk::Noise::turbulenceNoSmooth(float _x, float _y, float _size, const etk:
|
||||
}
|
||||
|
||||
|
||||
etk::Noise::Noise(noise_te _type, ivec2 _size, int32_t _depth) :
|
||||
etk::Noise::Noise(enum noise _type, ivec2 _size, int32_t _depth) :
|
||||
m_data(_size.x()*_size.y()),
|
||||
m_size(_size),
|
||||
m_type(_type)
|
||||
|
@ -27,7 +27,7 @@ namespace etk {
|
||||
class Noise
|
||||
{
|
||||
public:
|
||||
typedef enum {
|
||||
enum noise {
|
||||
NOISE_BASE,
|
||||
NOISE_SMOOTH,
|
||||
NOISE_TURBULENCE,
|
||||
@ -35,16 +35,16 @@ namespace etk {
|
||||
NOISE_CLOUD,
|
||||
NOISE_MARBLE,
|
||||
NOISE_WOOD
|
||||
} noise_te;
|
||||
};
|
||||
private:
|
||||
etk::Vector<float> m_data;
|
||||
ivec2 m_size;
|
||||
noise_te m_type;
|
||||
enum noise m_type;
|
||||
float smoothNoise(float _x, float _y, const etk::BaseNoise& _noise);
|
||||
float turbulence(float _x, float _y, float _size, const etk::BaseNoise& _noise);
|
||||
float turbulenceNoSmooth(float _x, float _y, float _size, const etk::BaseNoise& _noise);
|
||||
public:
|
||||
Noise(noise_te _type, ivec2 _size, int32_t _depth);
|
||||
Noise(enum noise _type, ivec2 _size, int32_t _depth);
|
||||
~Noise(void);
|
||||
float get(int32_t _x, int32_t _y) const;
|
||||
};
|
||||
|
@ -50,7 +50,7 @@ typedef struct {
|
||||
bool haveBackSlash;
|
||||
char inputValue;
|
||||
char newValue;
|
||||
etk::regExpPrivateSection_te specialChar;
|
||||
enum etk::regExpPrivateSection specialChar;
|
||||
}convertionTable_ts;
|
||||
|
||||
extern const convertionTable_ts constConvertionTable[];
|
||||
|
@ -59,11 +59,11 @@ etk::CStart etk::cstart;
|
||||
# include <android/log.h>
|
||||
#endif
|
||||
|
||||
etk::CCout& etk::operator <<(etk::CCout &_os, const etk::logLevel_te _obj)
|
||||
etk::CCout& etk::operator <<(etk::CCout &_os, const enum etk::logLevel _obj)
|
||||
{
|
||||
switch (_obj)
|
||||
{
|
||||
case LOG_LEVEL_CRITICAL:
|
||||
case logLevelCritical:
|
||||
#if !defined(__TARGET_OS__Windows)
|
||||
_os << ETK_BASH_COLOR_BOLD_RED;
|
||||
#endif
|
||||
@ -73,7 +73,7 @@ etk::CCout& etk::operator <<(etk::CCout &_os, const etk::logLevel_te _obj)
|
||||
_os << "[C]";
|
||||
#endif
|
||||
break;
|
||||
case LOG_LEVEL_ERROR:
|
||||
case logLevelError:
|
||||
#if !defined(__TARGET_OS__Windows)
|
||||
_os << ETK_BASH_COLOR_RED;
|
||||
#endif
|
||||
@ -83,7 +83,7 @@ etk::CCout& etk::operator <<(etk::CCout &_os, const etk::logLevel_te _obj)
|
||||
_os << "[E]";
|
||||
#endif
|
||||
break;
|
||||
case LOG_LEVEL_WARNING:
|
||||
case logLevelWarning:
|
||||
#if !defined(__TARGET_OS__Windows)
|
||||
_os << ETK_BASH_COLOR_MAGENTA;
|
||||
#endif
|
||||
@ -93,7 +93,7 @@ etk::CCout& etk::operator <<(etk::CCout &_os, const etk::logLevel_te _obj)
|
||||
_os << "[W]";
|
||||
#endif
|
||||
break;
|
||||
case LOG_LEVEL_INFO:
|
||||
case logLevelInfo:
|
||||
#if !defined(__TARGET_OS__Windows)
|
||||
_os << ETK_BASH_COLOR_CYAN;
|
||||
#endif
|
||||
@ -103,7 +103,7 @@ etk::CCout& etk::operator <<(etk::CCout &_os, const etk::logLevel_te _obj)
|
||||
_os << "[I]";
|
||||
#endif
|
||||
break;
|
||||
case LOG_LEVEL_DEBUG:
|
||||
case logLevelDebug:
|
||||
#if !defined(__TARGET_OS__Windows)
|
||||
_os << ETK_BASH_COLOR_YELLOW;
|
||||
#endif
|
||||
@ -113,7 +113,7 @@ etk::CCout& etk::operator <<(etk::CCout &_os, const etk::logLevel_te _obj)
|
||||
_os << "[D]";
|
||||
#endif
|
||||
break;
|
||||
case LOG_LEVEL_VERBOSE:
|
||||
case logLevelVerbose:
|
||||
#if !defined(__TARGET_OS__Windows)
|
||||
_os << ETK_BASH_COLOR_WHITE;
|
||||
#endif
|
||||
|
37
etk/Stream.h
37
etk/Stream.h
@ -12,22 +12,21 @@
|
||||
#include <etk/types.h>
|
||||
#include <etk/os/Mutex.h>
|
||||
|
||||
namespace etk
|
||||
{
|
||||
namespace etk {
|
||||
#define MAX_LOG_SIZE (16000)
|
||||
#define MAX_LOG_SIZE_TMP (512)
|
||||
|
||||
class CEndl{};
|
||||
class CStart{};
|
||||
class CEndl {};
|
||||
class CStart {};
|
||||
|
||||
class CCout{
|
||||
class CCout {
|
||||
private:
|
||||
char m_tmpChar[MAX_LOG_SIZE+1];
|
||||
char tmp[MAX_LOG_SIZE_TMP];
|
||||
etk::Mutex m_mutex;
|
||||
char m_tmpChar[MAX_LOG_SIZE+1];
|
||||
char tmp[MAX_LOG_SIZE_TMP];
|
||||
etk::Mutex m_mutex;
|
||||
#if defined(__TARGET_OS__Android)
|
||||
public:
|
||||
int8_t m_levelAndroid; //!< specific level for Android
|
||||
int8_t m_levelAndroid; //!< specific level for Android
|
||||
#endif
|
||||
public:
|
||||
CCout(void);
|
||||
@ -54,20 +53,20 @@ namespace etk
|
||||
extern etk::CEndl endl;
|
||||
extern etk::CStart cstart;
|
||||
|
||||
typedef enum {
|
||||
LOG_LEVEL_NONE,
|
||||
LOG_LEVEL_CRITICAL,
|
||||
LOG_LEVEL_ERROR,
|
||||
LOG_LEVEL_WARNING,
|
||||
LOG_LEVEL_INFO,
|
||||
LOG_LEVEL_DEBUG,
|
||||
LOG_LEVEL_VERBOSE
|
||||
} logLevel_te;
|
||||
enum logLevel {
|
||||
logLevelNone,
|
||||
logLevelCritical,
|
||||
logLevelError,
|
||||
logLevelWarning,
|
||||
logLevelInfo,
|
||||
logLevelDebug,
|
||||
logLevelVerbose
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Debug operator To display the curent element in a Human redeable information
|
||||
*/
|
||||
etk::CCout& operator <<(etk::CCout &_os, const etk::logLevel_te _obj);
|
||||
etk::CCout& operator <<(etk::CCout &_os, const enum etk::logLevel _obj);
|
||||
|
||||
void displayBacktrace(bool _breakAtEnd=true);
|
||||
};
|
||||
|
@ -12,7 +12,7 @@
|
||||
namespace etk {
|
||||
//in the unicode section we have : [E000..F8FF] private area ==> we will store element in this area:
|
||||
// internal define to permit to have all needed system
|
||||
typedef enum {
|
||||
enum regExpPrivateSection {
|
||||
REGEXP_OPCODE_PTHESE_IN=0xE000, /* ( */
|
||||
REGEXP_OPCODE_PTHESE_OUT,/* ) */
|
||||
REGEXP_OPCODE_BRACKET_IN,/* [ */
|
||||
@ -37,7 +37,7 @@ namespace etk {
|
||||
REGEXP_OPCODE_WORD_NOT,/* \W */
|
||||
REGEXP_OPCODE_NO_CHAR,/* \@ */
|
||||
REGEXP_OPCODE_ERROR, // not used
|
||||
} regExpPrivateSection_te;
|
||||
};
|
||||
|
||||
class UChar {
|
||||
public: // classic unicar code :
|
||||
@ -64,7 +64,7 @@ namespace etk {
|
||||
m_value((uint32_t)_obj){
|
||||
|
||||
};
|
||||
UChar(const regExpPrivateSection_te _obj) :
|
||||
UChar(const enum regExpPrivateSection _obj) :
|
||||
m_value((uint32_t)_obj) {
|
||||
|
||||
};
|
||||
|
@ -10,8 +10,7 @@
|
||||
#include <etk/unicode.h>
|
||||
#include <etk/debug.h>
|
||||
|
||||
int32_t strlen(const etk::UChar * _data)
|
||||
{
|
||||
int32_t strlen(const etk::UChar * _data) {
|
||||
if (NULL == _data) {
|
||||
return 0;
|
||||
}
|
||||
@ -29,8 +28,7 @@ int32_t strlen(const etk::UChar * _data)
|
||||
#undef __class__
|
||||
#define __class__ "etk::UString"
|
||||
|
||||
etk::CCout& etk::operator <<(etk::CCout& _os, const etk::UString& _obj)
|
||||
{
|
||||
etk::CCout& etk::operator <<(etk::CCout& _os, const etk::UString& _obj) {
|
||||
etk::Vector<char> output_UTF8;
|
||||
unicode::convertUnicodeToUtf8(_obj.m_data, output_UTF8);
|
||||
output_UTF8.pushBack('\0');
|
||||
@ -38,8 +36,7 @@ etk::CCout& etk::operator <<(etk::CCout& _os, const etk::UString& _obj)
|
||||
return _os;
|
||||
}
|
||||
|
||||
etk::CCout& etk::operator <<(etk::CCout& _os, const etk::Vector<etk::UString>& _obj)
|
||||
{
|
||||
etk::CCout& etk::operator <<(etk::CCout& _os, const etk::Vector<etk::UString>& _obj) {
|
||||
_os << "{";
|
||||
for (int32_t iii=0; iii< _obj.size(); iii++) {
|
||||
if (iii>0) {
|
||||
@ -58,8 +55,7 @@ etk::UString::UString(void)
|
||||
}
|
||||
|
||||
|
||||
etk::UString::UString(const char* _data, unicode::charset_te _inputCharset)
|
||||
{
|
||||
etk::UString::UString(const char* _data, enum unicode::charset _inputCharset) {
|
||||
// TODO : Change this ...
|
||||
etk::Vector<char> transformData;
|
||||
while (*_data != '\0') {
|
||||
@ -67,7 +63,7 @@ etk::UString::UString(const char* _data, unicode::charset_te _inputCharset)
|
||||
_data++;
|
||||
}
|
||||
m_data.clear();
|
||||
if (unicode::EDN_CHARSET_UTF8==_inputCharset) {
|
||||
if (unicode::charsetUTF8 == _inputCharset) {
|
||||
unicode::convertUtf8ToUnicode(transformData, m_data);
|
||||
} else {
|
||||
unicode::convertIsoToUnicode(_inputCharset, transformData, m_data);
|
||||
@ -80,8 +76,7 @@ etk::UString::UString(const char* _data, unicode::charset_te _inputCharset)
|
||||
|
||||
|
||||
// single element adding
|
||||
etk::UString::UString(const bool _inputData, etk::UString::printMode_te _mode, bool _preset)
|
||||
{
|
||||
etk::UString::UString(const bool _inputData, enum etk::UString::printMode _mode, bool _preset) {
|
||||
m_data.clear();
|
||||
if (_preset==true) {
|
||||
switch(_mode) {
|
||||
@ -200,7 +195,7 @@ etk::UString etk::UString::WrapHidenChar(void) const
|
||||
*/
|
||||
|
||||
|
||||
void etk::UString::setNumber(bool _negative, const uint64_t& _inputData, etk::UString::printMode_te _mode, bool _preset, int32_t _leadingZero)
|
||||
void etk::UString::setNumber(bool _negative, const uint64_t& _inputData, enum etk::UString::printMode _mode, bool _preset, int32_t _leadingZero)
|
||||
{
|
||||
m_data.clear();
|
||||
if (true==_negative) {
|
||||
@ -296,7 +291,7 @@ void etk::UString::setNumber(bool _negative, const uint64_t& _inputData, etk::US
|
||||
//TK_ERROR(" convert : " << _inputData << " in : " << *this << " len=" << m_data.Size());
|
||||
}
|
||||
|
||||
void etk::UString::set(const int64_t& _inputData, etk::UString::printMode_te _mode, bool _preset, int32_t _leadingZero)
|
||||
void etk::UString::set(const int64_t& _inputData, enum etk::UString::printMode _mode, bool _preset, int32_t _leadingZero)
|
||||
{
|
||||
if (_preset==true && _mode != etk::UString::printModeString) {
|
||||
setNumber(false, (uint64_t)_inputData, _mode, _preset, _leadingZero);
|
||||
@ -310,7 +305,7 @@ void etk::UString::set(const int64_t& _inputData, etk::UString::printMode_te _mo
|
||||
}
|
||||
}
|
||||
|
||||
void etk::UString::set(const uint64_t& _inputData, etk::UString::printMode_te _mode, bool _preset, int32_t _leadingZero)
|
||||
void etk::UString::set(const uint64_t& _inputData, enum etk::UString::printMode _mode, bool _preset, int32_t _leadingZero)
|
||||
{
|
||||
setNumber(false, (uint64_t)_inputData, _mode, _preset, _leadingZero);
|
||||
}
|
||||
|
@ -14,18 +14,16 @@
|
||||
#include <etk/Char.h>
|
||||
#include <etk/unicode.h>
|
||||
|
||||
namespace etk
|
||||
{
|
||||
class UString
|
||||
{
|
||||
namespace etk {
|
||||
class UString {
|
||||
public:
|
||||
typedef enum {
|
||||
enum printMode {
|
||||
printModeBinary,
|
||||
printModeOctal,
|
||||
printModeDecimal,
|
||||
printModeHexadecimal,
|
||||
printModeString,
|
||||
} printMode_te;
|
||||
};
|
||||
private :
|
||||
etk::Vector<etk::UChar> m_data; //!< internal data is stored in the Unicode properties ...
|
||||
public:
|
||||
@ -37,19 +35,35 @@ namespace etk
|
||||
UString(const etk::UString& _obj);
|
||||
|
||||
// single element adding
|
||||
UString(const bool _inputData, printMode_te _mode=printModeString, bool _preset=false);
|
||||
UString(const bool _inputData, enum printMode _mode=printModeString, bool _preset=false);
|
||||
UString(const etk::UChar& _inputData);
|
||||
UString(const char* _data, unicode::charset_te _inputCharset);
|
||||
UString(const char* _data, enum unicode::charset _inputCharset);
|
||||
UString(const float _inputData);
|
||||
UString(const double _inputData);
|
||||
UString(const int8_t& _inputData, printMode_te _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) { set((int64_t)_inputData, _mode, _preset, _leadingZero); };
|
||||
UString(const int16_t& _inputData, printMode_te _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) { set((int64_t)_inputData, _mode, _preset, _leadingZero); };
|
||||
UString(const int32_t& _inputData, printMode_te _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) { set((int64_t)_inputData, _mode, _preset, _leadingZero); };
|
||||
UString(const int64_t& _inputData, printMode_te _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) { set(_inputData, _mode, _preset, _leadingZero); };
|
||||
UString(const uint8_t& _inputData, printMode_te _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) { set((uint64_t)_inputData, _mode, _preset, _leadingZero); };
|
||||
UString(const uint16_t& _inputData, printMode_te _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) { set((uint64_t)_inputData, _mode, _preset, _leadingZero); };
|
||||
UString(const uint32_t& _inputData, printMode_te _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) { set((uint64_t)_inputData, _mode, _preset, _leadingZero); };
|
||||
UString(const uint64_t& _inputData, printMode_te _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0) { set(_inputData, _mode, _preset, _leadingZero); };
|
||||
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 etk::UChar* _inputData, int32_t _len = -1);
|
||||
UString(const char* _inputData, int32_t _len = -1);
|
||||
@ -63,10 +77,10 @@ namespace etk
|
||||
void set(const etk::Vector<int8_t>& _inputData);
|
||||
void set(const etk::Vector<etk::UChar>& _inputData);
|
||||
private:
|
||||
void setNumber(bool _negative, const uint64_t& _inputData, etk::UString::printMode_te _mode, bool _preset, int32_t _leadingZero);
|
||||
void setNumber(bool _negative, const uint64_t& _inputData, enum printMode _mode, bool _preset, int32_t _leadingZero);
|
||||
public:
|
||||
void set(const int64_t& _inputData, printMode_te _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0);
|
||||
void set(const uint64_t& _inputData, printMode_te _mode=printModeDecimal, bool _preset=false, int32_t _leadingZero=0);
|
||||
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
|
||||
|
@ -58,11 +58,11 @@ void debug::displayTime(void)
|
||||
|
||||
|
||||
#ifdef __TARGET_OS__Android
|
||||
etk::logLevel_te g_requestedLevel = etk::LOG_LEVEL_VERBOSE;
|
||||
enum etk::logLevel g_requestedLevel = etk::logLevelError;
|
||||
#else
|
||||
etk::logLevel_te g_requestedLevel = etk::LOG_LEVEL_ERROR;
|
||||
enum etk::logLevel g_requestedLevel = etk::logLevelWarning;
|
||||
#endif
|
||||
void debug::setGeneralLevel(etk::logLevel_te _ccc) {
|
||||
void debug::setGeneralLevel(enum etk::logLevel _ccc) {
|
||||
g_requestedLevel = _ccc;
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,13 @@ namespace debug {
|
||||
// Log Message System For EDN
|
||||
void displayFuncName(int32_t _ligne, const char* _className, const char* _funcName, const char* _libName);
|
||||
void displayTime(void);
|
||||
void setGeneralLevel(etk::logLevel_te _ccc);
|
||||
void setGeneralLevel(enum etk::logLevel _ccc);
|
||||
}
|
||||
|
||||
#undef __class__
|
||||
#define __class__ (NULL)
|
||||
|
||||
extern etk::logLevel_te g_requestedLevel;
|
||||
extern enum etk::logLevel g_requestedLevel;
|
||||
|
||||
#define ETK_DBG_COMMON(libName,info,data) do { \
|
||||
if (info <= g_requestedLevel) { \
|
||||
@ -36,32 +36,32 @@ extern etk::logLevel_te g_requestedLevel;
|
||||
|
||||
|
||||
#define ETK_CRITICAL(libName,data) do { \
|
||||
ETK_DBG_COMMON(libName, etk::LOG_LEVEL_CRITICAL, data); \
|
||||
ETK_DBG_COMMON(libName, etk::logLevelCritical, data); \
|
||||
etk::displayBacktrace(); \
|
||||
}while(0)
|
||||
|
||||
#if DEBUG_LEVEL > 0
|
||||
# define ETK_WARNING(libName,data) ETK_DBG_COMMON(libName, etk::LOG_LEVEL_WARNING, data)
|
||||
# define ETK_ERROR(libName,data) ETK_DBG_COMMON(libName, etk::LOG_LEVEL_ERROR, data)
|
||||
# define ETK_WARNING(libName,data) ETK_DBG_COMMON(libName, etk::logLevelWarning, data)
|
||||
# define ETK_ERROR(libName,data) ETK_DBG_COMMON(libName, etk::logLevelError, data)
|
||||
#else
|
||||
# define ETK_WARNING(libName,data) do {}while(0)
|
||||
# define ETK_ERROR(libName,data) do {}while(0)
|
||||
#endif
|
||||
|
||||
#if DEBUG_LEVEL > 1
|
||||
# define ETK_INFO(libName,data) ETK_DBG_COMMON(libName, etk::LOG_LEVEL_INFO, data)
|
||||
# define ETK_INFO(libName,data) ETK_DBG_COMMON(libName, etk::logLevelInfo, data)
|
||||
#else
|
||||
# define ETK_INFO(libName,data) do {}while(0)
|
||||
#endif
|
||||
|
||||
#if DEBUG_LEVEL > 2
|
||||
# define ETK_DEBUG(libName,data) ETK_DBG_COMMON(libName, etk::LOG_LEVEL_DEBUG, data)
|
||||
# define ETK_DEBUG(libName,data) ETK_DBG_COMMON(libName, etk::logLevelDebug, data)
|
||||
#else
|
||||
# define ETK_DEBUG(libName,data) do {}while(0)
|
||||
#endif
|
||||
|
||||
#if DEBUG_LEVEL > 3
|
||||
# define ETK_VERBOSE(libName,data) ETK_DBG_COMMON(libName, etk::LOG_LEVEL_VERBOSE, data)
|
||||
# define ETK_VERBOSE(libName,data) ETK_DBG_COMMON(libName, etk::logLevelVerbose, data)
|
||||
#else
|
||||
# define ETK_VERBOSE(libName,data) do {}while(0)
|
||||
#endif
|
||||
|
@ -15,24 +15,24 @@
|
||||
|
||||
|
||||
|
||||
void unicode::convertIsoToUnicode(charset_te _inputCharset, const char _input_ISO, etk::UChar & _output_Unicode)
|
||||
void unicode::convertIsoToUnicode(enum charset _inputCharset, const char _input_ISO, etk::UChar & _output_Unicode)
|
||||
{
|
||||
switch(_inputCharset)
|
||||
{
|
||||
case EDN_CHARSET_ISO_8859_1: _output_Unicode.set(tableIso8859_1[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_2: _output_Unicode.set(tableIso8859_2[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_3: _output_Unicode.set(tableIso8859_3[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_4: _output_Unicode.set(tableIso8859_4[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_5: _output_Unicode.set(tableIso8859_5[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_6: _output_Unicode.set(tableIso8859_6[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_7: _output_Unicode.set(tableIso8859_7[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_8: _output_Unicode.set(tableIso8859_8[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_9: _output_Unicode.set(tableIso8859_9[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_10: _output_Unicode.set(tableIso8859_10[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_11: _output_Unicode.set(tableIso8859_11[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_13: _output_Unicode.set(tableIso8859_13[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_14: _output_Unicode.set(tableIso8859_14[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case EDN_CHARSET_ISO_8859_15: _output_Unicode.set(tableIso8859_15[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_1: _output_Unicode.set(tableIso8859_1[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_2: _output_Unicode.set(tableIso8859_2[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_3: _output_Unicode.set(tableIso8859_3[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_4: _output_Unicode.set(tableIso8859_4[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_5: _output_Unicode.set(tableIso8859_5[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_6: _output_Unicode.set(tableIso8859_6[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_7: _output_Unicode.set(tableIso8859_7[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_8: _output_Unicode.set(tableIso8859_8[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_9: _output_Unicode.set(tableIso8859_9[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_10: _output_Unicode.set(tableIso8859_10[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_11: _output_Unicode.set(tableIso8859_11[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_13: _output_Unicode.set(tableIso8859_13[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_14: _output_Unicode.set(tableIso8859_14[(uint32_t)_input_ISO&0xFF]); break;
|
||||
case charsetIso8859_15: _output_Unicode.set(tableIso8859_15[(uint32_t)_input_ISO&0xFF]); break;
|
||||
default :
|
||||
TK_WARNING("Unknow charset ... " << _inputCharset);
|
||||
_output_Unicode = '?';
|
||||
@ -41,25 +41,25 @@ void unicode::convertIsoToUnicode(charset_te _inputCharset, const char _input_IS
|
||||
}
|
||||
|
||||
|
||||
void unicode::convertUnicodeToIso(charset_te _inputCharset, const etk::UChar _input_Unicode, char & _output_ISO)
|
||||
void unicode::convertUnicodeToIso(enum charset _inputCharset, const etk::UChar _input_Unicode, char & _output_ISO)
|
||||
{
|
||||
const uint32_t *tmpTable = NULL;
|
||||
switch(_inputCharset)
|
||||
{
|
||||
case EDN_CHARSET_ISO_8859_1: tmpTable = tableIso8859_1; break;
|
||||
case EDN_CHARSET_ISO_8859_2: tmpTable = tableIso8859_2; break;
|
||||
case EDN_CHARSET_ISO_8859_3: tmpTable = tableIso8859_3; break;
|
||||
case EDN_CHARSET_ISO_8859_4: tmpTable = tableIso8859_4; break;
|
||||
case EDN_CHARSET_ISO_8859_5: tmpTable = tableIso8859_5; break;
|
||||
case EDN_CHARSET_ISO_8859_6: tmpTable = tableIso8859_6; break;
|
||||
case EDN_CHARSET_ISO_8859_7: tmpTable = tableIso8859_7; break;
|
||||
case EDN_CHARSET_ISO_8859_8: tmpTable = tableIso8859_8; break;
|
||||
case EDN_CHARSET_ISO_8859_9: tmpTable = tableIso8859_9; break;
|
||||
case EDN_CHARSET_ISO_8859_10: tmpTable = tableIso8859_10; break;
|
||||
case EDN_CHARSET_ISO_8859_11: tmpTable = tableIso8859_11; break;
|
||||
case EDN_CHARSET_ISO_8859_13: tmpTable = tableIso8859_13; break;
|
||||
case EDN_CHARSET_ISO_8859_14: tmpTable = tableIso8859_14; break;
|
||||
case EDN_CHARSET_ISO_8859_15: tmpTable = tableIso8859_15; break;
|
||||
case charsetIso8859_1: tmpTable = tableIso8859_1; break;
|
||||
case charsetIso8859_2: tmpTable = tableIso8859_2; break;
|
||||
case charsetIso8859_3: tmpTable = tableIso8859_3; break;
|
||||
case charsetIso8859_4: tmpTable = tableIso8859_4; break;
|
||||
case charsetIso8859_5: tmpTable = tableIso8859_5; break;
|
||||
case charsetIso8859_6: tmpTable = tableIso8859_6; break;
|
||||
case charsetIso8859_7: tmpTable = tableIso8859_7; break;
|
||||
case charsetIso8859_8: tmpTable = tableIso8859_8; break;
|
||||
case charsetIso8859_9: tmpTable = tableIso8859_9; break;
|
||||
case charsetIso8859_10: tmpTable = tableIso8859_10; break;
|
||||
case charsetIso8859_11: tmpTable = tableIso8859_11; break;
|
||||
case charsetIso8859_13: tmpTable = tableIso8859_13; break;
|
||||
case charsetIso8859_14: tmpTable = tableIso8859_14; break;
|
||||
case charsetIso8859_15: tmpTable = tableIso8859_15; break;
|
||||
default :
|
||||
TK_WARNING("Unknow charset ... " << _inputCharset);
|
||||
_output_ISO = '?';
|
||||
@ -75,7 +75,7 @@ void unicode::convertUnicodeToIso(charset_te _inputCharset, const etk::UChar _in
|
||||
}
|
||||
|
||||
|
||||
int32_t unicode::convertIsoToUnicode(charset_te _inputCharset, const etk::Vector<char>& _input_ISO, etk::Vector<etk::UChar>& _output_Unicode)
|
||||
int32_t unicode::convertIsoToUnicode(enum charset _inputCharset, const etk::Vector<char>& _input_ISO, etk::Vector<etk::UChar>& _output_Unicode)
|
||||
{
|
||||
_output_Unicode.clear();
|
||||
etk::UChar output;
|
||||
@ -91,7 +91,7 @@ int32_t unicode::convertIsoToUnicode(charset_te _inputCharset, const etk::Vector
|
||||
return _output_Unicode.size();
|
||||
}
|
||||
|
||||
int32_t unicode::convertIsoToUnicode(charset_te _inputCharset, const etk::Vector<int8_t>& _input_ISO, etk::Vector<etk::UChar>& _output_Unicode)
|
||||
int32_t unicode::convertIsoToUnicode(enum charset _inputCharset, const etk::Vector<int8_t>& _input_ISO, etk::Vector<etk::UChar>& _output_Unicode)
|
||||
{
|
||||
_output_Unicode.clear();
|
||||
etk::UChar output;
|
||||
@ -108,7 +108,7 @@ int32_t unicode::convertIsoToUnicode(charset_te _inputCharset, const etk::Vector
|
||||
}
|
||||
|
||||
|
||||
int32_t unicode::convertUnicodeToIso(charset_te _inputCharset, const etk::Vector<etk::UChar>& _input_Unicode, etk::Vector<char>& _output_ISO)
|
||||
int32_t unicode::convertUnicodeToIso(enum charset _inputCharset, const etk::Vector<etk::UChar>& _input_Unicode, etk::Vector<char>& _output_ISO)
|
||||
{
|
||||
_output_ISO.clear();
|
||||
char output[10];
|
||||
@ -124,7 +124,7 @@ int32_t unicode::convertUnicodeToIso(charset_te _inputCharset, const etk::Vector
|
||||
return _output_ISO.size();
|
||||
}
|
||||
|
||||
int32_t unicode::convertUnicodeToIso(charset_te _inputCharset, const etk::Vector<etk::UChar>& _input_Unicode, etk::Vector<int8_t>& _output_ISO)
|
||||
int32_t unicode::convertUnicodeToIso(enum charset _inputCharset, const etk::Vector<etk::UChar>& _input_Unicode, etk::Vector<int8_t>& _output_ISO)
|
||||
{
|
||||
_output_ISO.clear();
|
||||
char output[10];
|
||||
@ -334,7 +334,7 @@ int32_t unicode::convertUtf8ToUnicode(const char * _input_UTF8, etk::Vector<etk:
|
||||
|
||||
|
||||
// Transform ISO <==> UTF-8
|
||||
void unicode::convertIsoToUtf8(charset_te _inputCharset, const char _input_ISO, char * _output_UTF8)
|
||||
void unicode::convertIsoToUtf8(enum charset _inputCharset, const char _input_ISO, char * _output_UTF8)
|
||||
{
|
||||
etk::UChar tmpUnicode;
|
||||
// concert Iso in UniCode
|
||||
@ -344,7 +344,7 @@ void unicode::convertIsoToUtf8(charset_te _inputCharset, const char _input_ISO,
|
||||
}
|
||||
|
||||
|
||||
void unicode::convertUtf8ToIso(charset_te _inputCharset, const char * _input_UTF8, char & _output_ISO)
|
||||
void unicode::convertUtf8ToIso(enum charset _inputCharset, const char * _input_UTF8, char & _output_ISO)
|
||||
{
|
||||
etk::UChar tmpUnicode;
|
||||
// convert Utf-8 in UniCode
|
||||
@ -354,14 +354,14 @@ void unicode::convertUtf8ToIso(charset_te _inputCharset, const char * _input_UTF
|
||||
}
|
||||
|
||||
|
||||
int32_t unicode::convertIsoToUtf8(charset_te _inputCharset, const etk::Vector<char>& _input_ISO, etk::Vector<char>& _output_UTF8)
|
||||
int32_t unicode::convertIsoToUtf8(enum charset _inputCharset, const etk::Vector<char>& _input_ISO, etk::Vector<char>& _output_UTF8)
|
||||
{
|
||||
TK_WARNING("TODO : not coded...");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int32_t unicode::convertUtf8ToIso(charset_te _inputCharset, const etk::Vector<char>& _input_UTF8, etk::Vector<char>& _output_ISO)
|
||||
int32_t unicode::convertUtf8ToIso(enum charset _inputCharset, const etk::Vector<char>& _input_UTF8, etk::Vector<char>& _output_ISO)
|
||||
{
|
||||
TK_WARNING("TODO : not coded...");
|
||||
return 0;
|
||||
|
@ -13,31 +13,31 @@
|
||||
#include <etk/Vector.h>
|
||||
|
||||
namespace unicode {
|
||||
typedef enum {
|
||||
EDN_CHARSET_UTF8,
|
||||
EDN_CHARSET_ISO_8859_1,
|
||||
EDN_CHARSET_ISO_8859_2,
|
||||
EDN_CHARSET_ISO_8859_3,
|
||||
EDN_CHARSET_ISO_8859_4,
|
||||
EDN_CHARSET_ISO_8859_5,
|
||||
EDN_CHARSET_ISO_8859_6,
|
||||
EDN_CHARSET_ISO_8859_7,
|
||||
EDN_CHARSET_ISO_8859_8,
|
||||
EDN_CHARSET_ISO_8859_9,
|
||||
EDN_CHARSET_ISO_8859_10,
|
||||
EDN_CHARSET_ISO_8859_11,
|
||||
EDN_CHARSET_ISO_8859_13,
|
||||
EDN_CHARSET_ISO_8859_14,
|
||||
EDN_CHARSET_ISO_8859_15
|
||||
} charset_te;
|
||||
enum charset {
|
||||
charsetUTF8,
|
||||
charsetIso8859_1,
|
||||
charsetIso8859_2,
|
||||
charsetIso8859_3,
|
||||
charsetIso8859_4,
|
||||
charsetIso8859_5,
|
||||
charsetIso8859_6,
|
||||
charsetIso8859_7,
|
||||
charsetIso8859_8,
|
||||
charsetIso8859_9,
|
||||
charsetIso8859_10,
|
||||
charsetIso8859_11,
|
||||
charsetIso8859_13,
|
||||
charsetIso8859_14,
|
||||
charsetIso8859_15
|
||||
};
|
||||
|
||||
// transform ISO <==> Unicode
|
||||
void convertIsoToUnicode(charset_te _inputCharset, const char _input_ISO, etk::UChar & _output_Unicode);
|
||||
void convertUnicodeToIso(charset_te _inputCharset, const etk::UChar _input_Unicode, char & _output_ISO);
|
||||
int32_t convertIsoToUnicode(charset_te _inputCharset, const etk::Vector<char>& _input_ISO, etk::Vector<etk::UChar>& _output_Unicode);
|
||||
int32_t convertIsoToUnicode(charset_te _inputCharset, const etk::Vector<int8_t>& _input_ISO, etk::Vector<etk::UChar>& _output_Unicode);
|
||||
int32_t convertUnicodeToIso(charset_te _inputCharset, const etk::Vector<etk::UChar>& _input_Unicode, etk::Vector<char>& _output_ISO);
|
||||
int32_t convertUnicodeToIso(charset_te _inputCharset, const etk::Vector<etk::UChar>& _input_Unicode, etk::Vector<int8_t>& _output_ISO);
|
||||
void convertIsoToUnicode(enum charset _inputCharset, const char _input_ISO, etk::UChar & _output_Unicode);
|
||||
void convertUnicodeToIso(enum charset _inputCharset, const etk::UChar _input_Unicode, char & _output_ISO);
|
||||
int32_t convertIsoToUnicode(enum charset _inputCharset, const etk::Vector<char>& _input_ISO, etk::Vector<etk::UChar>& _output_Unicode);
|
||||
int32_t convertIsoToUnicode(enum charset _inputCharset, const etk::Vector<int8_t>& _input_ISO, etk::Vector<etk::UChar>& _output_Unicode);
|
||||
int32_t convertUnicodeToIso(enum charset _inputCharset, const etk::Vector<etk::UChar>& _input_Unicode, etk::Vector<char>& _output_ISO);
|
||||
int32_t convertUnicodeToIso(enum charset _inputCharset, const etk::Vector<etk::UChar>& _input_Unicode, etk::Vector<int8_t>& _output_ISO);
|
||||
// Transform UTF-8 <==> Unicode
|
||||
int32_t convertUnicodeToUtf8( const etk::Vector<etk::UChar>& _input_Unicode, etk::Vector<char>& _output_UTF8);
|
||||
int32_t convertUnicodeToUtf8( const etk::Vector<etk::UChar>& _input_Unicode, etk::Vector<int8_t>& _output_UTF8);
|
||||
@ -45,10 +45,10 @@ namespace unicode {
|
||||
int32_t convertUtf8ToUnicode( const etk::Vector<int8_t>& _input_UTF8, etk::Vector<etk::UChar>& _output_Unicode);
|
||||
int32_t convertUtf8ToUnicode( const char * _input_UTF8, etk::Vector<etk::UChar>& _output_Unicode);
|
||||
// Transform ISO <==> UTF-8
|
||||
void convertIsoToUtf8( charset_te _inputCharset, const char _input_ISO, char * _output_UTF8);
|
||||
void convertUtf8ToIso( charset_te _inputCharset, const char * _input_UTF8, char & _output_ISO);
|
||||
int32_t convertIsoToUtf8( charset_te _inputCharset, const etk::Vector<char>& _input_ISO, etk::Vector<char>& _output_UTF8);
|
||||
int32_t convertUtf8ToIso( charset_te _inputCharset, const etk::Vector<char>& _input_UTF8, etk::Vector<char>& _output_ISO);
|
||||
void convertIsoToUtf8( enum charset _inputCharset, const char _input_ISO, char * _output_UTF8);
|
||||
void convertUtf8ToIso( enum charset _inputCharset, const char * _input_UTF8, char & _output_ISO);
|
||||
int32_t convertIsoToUtf8( enum charset _inputCharset, const etk::Vector<char>& _input_ISO, etk::Vector<char>& _output_UTF8);
|
||||
int32_t convertUtf8ToIso( enum charset _inputCharset, const etk::Vector<char>& _input_UTF8, etk::Vector<char>& _output_ISO);
|
||||
|
||||
void utf8_SizeElement(const char * _data, int32_t _lenMax , uint8_t &_size, bool &_baseValid);
|
||||
int32_t strUtf8Len(const char *_input_UTF8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user