[STYLE] remove (void) in () to be c++ coherent
This commit is contained in:
parent
2059e5f06a
commit
d2997292a5
16
etk/Buffer.h
16
etk/Buffer.h
@ -82,7 +82,7 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Destructor of the current Class
|
* @brief Destructor of the current Class
|
||||||
*/
|
*/
|
||||||
~Buffer(void) {
|
~Buffer() {
|
||||||
if (m_data != NULL) {
|
if (m_data != NULL) {
|
||||||
free(m_data);
|
free(m_data);
|
||||||
}
|
}
|
||||||
@ -104,8 +104,8 @@ namespace etk {
|
|||||||
}
|
}
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
// write Data
|
// write Data
|
||||||
(void)file.fileWrite(m_data, sizeof(int8_t), m_gapStart);
|
file.fileWrite(m_data, sizeof(int8_t), m_gapStart);
|
||||||
(void)file.fileWrite(&m_data[m_gapEnd], sizeof(int8_t), m_allocated - m_gapEnd);
|
file.fileWrite(&m_data[m_gapEnd], sizeof(int8_t), m_allocated - m_gapEnd);
|
||||||
file.fileClose();
|
file.fileClose();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -384,7 +384,7 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Remove the last element of the Buffer.
|
* @brief Remove the last element of the Buffer.
|
||||||
*/
|
*/
|
||||||
void pop_back(void) {
|
void pop_back() {
|
||||||
if (size() > 0) {
|
if (size() > 0) {
|
||||||
remove( size() );
|
remove( size() );
|
||||||
}
|
}
|
||||||
@ -392,7 +392,7 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Remove all the data in the buffer.
|
* @brief Remove all the data in the buffer.
|
||||||
*/
|
*/
|
||||||
void clear(void) {
|
void clear() {
|
||||||
remove(0, size() );
|
remove(0, size() );
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
@ -409,7 +409,7 @@ namespace etk {
|
|||||||
* @brief Get the number of element in the vector. This does not contain the gap size.
|
* @brief Get the number of element in the vector. This does not contain the gap size.
|
||||||
* @return The size of the set data.
|
* @return The size of the set data.
|
||||||
*/
|
*/
|
||||||
int32_t size(void) const {
|
int32_t size() const {
|
||||||
return m_allocated - gapSize();
|
return m_allocated - gapSize();
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
@ -516,13 +516,13 @@ namespace etk {
|
|||||||
* @brief Get the current gap size.
|
* @brief Get the current gap size.
|
||||||
* @return The number of element in the gap.
|
* @return The number of element in the gap.
|
||||||
*/
|
*/
|
||||||
int32_t gapSize(void) const {
|
int32_t gapSize() const {
|
||||||
return m_gapEnd - m_gapStart;
|
return m_gapEnd - m_gapStart;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Control if the writing gap is not too big (automatic call when resize the buffer).
|
* @brief Control if the writing gap is not too big (automatic call when resize the buffer).
|
||||||
*/
|
*/
|
||||||
void gapCheckMaxSize(void) {
|
void gapCheckMaxSize() {
|
||||||
if(gapSize() > GAP_SIZE_MAX) {
|
if(gapSize() > GAP_SIZE_MAX) {
|
||||||
int32_t currentSize = size();
|
int32_t currentSize = size();
|
||||||
// Change the gap Size
|
// Change the gap Size
|
||||||
|
@ -44,8 +44,8 @@ typedef struct {
|
|||||||
etk::Color<> color;
|
etk::Color<> color;
|
||||||
} colorList_ts;
|
} colorList_ts;
|
||||||
|
|
||||||
static int32_t getColorSize(void);
|
static int32_t getColorSize();
|
||||||
static const colorList_ts* getColorList(void);
|
static const colorList_ts* getColorList();
|
||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
template<> void Color<uint8_t>::set(float _r, float _g, float _b, float _a) {
|
template<> void Color<uint8_t>::set(float _r, float _g, float _b, float _a) {
|
||||||
@ -76,14 +76,14 @@ namespace etk {
|
|||||||
m_a = ((float)_a)/255.0f;
|
m_a = ((float)_a)/255.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> uint32_t Color<uint8_t>::get(void) const {
|
template<> uint32_t Color<uint8_t>::get() const {
|
||||||
return (((uint32_t)m_r)<<24)
|
return (((uint32_t)m_r)<<24)
|
||||||
+ (((uint32_t)m_g)<<16)
|
+ (((uint32_t)m_g)<<16)
|
||||||
+ (((uint32_t)m_b)<<8)
|
+ (((uint32_t)m_b)<<8)
|
||||||
+ (uint32_t)m_a;
|
+ (uint32_t)m_a;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> uint32_t Color<float>::get(void) const {
|
template<> uint32_t Color<float>::get() const {
|
||||||
return Color<uint8_t>(*this).get();
|
return Color<uint8_t>(*this).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,12 +537,12 @@ static const colorList_ts listOfColor[] = {
|
|||||||
{ "YellowGreen", etk::color::yellowGreen}
|
{ "YellowGreen", etk::color::yellowGreen}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const colorList_ts* getColorList(void)
|
static const colorList_ts* getColorList()
|
||||||
{
|
{
|
||||||
return listOfColor;
|
return listOfColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t getColorSize(void)
|
static int32_t getColorSize()
|
||||||
{
|
{
|
||||||
static const int32_t tmpp = sizeof(listOfColor) / sizeof(colorList_ts);
|
static const int32_t tmpp = sizeof(listOfColor) / sizeof(colorList_ts);
|
||||||
return tmpp;
|
return tmpp;
|
||||||
|
16
etk/Color.h
16
etk/Color.h
@ -41,7 +41,7 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor. It does not initialise element of class.
|
* @brief Constructor. It does not initialise element of class.
|
||||||
*/
|
*/
|
||||||
Color(void) { };
|
Color() { };
|
||||||
/**
|
/**
|
||||||
* @brief Contructor with request initialisation.
|
* @brief Contructor with request initialisation.
|
||||||
* @param[in] _r Red color.
|
* @param[in] _r Red color.
|
||||||
@ -145,7 +145,7 @@ namespace etk {
|
|||||||
* @breif Get the Generic uint32_t value of the color
|
* @breif Get the Generic uint32_t value of the color
|
||||||
* @return Color in unsigned integer
|
* @return Color in unsigned integer
|
||||||
*/
|
*/
|
||||||
uint32_t get(void) const;
|
uint32_t get() const;
|
||||||
/**
|
/**
|
||||||
* @brief Set the specified color elements.
|
* @brief Set the specified color elements.
|
||||||
* @param[in] _r Red color.
|
* @param[in] _r Red color.
|
||||||
@ -167,7 +167,7 @@ namespace etk {
|
|||||||
* @brief Convert the color in an hexedecimal string ("0xFEDCBA98")
|
* @brief Convert the color in an hexedecimal string ("0xFEDCBA98")
|
||||||
* @return The formated string
|
* @return The formated string
|
||||||
*/
|
*/
|
||||||
std::string getHexString(void) const {
|
std::string getHexString() const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "0x" << std::setw(8) << std::setfill('0') << std::hex << get();
|
oss << "0x" << std::setw(8) << std::setfill('0') << std::hex << get();
|
||||||
return oss.str();
|
return oss.str();
|
||||||
@ -176,7 +176,7 @@ namespace etk {
|
|||||||
* @brief Convert the color in an generic string value ("#FEDCBA98")
|
* @brief Convert the color in an generic string value ("#FEDCBA98")
|
||||||
* @return The formated string
|
* @return The formated string
|
||||||
*/
|
*/
|
||||||
std::string getString(void) const {
|
std::string getString() const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "#" << std::setw(8) << std::setfill('0') << std::hex << get();
|
oss << "#" << std::setw(8) << std::setfill('0') << std::hex << get();
|
||||||
return oss.str();
|
return oss.str();
|
||||||
@ -185,28 +185,28 @@ namespace etk {
|
|||||||
* @brief Get red color.
|
* @brief Get red color.
|
||||||
* @return The red color.
|
* @return The red color.
|
||||||
*/
|
*/
|
||||||
MY_TYPE r(void) const {
|
MY_TYPE r() const {
|
||||||
return m_r;
|
return m_r;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Get green color.
|
* @brief Get green color.
|
||||||
* @return The green color.
|
* @return The green color.
|
||||||
*/
|
*/
|
||||||
MY_TYPE g(void) const {
|
MY_TYPE g() const {
|
||||||
return m_g;
|
return m_g;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Get blue color.
|
* @brief Get blue color.
|
||||||
* @return The blue color.
|
* @return The blue color.
|
||||||
*/
|
*/
|
||||||
MY_TYPE b(void) const {
|
MY_TYPE b() const {
|
||||||
return m_b;
|
return m_b;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Get alpha blending.
|
* @brief Get alpha blending.
|
||||||
* @return The alpha blending.
|
* @return The alpha blending.
|
||||||
*/
|
*/
|
||||||
MY_TYPE a(void) const {
|
MY_TYPE a() const {
|
||||||
return m_a;
|
return m_a;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
@ -77,14 +77,14 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Destructor of the Hash table(clear all element in the table)
|
* @brief Destructor of the Hash table(clear all element in the table)
|
||||||
*/
|
*/
|
||||||
~Hash(void) {
|
~Hash() {
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Remove all entry in the Hash table.
|
* @brief Remove all entry in the Hash table.
|
||||||
* @note It does not delete pointer if your value is a pointer type...
|
* @note It does not delete pointer if your value is a pointer type...
|
||||||
*/
|
*/
|
||||||
void clear(void) {
|
void clear() {
|
||||||
for (size_t iii = 0; iii < m_data.size(); ++iii) {
|
for (size_t iii = 0; iii < m_data.size(); ++iii) {
|
||||||
if (m_data[iii] != NULL) {
|
if (m_data[iii] != NULL) {
|
||||||
delete(m_data[iii]);
|
delete(m_data[iii]);
|
||||||
@ -194,7 +194,7 @@ namespace etk {
|
|||||||
* @brief Get the number of element in the hash table
|
* @brief Get the number of element in the hash table
|
||||||
* @return number of elements
|
* @return number of elements
|
||||||
*/
|
*/
|
||||||
int32_t size(void) const {
|
int32_t size() const {
|
||||||
return m_data.size();
|
return m_data.size();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -230,7 +230,7 @@ namespace etk {
|
|||||||
* @brief Get all the element name (keys).
|
* @brief Get all the element name (keys).
|
||||||
* @return a vector of all name (key).
|
* @return a vector of all name (key).
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> getKeys(void) const {
|
std::vector<std::string> getKeys() const {
|
||||||
std::vector<std::string> keys;
|
std::vector<std::string> keys;
|
||||||
for (size_t iii = 0; iii < m_data.size(); ++iii) {
|
for (size_t iii = 0; iii < m_data.size(); ++iii) {
|
||||||
if (m_data[iii] != NULL) {
|
if (m_data[iii] != NULL) {
|
||||||
|
@ -28,7 +28,7 @@ etk::BaseNoise::BaseNoise(ivec2 _size, float _min, float _max) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::BaseNoise::~BaseNoise(void)
|
etk::BaseNoise::~BaseNoise()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ etk::Noise::Noise(enum noise _type, ivec2 _size, int32_t _depth) :
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::Noise::~Noise(void)
|
etk::Noise::~Noise()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace etk {
|
|||||||
ivec2 m_size;
|
ivec2 m_size;
|
||||||
public:
|
public:
|
||||||
BaseNoise(ivec2 _size, float _min, float _max);
|
BaseNoise(ivec2 _size, float _min, float _max);
|
||||||
~BaseNoise(void);
|
~BaseNoise();
|
||||||
float get(int32_t _x, int32_t _y) const;
|
float get(int32_t _x, int32_t _y) const;
|
||||||
};
|
};
|
||||||
class Noise {
|
class Noise {
|
||||||
@ -44,7 +44,7 @@ namespace etk {
|
|||||||
float turbulenceNoSmooth(float _x, float _y, float _size, const etk::BaseNoise& _noise);
|
float turbulenceNoSmooth(float _x, float _y, float _size, const etk::BaseNoise& _noise);
|
||||||
public:
|
public:
|
||||||
Noise(enum noise _type, ivec2 _size, int32_t _depth);
|
Noise(enum noise _type, ivec2 _size, int32_t _depth);
|
||||||
~Noise(void);
|
~Noise();
|
||||||
float get(int32_t _x, int32_t _y) const;
|
float get(int32_t _x, int32_t _y) const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
88
etk/RegExp.h
88
etk/RegExp.h
@ -154,7 +154,7 @@ template<class CLASS_TYPE> class RegExpNode {
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNode(void) :
|
RegExpNode() :
|
||||||
m_multipleMin(1),
|
m_multipleMin(1),
|
||||||
m_multipleMax(1) {
|
m_multipleMax(1) {
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ template<class CLASS_TYPE> class RegExpNode {
|
|||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~RegExpNode(void) { };
|
virtual ~RegExpNode() { };
|
||||||
/**
|
/**
|
||||||
* @brief Generate the regular expression with the current "converted string"
|
* @brief Generate the regular expression with the current "converted string"
|
||||||
* @param[in] _data Property of the regexp
|
* @param[in] _data Property of the regexp
|
||||||
@ -202,14 +202,14 @@ template<class CLASS_TYPE> class RegExpNode {
|
|||||||
* @brief Get the minimum multiplicity.
|
* @brief Get the minimum multiplicity.
|
||||||
* @return The minimum appear availlable.
|
* @return The minimum appear availlable.
|
||||||
*/
|
*/
|
||||||
uint32_t getMultMin(void) const {
|
uint32_t getMultMin() const {
|
||||||
return m_multipleMin;
|
return m_multipleMin;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Get the maximum multiplicity.
|
* @brief Get the maximum multiplicity.
|
||||||
* @return The maximum appear availlable.
|
* @return The maximum appear availlable.
|
||||||
*/
|
*/
|
||||||
uint32_t getMultMax(void) const {
|
uint32_t getMultMax() const {
|
||||||
return m_multipleMax;
|
return m_multipleMax;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -226,12 +226,12 @@ template<class CLASS_TYPE> class RegExpNodeValue : public etk::RegExpNode<CLASS_
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeValue(void) { };
|
RegExpNodeValue() { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeValue(void) { };
|
~RegExpNodeValue() { };
|
||||||
|
|
||||||
int32_t generate(const std::vector<char32_t>& _data) {
|
int32_t generate(const std::vector<char32_t>& _data) {
|
||||||
RegExpNode<CLASS_TYPE>::m_RegExpData = _data;
|
RegExpNode<CLASS_TYPE>::m_RegExpData = _data;
|
||||||
@ -307,11 +307,11 @@ template<class CLASS_TYPE> class RegExpNodeBracket : public etk::RegExpNode<CLAS
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeBracket(void) { };
|
RegExpNodeBracket() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeBracket(void) { };
|
~RegExpNodeBracket() { };
|
||||||
int32_t generate(const std::vector<char32_t>& _data) {
|
int32_t generate(const std::vector<char32_t>& _data) {
|
||||||
RegExpNode<CLASS_TYPE>::m_RegExpData = _data;
|
RegExpNode<CLASS_TYPE>::m_RegExpData = _data;
|
||||||
TK_REG_EXP_DBG_MODE("Request Parse [...] data=" /*<< etk::displayElem(RegExpNode<CLASS_TYPE>::m_RegExpData)*/ );
|
TK_REG_EXP_DBG_MODE("Request Parse [...] data=" /*<< etk::displayElem(RegExpNode<CLASS_TYPE>::m_RegExpData)*/ );
|
||||||
@ -395,11 +395,11 @@ template<class CLASS_TYPE> class RegExpNodeDigit : public etk::RegExpNode<CLASS_
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeDigit(void) { };
|
RegExpNodeDigit() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeDigit(void) { };
|
~RegExpNodeDigit() { };
|
||||||
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
||||||
_findLen = 0;
|
_findLen = 0;
|
||||||
TK_REG_EXP_DBG_MODE("Parse node : Digit{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "} : "<< _data[_currentPos] << " lenMax=" << _lenMax);
|
TK_REG_EXP_DBG_MODE("Parse node : Digit{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "} : "<< _data[_currentPos] << " lenMax=" << _lenMax);
|
||||||
@ -447,11 +447,11 @@ template<class CLASS_TYPE> class RegExpNodeDigitNot : public etk::RegExpNode<CLA
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeDigitNot(void) { };
|
RegExpNodeDigitNot() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeDigitNot(void) { };
|
~RegExpNodeDigitNot() { };
|
||||||
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
||||||
_findLen = 0;
|
_findLen = 0;
|
||||||
TK_REG_EXP_DBG_MODE("Parse node : DigitNot{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
TK_REG_EXP_DBG_MODE("Parse node : DigitNot{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
@ -492,11 +492,11 @@ template<class CLASS_TYPE> class RegExpNodeLetter : public etk::RegExpNode<CLASS
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeLetter(void) { };
|
RegExpNodeLetter() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeLetter(void) { };
|
~RegExpNodeLetter() { };
|
||||||
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
||||||
_findLen = 0;
|
_findLen = 0;
|
||||||
TK_REG_EXP_DBG_MODE("Parse node : Letter{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
TK_REG_EXP_DBG_MODE("Parse node : Letter{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
@ -542,11 +542,11 @@ template<class CLASS_TYPE> class RegExpNodeLetterNot : public etk::RegExpNode<CL
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeLetterNot(void) { };
|
RegExpNodeLetterNot() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeLetterNot(void) { };
|
~RegExpNodeLetterNot() { };
|
||||||
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
||||||
_findLen = 0;
|
_findLen = 0;
|
||||||
TK_REG_EXP_DBG_MODE("Parse node : LetterNot{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
TK_REG_EXP_DBG_MODE("Parse node : LetterNot{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
@ -592,11 +592,11 @@ template<class CLASS_TYPE> class RegExpNodeWhiteSpace : public etk::RegExpNode<C
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeWhiteSpace(void) { };
|
RegExpNodeWhiteSpace() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeWhiteSpace(void) { };
|
~RegExpNodeWhiteSpace() { };
|
||||||
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
||||||
_findLen = 0;
|
_findLen = 0;
|
||||||
TK_REG_EXP_DBG_MODE("Parse node : Space{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
TK_REG_EXP_DBG_MODE("Parse node : Space{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
@ -644,11 +644,11 @@ template<class CLASS_TYPE> class RegExpNodeWhiteSpaceNot : public etk::RegExpNod
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeWhiteSpaceNot(void) { };
|
RegExpNodeWhiteSpaceNot() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeWhiteSpaceNot(void) { };
|
~RegExpNodeWhiteSpaceNot() { };
|
||||||
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
||||||
_findLen = 0;
|
_findLen = 0;
|
||||||
TK_REG_EXP_DBG_MODE("Parse node : SpaceNot{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
TK_REG_EXP_DBG_MODE("Parse node : SpaceNot{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
@ -696,11 +696,11 @@ template<class CLASS_TYPE> class RegExpNodeWordChar : public etk::RegExpNode<CLA
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeWordChar(void) { };
|
RegExpNodeWordChar() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeWordChar(void) { };
|
~RegExpNodeWordChar() { };
|
||||||
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
||||||
_findLen = 0;
|
_findLen = 0;
|
||||||
TK_REG_EXP_DBG_MODE("Parse node : Word{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
TK_REG_EXP_DBG_MODE("Parse node : Word{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
@ -747,11 +747,11 @@ template<class CLASS_TYPE> class RegExpNodeWordCharNot : public etk::RegExpNode<
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeWordCharNot(void) { };
|
RegExpNodeWordCharNot() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeWordCharNot(void) { };
|
~RegExpNodeWordCharNot() { };
|
||||||
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
||||||
_findLen = 0;
|
_findLen = 0;
|
||||||
TK_REG_EXP_DBG_MODE("Parse node : WordNot{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
TK_REG_EXP_DBG_MODE("Parse node : WordNot{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
@ -799,11 +799,11 @@ template<class CLASS_TYPE> class RegExpNodeDot : public etk::RegExpNode<CLASS_TY
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeDot(void) { };
|
RegExpNodeDot() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeDot(void) { };
|
~RegExpNodeDot() { };
|
||||||
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
||||||
_findLen = 0;
|
_findLen = 0;
|
||||||
TK_REG_EXP_DBG_MODE("Parse node : '.'{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
TK_REG_EXP_DBG_MODE("Parse node : '.'{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
@ -853,11 +853,11 @@ template<class CLASS_TYPE> class RegExpNodeSOL : public etk::RegExpNode<CLASS_TY
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeSOL(void) { };
|
RegExpNodeSOL() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeSOL(void) { };
|
~RegExpNodeSOL() { };
|
||||||
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
||||||
_findLen = 0;
|
_findLen = 0;
|
||||||
// TODO : ...
|
// TODO : ...
|
||||||
@ -883,11 +883,11 @@ template<class CLASS_TYPE> class RegExpNodeEOL : public etk::RegExpNode<CLASS_TY
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodeEOL(void) { };
|
RegExpNodeEOL() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodeEOL(void) { };
|
~RegExpNodeEOL() { };
|
||||||
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
virtual bool parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, int64_t& _findLen) {
|
||||||
_findLen = 0;
|
_findLen = 0;
|
||||||
// TODO : ...
|
// TODO : ...
|
||||||
@ -924,11 +924,11 @@ template<class CLASS_TYPE> class RegExpNodePTheseElem : public etk::RegExpNode<C
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodePTheseElem(void) { };
|
RegExpNodePTheseElem() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodePTheseElem(void) { };
|
~RegExpNodePTheseElem() { };
|
||||||
int32_t generate(const std::vector<char32_t>& _data) {
|
int32_t generate(const std::vector<char32_t>& _data) {
|
||||||
RegExpNode<CLASS_TYPE>::m_RegExpData = _data;
|
RegExpNode<CLASS_TYPE>::m_RegExpData = _data;
|
||||||
TK_REG_EXP_DBG_MODE("Request Parse (elem) data=" /*<< etk::displayElem(RegExpNode<CLASS_TYPE>::m_RegExpData)*/ );
|
TK_REG_EXP_DBG_MODE("Request Parse (elem) data=" /*<< etk::displayElem(RegExpNode<CLASS_TYPE>::m_RegExpData)*/ );
|
||||||
@ -1125,11 +1125,11 @@ template<class CLASS_TYPE> class RegExpNodePThese : public etk::RegExpNode<CLASS
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
RegExpNodePThese(void) { };
|
RegExpNodePThese() { };
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExpNodePThese(void) { }
|
~RegExpNodePThese() { }
|
||||||
int32_t generate(const std::vector<char32_t>& _data) {
|
int32_t generate(const std::vector<char32_t>& _data) {
|
||||||
RegExpNode<CLASS_TYPE>::m_RegExpData = _data;
|
RegExpNode<CLASS_TYPE>::m_RegExpData = _data;
|
||||||
TK_REG_EXP_DBG_MODE("Request Parse (...) data=" /*<< etk::displayElem(RegExpNode<CLASS_TYPE>::m_RegExpData)*/ );
|
TK_REG_EXP_DBG_MODE("Request Parse (...) data=" /*<< etk::displayElem(RegExpNode<CLASS_TYPE>::m_RegExpData)*/ );
|
||||||
@ -1206,7 +1206,7 @@ template<class CLASS_TYPE> class RegExpNodePThese : public etk::RegExpNode<CLASS
|
|||||||
/**
|
/**
|
||||||
* @brief Just display the regExp in color ...
|
* @brief Just display the regExp in color ...
|
||||||
*/
|
*/
|
||||||
void drawColoredRegEx(void) {
|
void drawColoredRegEx() {
|
||||||
TK_INFO("regExp :" /*<< etk::displayElem(RegExpNode<CLASS_TYPE>::m_RegExpData)*/ );
|
TK_INFO("regExp :" /*<< etk::displayElem(RegExpNode<CLASS_TYPE>::m_RegExpData)*/ );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1291,7 +1291,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
~RegExp(void) {
|
~RegExp() {
|
||||||
m_isOk = false;
|
m_isOk = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1445,13 +1445,13 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
* @brief Get the regular expression string
|
* @brief Get the regular expression string
|
||||||
* @return the string representing the RegExp
|
* @return the string representing the RegExp
|
||||||
*/
|
*/
|
||||||
std::string getRegExp(void) const {
|
std::string getRegExp() const {
|
||||||
return std::to_string(m_expressionRequested);
|
return std::to_string(m_expressionRequested);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @previous
|
* @previous
|
||||||
*/
|
*/
|
||||||
const std::u32string& getURegExp(void) const {
|
const std::u32string& getURegExp() const {
|
||||||
return m_expressionRequested;
|
return m_expressionRequested;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1460,7 +1460,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
* @return true : the regExp is correctly parsed
|
* @return true : the regExp is correctly parsed
|
||||||
* @return false : an error occcured (check log ...)
|
* @return false : an error occcured (check log ...)
|
||||||
*/
|
*/
|
||||||
bool getStatus(void) {
|
bool getStatus() {
|
||||||
return m_isOk;
|
return m_isOk;
|
||||||
};
|
};
|
||||||
// process the regular expression
|
// process the regular expression
|
||||||
@ -1618,7 +1618,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
* @brief Get the expression start position detected
|
* @brief Get the expression start position detected
|
||||||
* @return position of the start regExp
|
* @return position of the start regExp
|
||||||
*/
|
*/
|
||||||
int64_t start(void) {
|
int64_t start() {
|
||||||
return m_areaFind.start;
|
return m_areaFind.start;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1626,27 +1626,27 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
* @brief Get the expression stop position detected
|
* @brief Get the expression stop position detected
|
||||||
* @return position of the stop regExp
|
* @return position of the stop regExp
|
||||||
*/
|
*/
|
||||||
int64_t stop(void) {
|
int64_t stop() {
|
||||||
return m_areaFind.stop;
|
return m_areaFind.stop;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Display the reg Exp
|
* @brief Display the reg Exp
|
||||||
*/
|
*/
|
||||||
void display(void) {
|
void display() {
|
||||||
m_exprRootNode.display(0);
|
m_exprRootNode.display(0);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Just display the regExp in color ...
|
* @brief Just display the regExp in color ...
|
||||||
*/
|
*/
|
||||||
void drawColoredRegEx(void) {
|
void drawColoredRegEx() {
|
||||||
m_exprRootNode.drawColoredRegEx();
|
m_exprRootNode.drawColoredRegEx();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Get decorated regular expression. This generate a [class[ewol::compositing::Text]] decoration text. Note that can be use in [class[ewol::widget::Label]].
|
* @brief Get decorated regular expression. This generate a [class[ewol::compositing::Text]] decoration text. Note that can be use in [class[ewol::widget::Label]].
|
||||||
* @return The decorated string
|
* @return The decorated string
|
||||||
*/
|
*/
|
||||||
std::string getRegExDecorated(void) {
|
std::string getRegExDecorated() {
|
||||||
// TODO : do it...
|
// TODO : do it...
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ bool etk::Archive::exist(const std::string& _key) const {
|
|||||||
return m_content.find(_key) != m_content.end();
|
return m_content.find(_key) != m_content.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void etk::Archive::display(void)
|
void etk::Archive::display()
|
||||||
{
|
{
|
||||||
for (auto &it : m_content) {
|
for (auto &it : m_content) {
|
||||||
int32_t size = it.second.getTheoricSize();
|
int32_t size = it.second.getTheoricSize();
|
||||||
|
@ -20,19 +20,19 @@ namespace etk {
|
|||||||
private:
|
private:
|
||||||
int32_t m_link; //!< number of element open on this file
|
int32_t m_link; //!< number of element open on this file
|
||||||
public:
|
public:
|
||||||
void increaseRef(void) {
|
void increaseRef() {
|
||||||
m_link++;
|
m_link++;
|
||||||
};
|
};
|
||||||
void decreaseRef(void) {
|
void decreaseRef() {
|
||||||
m_link--;
|
m_link--;
|
||||||
};
|
};
|
||||||
int32_t getNumberOfRef(void) const {
|
int32_t getNumberOfRef() const {
|
||||||
return m_link;
|
return m_link;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
int32_t m_theoricSize; //!< number of element open on this file
|
int32_t m_theoricSize; //!< number of element open on this file
|
||||||
public:
|
public:
|
||||||
int32_t getTheoricSize(void) const {
|
int32_t getTheoricSize() const {
|
||||||
return m_theoricSize;
|
return m_theoricSize;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
@ -41,13 +41,13 @@ namespace etk {
|
|||||||
Content(int32_t _basicSize=0) :
|
Content(int32_t _basicSize=0) :
|
||||||
m_link(-1),
|
m_link(-1),
|
||||||
m_theoricSize(_basicSize) { };
|
m_theoricSize(_basicSize) { };
|
||||||
int32_t size(void) const {
|
int32_t size() const {
|
||||||
return m_data.size();
|
return m_data.size();
|
||||||
};
|
};
|
||||||
void* data(void) const {
|
void* data() const {
|
||||||
return (void*)&m_data[0];
|
return (void*)&m_data[0];
|
||||||
};
|
};
|
||||||
std::vector<char>& getDataVector(void) {
|
std::vector<char>& getDataVector() {
|
||||||
return m_data;
|
return m_data;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -56,7 +56,7 @@ namespace etk {
|
|||||||
m_fileName(_fileName) {
|
m_fileName(_fileName) {
|
||||||
|
|
||||||
};
|
};
|
||||||
virtual ~Archive(void) { };
|
virtual ~Archive() { };
|
||||||
protected:
|
protected:
|
||||||
std::string m_fileName; //!< File name when it came from an file
|
std::string m_fileName; //!< File name when it came from an file
|
||||||
public:
|
public:
|
||||||
@ -64,7 +64,7 @@ namespace etk {
|
|||||||
* @brief Get the current file name.
|
* @brief Get the current file name.
|
||||||
* @return the requested file name.
|
* @return the requested file name.
|
||||||
*/
|
*/
|
||||||
const std::string& getFileName(void) {
|
const std::string& getFileName() {
|
||||||
return m_fileName;
|
return m_fileName;
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
@ -74,7 +74,7 @@ namespace etk {
|
|||||||
* @brief Get the number of elements
|
* @brief Get the number of elements
|
||||||
* @return nb files in the archive
|
* @return nb files in the archive
|
||||||
*/
|
*/
|
||||||
int32_t size(void) const {
|
int32_t size() const {
|
||||||
return m_content.size();
|
return m_content.size();
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -114,7 +114,7 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Display all Element in the archive
|
* @brief Display all Element in the archive
|
||||||
*/
|
*/
|
||||||
void display(void);
|
void display();
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Request the load in memory of the concerned file.
|
* @brief Request the load in memory of the concerned file.
|
||||||
|
@ -48,7 +48,7 @@ etk::archive::Zip::Zip(const std::string& _fileName) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::archive::Zip::~Zip(void) {
|
etk::archive::Zip::~Zip() {
|
||||||
if (m_ctx!= NULL) {
|
if (m_ctx!= NULL) {
|
||||||
unzClose(m_ctx);
|
unzClose(m_ctx);
|
||||||
m_ctx = NULL;
|
m_ctx = NULL;
|
||||||
|
@ -22,7 +22,7 @@ namespace etk {
|
|||||||
unz_global_info m_info; //!< global information of the Zip
|
unz_global_info m_info; //!< global information of the Zip
|
||||||
public:
|
public:
|
||||||
Zip(const std::string& _fileName);
|
Zip(const std::string& _fileName);
|
||||||
virtual ~Zip(void);
|
virtual ~Zip();
|
||||||
protected: // herited functions :
|
protected: // herited functions :
|
||||||
virtual void loadFile(const std::map<std::string, Content>::iterator& it);
|
virtual void loadFile(const std::map<std::string, Content>::iterator& it);
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <etk/debug.h>
|
#include <etk/debug.h>
|
||||||
|
|
||||||
int32_t etk::getLogId(void) {
|
int32_t etk::getLogId() {
|
||||||
static int32_t g_val = etk::log::registerInstance("etk");
|
static int32_t g_val = etk::log::registerInstance("etk");
|
||||||
return g_val;
|
return g_val;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <etk/log.h>
|
#include <etk/log.h>
|
||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
int32_t getLogId(void);
|
int32_t getLogId();
|
||||||
};
|
};
|
||||||
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
|
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
|
||||||
#define ETK_BASE(info,data) \
|
#define ETK_BASE(info,data) \
|
||||||
|
14
etk/log.cpp
14
etk/log.cpp
@ -70,12 +70,12 @@
|
|||||||
#define DEFAULT_LOG_TIME true
|
#define DEFAULT_LOG_TIME true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum etk::log::level& getDefaultLevel(void) {
|
enum etk::log::level& getDefaultLevel() {
|
||||||
static enum etk::log::level g_val = DEFAULT_LOG_LEVEL;
|
static enum etk::log::level g_val = DEFAULT_LOG_LEVEL;
|
||||||
return g_val;
|
return g_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::pair<std::string, enum etk::log::level>>& getList(void) {
|
std::vector<std::pair<std::string, enum etk::log::level>>& getList() {
|
||||||
static std::vector<std::pair<std::string, enum etk::log::level>> g_val;
|
static std::vector<std::pair<std::string, enum etk::log::level>> g_val;
|
||||||
return g_val;
|
return g_val;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ int32_t etk::log::getLevel(int32_t _id) {
|
|||||||
return (int32_t)getList()[_id].second;
|
return (int32_t)getList()[_id].second;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> etk::log::getListInstance(void) {
|
std::vector<std::string> etk::log::getListInstance() {
|
||||||
std::vector<std::string> out;
|
std::vector<std::string> out;
|
||||||
for (size_t iii = 0; iii < getList().size(); ++iii) {
|
for (size_t iii = 0; iii < getList().size(); ++iii) {
|
||||||
out.push_back(getList()[iii].first);
|
out.push_back(getList()[iii].first);
|
||||||
@ -151,7 +151,7 @@ void etk::log::logStream1(int32_t _id, int32_t _level, const std::ostream& _log)
|
|||||||
etk::log::logChar(_id, _level, -1, NULL, NULL, sss.c_str());
|
etk::log::logChar(_id, _level, -1, NULL, NULL, sss.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool& getColor(void) {
|
static bool& getColor() {
|
||||||
static bool g_val = DEFAULT_LOG_COLOR;
|
static bool g_val = DEFAULT_LOG_COLOR;
|
||||||
return g_val;
|
return g_val;
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ void etk::log::setColor(bool _status) {
|
|||||||
getColor() = _status;
|
getColor() = _status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool& getTime(void) {
|
static bool& getTime() {
|
||||||
static bool g_val = DEFAULT_LOG_TIME;
|
static bool g_val = DEFAULT_LOG_TIME;
|
||||||
return g_val;
|
return g_val;
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ void etk::log::setTime(bool _status) {
|
|||||||
getTime() = _status;
|
getTime() = _status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool& getLine(void) {
|
static bool& getLine() {
|
||||||
static bool g_val = DEFAULT_LOG_LINE;
|
static bool g_val = DEFAULT_LOG_LINE;
|
||||||
return g_val;
|
return g_val;
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ void etk::log::setLine(bool _status) {
|
|||||||
getLine() = _status;
|
getLine() = _status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool& getFunction(void) {
|
static bool& getFunction() {
|
||||||
static bool g_val = DEFAULT_LOG_CLASS;
|
static bool g_val = DEFAULT_LOG_CLASS;
|
||||||
return g_val;
|
return g_val;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace etk {
|
|||||||
* @brief Get list of all intance
|
* @brief Get list of all intance
|
||||||
* @return the name list of all intance
|
* @return the name list of all intance
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> getListInstance(void);
|
std::vector<std::string> getListInstance();
|
||||||
/**
|
/**
|
||||||
* @brief Set Color enable or disable.
|
* @brief Set Color enable or disable.
|
||||||
* @param[in] _status New value of color.
|
* @param[in] _status New value of color.
|
||||||
|
@ -85,7 +85,7 @@ namespace etk
|
|||||||
/*****************************************************
|
/*****************************************************
|
||||||
* Destructor
|
* Destructor
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
virtual ~Matrix(void) {};
|
virtual ~Matrix() {};
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
* = assigment
|
* = assigment
|
||||||
@ -255,7 +255,7 @@ namespace etk
|
|||||||
/*****************************************************
|
/*****************************************************
|
||||||
* - operator
|
* - operator
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
Matrix<T> operator - (void) {
|
Matrix<T> operator - () {
|
||||||
Matrix<T> tmp(m_size);
|
Matrix<T> tmp(m_size);
|
||||||
for (int32_t iii=0; iii<m_data.Size(); iii++) {
|
for (int32_t iii=0; iii<m_data.Size(); iii++) {
|
||||||
tmp.m_data[iii] = -m_data[iii];
|
tmp.m_data[iii] = -m_data[iii];
|
||||||
@ -268,7 +268,7 @@ namespace etk
|
|||||||
* @ brief Transpose Matrix
|
* @ brief Transpose Matrix
|
||||||
* @ return the transpose matrix
|
* @ return the transpose matrix
|
||||||
*/
|
*/
|
||||||
Matrix<T> transpose(void)
|
Matrix<T> transpose()
|
||||||
{
|
{
|
||||||
// create a matrix with the inverted size
|
// create a matrix with the inverted size
|
||||||
Matrix<T> tmpMatrix(m_size.x, m_size.y);
|
Matrix<T> tmpMatrix(m_size.x, m_size.y);
|
||||||
@ -379,7 +379,7 @@ namespace etk
|
|||||||
* x x x x x
|
* x x x x x
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
void clearUpperTriangle(void)
|
void clearUpperTriangle()
|
||||||
{
|
{
|
||||||
if (m_size.x != m_size.y) {
|
if (m_size.x != m_size.y) {
|
||||||
TK_WARNING("better to do with square Matrix");
|
TK_WARNING("better to do with square Matrix");
|
||||||
@ -400,7 +400,7 @@ namespace etk
|
|||||||
* 0 0 0 0 x
|
* 0 0 0 0 x
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
void clearLowerTriangle(void)
|
void clearLowerTriangle()
|
||||||
{
|
{
|
||||||
if (m_size.x != m_size.y) {
|
if (m_size.x != m_size.y) {
|
||||||
TK_WARNING("better to do with square Matrix");
|
TK_WARNING("better to do with square Matrix");
|
||||||
@ -447,7 +447,7 @@ namespace etk
|
|||||||
/**
|
/**
|
||||||
* @brief Clear all the matrix.
|
* @brief Clear all the matrix.
|
||||||
*/
|
*/
|
||||||
void clear(void) {
|
void clear() {
|
||||||
// copy data for the same size :
|
// copy data for the same size :
|
||||||
for (int32_t iii=0; iii< m_size.x*m_size.y; iii++) {
|
for (int32_t iii=0; iii< m_size.x*m_size.y; iii++) {
|
||||||
m_data[iii] = (T)0;
|
m_data[iii] = (T)0;
|
||||||
@ -456,7 +456,7 @@ namespace etk
|
|||||||
/**
|
/**
|
||||||
* @brief Set the diagonal at 1
|
* @brief Set the diagonal at 1
|
||||||
*/
|
*/
|
||||||
void identity(void)
|
void identity()
|
||||||
{
|
{
|
||||||
// copy data for the same size :
|
// copy data for the same size :
|
||||||
for (int32_t iii=0; iii< etk_min(m_size.x, m_size.y); iii++) {
|
for (int32_t iii=0; iii< etk_min(m_size.x, m_size.y); iii++) {
|
||||||
@ -466,7 +466,7 @@ namespace etk
|
|||||||
/**
|
/**
|
||||||
* @brief Clear and set the diagonal at 1
|
* @brief Clear and set the diagonal at 1
|
||||||
*/
|
*/
|
||||||
void eye(void)
|
void eye()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
identity();
|
identity();
|
||||||
@ -475,7 +475,7 @@ namespace etk
|
|||||||
* @brief Get the size of the current Matrix.
|
* @brief Get the size of the current Matrix.
|
||||||
* @return Dimention of the matrix
|
* @return Dimention of the matrix
|
||||||
*/
|
*/
|
||||||
Vector2D<int32_t> size(void)
|
Vector2D<int32_t> size()
|
||||||
{
|
{
|
||||||
return m_size;
|
return m_size;
|
||||||
};
|
};
|
||||||
|
@ -21,7 +21,7 @@ namespace etk {
|
|||||||
class Matrix4 {
|
class Matrix4 {
|
||||||
public:
|
public:
|
||||||
float m_mat[4*4];
|
float m_mat[4*4];
|
||||||
void identity(void) {
|
void identity() {
|
||||||
for(int32_t iii=0; iii<4*4 ; iii++) {
|
for(int32_t iii=0; iii<4*4 ; iii++) {
|
||||||
m_mat[iii] = 0;
|
m_mat[iii] = 0;
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ namespace etk {
|
|||||||
/*****************************************************
|
/*****************************************************
|
||||||
* Constructor
|
* Constructor
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
Matrix4(void) {
|
Matrix4() {
|
||||||
identity();
|
identity();
|
||||||
}
|
}
|
||||||
Matrix4(const Matrix4& obj) {
|
Matrix4(const Matrix4& obj) {
|
||||||
@ -74,7 +74,7 @@ namespace etk {
|
|||||||
/*****************************************************
|
/*****************************************************
|
||||||
* Destructor
|
* Destructor
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
virtual ~Matrix4(void) {
|
virtual ~Matrix4() {
|
||||||
|
|
||||||
}
|
}
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
@ -185,7 +185,7 @@ namespace etk {
|
|||||||
/*****************************************************
|
/*****************************************************
|
||||||
* other basic function :
|
* other basic function :
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
void transpose(void)
|
void transpose()
|
||||||
{
|
{
|
||||||
float tmpVal = m_mat[1];
|
float tmpVal = m_mat[1];
|
||||||
m_mat[1] = m_mat[4];
|
m_mat[1] = m_mat[4];
|
||||||
@ -243,13 +243,13 @@ namespace etk {
|
|||||||
* @brief Computes the determinant of the matrix.
|
* @brief Computes the determinant of the matrix.
|
||||||
* @return The determinent Value.
|
* @return The determinent Value.
|
||||||
*/
|
*/
|
||||||
float determinant(void) const;
|
float determinant() const;
|
||||||
/**
|
/**
|
||||||
* @brief Inverts the matrix.
|
* @brief Inverts the matrix.
|
||||||
* @note The determinant must be != 0, otherwithe the matrix can't be inverted.
|
* @note The determinant must be != 0, otherwithe the matrix can't be inverted.
|
||||||
* @return The inverted matrix.
|
* @return The inverted matrix.
|
||||||
*/
|
*/
|
||||||
Matrix4 invert(void);
|
Matrix4 invert();
|
||||||
};
|
};
|
||||||
Matrix4 matFrustum(float xmin, float xmax, float ymin, float ymax, float zNear, float zFar);
|
Matrix4 matFrustum(float xmin, float xmax, float ymin, float ymax, float zNear, float zFar);
|
||||||
Matrix4 matPerspective(float foxy, float aspect, float zNear, float zFar);
|
Matrix4 matPerspective(float foxy, float aspect, float zNear, float zFar);
|
||||||
|
@ -24,7 +24,7 @@ namespace etk {
|
|||||||
/*****************************************************
|
/*****************************************************
|
||||||
* Constructor
|
* Constructor
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
Plane(void) :
|
Plane() :
|
||||||
m_normal(0, 0, 0),
|
m_normal(0, 0, 0),
|
||||||
m_intercept(0) {
|
m_intercept(0) {
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ namespace etk {
|
|||||||
/*****************************************************
|
/*****************************************************
|
||||||
* Destructor
|
* Destructor
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
~Plane(void) {
|
~Plane() {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ namespace etk {
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void normalize(void) {
|
void normalize() {
|
||||||
float normalLength=m_normal.getLength();
|
float normalLength=m_normal.getLength();
|
||||||
m_normal/=normalLength;
|
m_normal/=normalLength;
|
||||||
m_intercept/=normalLength;
|
m_intercept/=normalLength;
|
||||||
@ -102,7 +102,7 @@ namespace etk {
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
etk::Vector3D<T> getNormal(void) {
|
etk::Vector3D<T> getNormal() {
|
||||||
return m_normal;
|
return m_normal;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ namespace etk {
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
float getIntercept(void) {
|
float getIntercept() {
|
||||||
return m_intercept;
|
return m_intercept;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ namespace etk {
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Plane<T> operator-(void) const {
|
Plane<T> operator-() const {
|
||||||
return Plane<T>(-m_normal, -m_intercept);
|
return Plane<T>(-m_normal, -m_intercept);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ namespace etk {
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Plane<T> operator+(void) const {
|
Plane<T> operator+() const {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -85,7 +85,7 @@ std::ostream& etk::operator <<(std::ostream& _os, const std::vector<bvec2 >& _ob
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
template<> Vector2D<bool>::operator std::string(void) const {
|
template<> Vector2D<bool>::operator std::string() const {
|
||||||
std::string str;
|
std::string str;
|
||||||
str = "(";
|
str = "(";
|
||||||
str += std::to_string(x());
|
str += std::to_string(x());
|
||||||
@ -94,7 +94,7 @@ namespace etk {
|
|||||||
str += ")";
|
str += ")";
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
template<> Vector2D<bool>::operator std::u32string(void) const {
|
template<> Vector2D<bool>::operator std::u32string() const {
|
||||||
std::u32string str;
|
std::u32string str;
|
||||||
str = U"(";
|
str = U"(";
|
||||||
str += std::to_u32string(x());
|
str += std::to_u32string(x());
|
||||||
@ -153,7 +153,7 @@ namespace etk {
|
|||||||
TK_VERBOSE("Parse : '" << _str << "' ==> " << *this);
|
TK_VERBOSE("Parse : '" << _str << "' ==> " << *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> Vector2D<int32_t>::operator std::string(void) const {
|
template<> Vector2D<int32_t>::operator std::string() const {
|
||||||
std::string str;
|
std::string str;
|
||||||
str = "(";
|
str = "(";
|
||||||
str += std::to_string(x());
|
str += std::to_string(x());
|
||||||
@ -162,7 +162,7 @@ namespace etk {
|
|||||||
str += ")";
|
str += ")";
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
template<> Vector2D<int32_t>::operator std::u32string(void) const {
|
template<> Vector2D<int32_t>::operator std::u32string() const {
|
||||||
std::u32string str;
|
std::u32string str;
|
||||||
str = U"(";
|
str = U"(";
|
||||||
str += std::to_u32string(x());
|
str += std::to_u32string(x());
|
||||||
@ -223,7 +223,7 @@ namespace etk {
|
|||||||
TK_VERBOSE("Parse : \"" << _str << "\" ==> " << *this);
|
TK_VERBOSE("Parse : \"" << _str << "\" ==> " << *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> Vector2D<uint32_t>::operator std::string(void) const {
|
template<> Vector2D<uint32_t>::operator std::string() const {
|
||||||
std::string str;
|
std::string str;
|
||||||
str = "(";
|
str = "(";
|
||||||
str += std::to_string(x());
|
str += std::to_string(x());
|
||||||
@ -233,7 +233,7 @@ namespace etk {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> Vector2D<uint32_t>::operator std::u32string(void) const {
|
template<> Vector2D<uint32_t>::operator std::u32string() const {
|
||||||
std::u32string str;
|
std::u32string str;
|
||||||
str = U"(";
|
str = U"(";
|
||||||
str += std::to_u32string(x());
|
str += std::to_u32string(x());
|
||||||
@ -294,7 +294,7 @@ namespace etk {
|
|||||||
TK_VERBOSE("Parse : \"" << _str << "\" ==> " << *this);
|
TK_VERBOSE("Parse : \"" << _str << "\" ==> " << *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> Vector2D<float>::operator std::string(void) const {
|
template<> Vector2D<float>::operator std::string() const {
|
||||||
std::string str;
|
std::string str;
|
||||||
str = "(";
|
str = "(";
|
||||||
str += std::to_string(x());
|
str += std::to_string(x());
|
||||||
@ -303,7 +303,7 @@ namespace etk {
|
|||||||
str += ")";
|
str += ")";
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
template<> Vector2D<float>::operator std::u32string(void) const {
|
template<> Vector2D<float>::operator std::u32string() const {
|
||||||
std::u32string str;
|
std::u32string str;
|
||||||
str = U"(";
|
str = U"(";
|
||||||
str += std::to_u32string(x());
|
str += std::to_u32string(x());
|
||||||
|
@ -23,7 +23,7 @@ namespace etk {
|
|||||||
/* ****************************************************
|
/* ****************************************************
|
||||||
* Constructor
|
* Constructor
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
Vector2D(void) {
|
Vector2D() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// in debug mode we set supid value to prevent forget of the inits ...
|
// in debug mode we set supid value to prevent forget of the inits ...
|
||||||
m_floats[0] = (T)34673363;
|
m_floats[0] = (T)34673363;
|
||||||
@ -49,7 +49,7 @@ namespace etk {
|
|||||||
};
|
};
|
||||||
Vector2D(const std::string& _str);
|
Vector2D(const std::string& _str);
|
||||||
Vector2D(const std::u32string& _str);
|
Vector2D(const std::u32string& _str);
|
||||||
~Vector2D(void) { };
|
~Vector2D() { };
|
||||||
/* ****************************************************
|
/* ****************************************************
|
||||||
* = assigment
|
* = assigment
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
@ -179,7 +179,7 @@ namespace etk {
|
|||||||
/* ****************************************************
|
/* ****************************************************
|
||||||
* ++ operator
|
* ++ operator
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
Vector2D<T>& operator++(void) {
|
Vector2D<T>& operator++() {
|
||||||
++m_floats[0];
|
++m_floats[0];
|
||||||
++m_floats[1];
|
++m_floats[1];
|
||||||
return *this;
|
return *this;
|
||||||
@ -192,7 +192,7 @@ namespace etk {
|
|||||||
/* ****************************************************
|
/* ****************************************************
|
||||||
* -- operator
|
* -- operator
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
Vector2D<T>& operator--(void) {
|
Vector2D<T>& operator--() {
|
||||||
--m_floats[0];
|
--m_floats[0];
|
||||||
--m_floats[1];
|
--m_floats[1];
|
||||||
return *this;
|
return *this;
|
||||||
@ -213,13 +213,13 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Return the length of the vector squared
|
* @brief Return the length of the vector squared
|
||||||
*/
|
*/
|
||||||
btScalar length2(void) const {
|
btScalar length2() const {
|
||||||
return dot(*this);
|
return dot(*this);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Return the length of the vector
|
* @brief Return the length of the vector
|
||||||
*/
|
*/
|
||||||
btScalar length(void) const {
|
btScalar length() const {
|
||||||
return btSqrt(length2());
|
return btSqrt(length2());
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -240,19 +240,19 @@ namespace etk {
|
|||||||
* @brief Normalize this vector
|
* @brief Normalize this vector
|
||||||
* x^2 + y^2 + z^2 = 1
|
* x^2 + y^2 + z^2 = 1
|
||||||
*/
|
*/
|
||||||
Vector3D<T>& normalize(void) {
|
Vector3D<T>& normalize() {
|
||||||
return *this /= length();
|
return *this /= length();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Return a normalized version of this vector
|
* @brief Return a normalized version of this vector
|
||||||
*/
|
*/
|
||||||
Vector2D<T> normalized(void) const {
|
Vector2D<T> normalized() const {
|
||||||
return *this / length();
|
return *this / length();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Return a vector will the absolute values of each element
|
* @brief Return a vector will the absolute values of each element
|
||||||
*/
|
*/
|
||||||
Vector2D<T> absolute(void) const {
|
Vector2D<T> absolute() const {
|
||||||
return Vector2D<T>( abs(m_floats[0]),
|
return Vector2D<T>( abs(m_floats[0]),
|
||||||
abs(m_floats[1]));
|
abs(m_floats[1]));
|
||||||
}
|
}
|
||||||
@ -260,32 +260,32 @@ namespace etk {
|
|||||||
* @brief Return the axis with the smallest value
|
* @brief Return the axis with the smallest value
|
||||||
* Note return values are 0,1,2 for x, y, or z
|
* Note return values are 0,1,2 for x, y, or z
|
||||||
*/
|
*/
|
||||||
int32_t minAxis(void) const {
|
int32_t minAxis() const {
|
||||||
return m_floats[0] < m_floats[1] ? 0 : 1;
|
return m_floats[0] < m_floats[1] ? 0 : 1;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Return the axis with the largest value
|
* @brief Return the axis with the largest value
|
||||||
* Note return values are 0,1,2 for x, y, or z
|
* Note return values are 0,1,2 for x, y, or z
|
||||||
*/
|
*/
|
||||||
int32_t maxAxis(void) const {
|
int32_t maxAxis() const {
|
||||||
return m_floats[0] < m_floats[1] ? 1 : 0;
|
return m_floats[0] < m_floats[1] ? 1 : 0;
|
||||||
}
|
}
|
||||||
int32_t furthestAxis(void) const {
|
int32_t furthestAxis() const {
|
||||||
return absolute().minAxis();
|
return absolute().minAxis();
|
||||||
}
|
}
|
||||||
int32_t closestAxis(void) const {
|
int32_t closestAxis() const {
|
||||||
return absolute().maxAxis();
|
return absolute().maxAxis();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Return the x value
|
* @brief Return the x value
|
||||||
*/
|
*/
|
||||||
const T& getX(void) const {
|
const T& getX() const {
|
||||||
return m_floats[0];
|
return m_floats[0];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Return the y value
|
* @brief Return the y value
|
||||||
*/
|
*/
|
||||||
const T& getY(void) const {
|
const T& getY() const {
|
||||||
return m_floats[1];
|
return m_floats[1];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -303,19 +303,19 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Return the x value
|
* @brief Return the x value
|
||||||
*/
|
*/
|
||||||
const T& x(void) const {
|
const T& x() const {
|
||||||
return m_floats[0];
|
return m_floats[0];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Return the y value
|
* @brief Return the y value
|
||||||
*/
|
*/
|
||||||
const T& y(void) const {
|
const T& y() const {
|
||||||
return m_floats[1];
|
return m_floats[1];
|
||||||
}
|
}
|
||||||
operator T *(void) {
|
operator T *() {
|
||||||
return &m_floats[0];
|
return &m_floats[0];
|
||||||
}
|
}
|
||||||
operator const T *(void) const {
|
operator const T *() const {
|
||||||
return &m_floats[0];
|
return &m_floats[0];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -338,15 +338,15 @@ namespace etk {
|
|||||||
m_floats[0]=_x;
|
m_floats[0]=_x;
|
||||||
m_floats[1]=_y;
|
m_floats[1]=_y;
|
||||||
}
|
}
|
||||||
void setZero(void) {
|
void setZero() {
|
||||||
setValue(0,0);
|
setValue(0,0);
|
||||||
}
|
}
|
||||||
bool isZero(void) const {
|
bool isZero() const {
|
||||||
return m_floats[0] == 0 && m_floats[1] == 0;
|
return m_floats[0] == 0 && m_floats[1] == 0;
|
||||||
}
|
}
|
||||||
//!< string cast :
|
//!< string cast :
|
||||||
operator std::string(void) const;
|
operator std::string() const;
|
||||||
operator std::u32string(void) const;
|
operator std::u32string() const;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
|
@ -28,7 +28,7 @@ namespace etk
|
|||||||
/**
|
/**
|
||||||
* @brief No initialization constructor (faster ...)
|
* @brief No initialization constructor (faster ...)
|
||||||
*/
|
*/
|
||||||
Vector3D(void) {
|
Vector3D() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// in debug mode we set supid value to prevent forget of the inits ...
|
// in debug mode we set supid value to prevent forget of the inits ...
|
||||||
m_floats[0] = (T)34673363;
|
m_floats[0] = (T)34673363;
|
||||||
@ -136,14 +136,14 @@ namespace etk
|
|||||||
/**
|
/**
|
||||||
* @brief Return the length of the vector squared
|
* @brief Return the length of the vector squared
|
||||||
*/
|
*/
|
||||||
btScalar length2(void) const {
|
btScalar length2() const {
|
||||||
return dot(*this);
|
return dot(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return the length of the vector
|
* @brief Return the length of the vector
|
||||||
*/
|
*/
|
||||||
btScalar length(void) const {
|
btScalar length() const {
|
||||||
return btSqrt(length2());
|
return btSqrt(length2());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ namespace etk
|
|||||||
return (_v - *this).length();
|
return (_v - *this).length();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3D<T>& safeNormalize(void) {
|
Vector3D<T>& safeNormalize() {
|
||||||
Vector3D<T> absVec = this->absolute();
|
Vector3D<T> absVec = this->absolute();
|
||||||
int maxIndex = absVec.maxAxis();
|
int maxIndex = absVec.maxAxis();
|
||||||
if (absVec[maxIndex]>0)
|
if (absVec[maxIndex]>0)
|
||||||
@ -179,14 +179,14 @@ namespace etk
|
|||||||
* @brief Normalize this vector
|
* @brief Normalize this vector
|
||||||
* x^2 + y^2 + z^2 = 1
|
* x^2 + y^2 + z^2 = 1
|
||||||
*/
|
*/
|
||||||
Vector3D<T>& normalize(void) {
|
Vector3D<T>& normalize() {
|
||||||
return *this /= length();
|
return *this /= length();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return a normalized version of this vector
|
* @brief Return a normalized version of this vector
|
||||||
*/
|
*/
|
||||||
Vector3D<T> normalized(void) const {
|
Vector3D<T> normalized() const {
|
||||||
return *this / length();
|
return *this / length();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ namespace etk
|
|||||||
/**
|
/**
|
||||||
* @brief Return a vector will the absolute values of each element
|
* @brief Return a vector will the absolute values of each element
|
||||||
*/
|
*/
|
||||||
Vector3D<T> absolute(void) const {
|
Vector3D<T> absolute() const {
|
||||||
return Vector3D<T>( abs(m_floats[0]),
|
return Vector3D<T>( abs(m_floats[0]),
|
||||||
abs(m_floats[1]),
|
abs(m_floats[1]),
|
||||||
abs(m_floats[2]));
|
abs(m_floats[2]));
|
||||||
@ -244,7 +244,7 @@ namespace etk
|
|||||||
* @brief Return the axis with the smallest value
|
* @brief Return the axis with the smallest value
|
||||||
* Note return values are 0,1,2 for x, y, or z
|
* Note return values are 0,1,2 for x, y, or z
|
||||||
*/
|
*/
|
||||||
int32_t minAxis(void) const {
|
int32_t minAxis() const {
|
||||||
if (m_floats[0] < m_floats[1]) {
|
if (m_floats[0] < m_floats[1]) {
|
||||||
return m_floats[0] < m_floats[2] ? 0 : 2;
|
return m_floats[0] < m_floats[2] ? 0 : 2;
|
||||||
}
|
}
|
||||||
@ -255,18 +255,18 @@ namespace etk
|
|||||||
* @brief Return the axis with the largest value
|
* @brief Return the axis with the largest value
|
||||||
* Note return values are 0,1,2 for x, y, or z
|
* Note return values are 0,1,2 for x, y, or z
|
||||||
*/
|
*/
|
||||||
int32_t maxAxis(void) const {
|
int32_t maxAxis() const {
|
||||||
if (m_floats[0] < m_floats[1]) {
|
if (m_floats[0] < m_floats[1]) {
|
||||||
return m_floats[1] < m_floats[2] ? 2 : 1;
|
return m_floats[1] < m_floats[2] ? 2 : 1;
|
||||||
}
|
}
|
||||||
return m_floats[0] < m_floats[2] ? 2 : 0;
|
return m_floats[0] < m_floats[2] ? 2 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t furthestAxis(void) const {
|
int32_t furthestAxis() const {
|
||||||
return absolute().minAxis();
|
return absolute().minAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t closestAxis(void) const {
|
int32_t closestAxis() const {
|
||||||
return absolute().maxAxis();
|
return absolute().maxAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,11 +431,11 @@ namespace etk
|
|||||||
_v2->setValue(-y() ,x() ,0.);
|
_v2->setValue(-y() ,x() ,0.);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setZero(void) {
|
void setZero() {
|
||||||
setValue(0,0,0);
|
setValue(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isZero(void) const {
|
bool isZero() const {
|
||||||
return m_floats[0] == 0 && m_floats[1] == 0 && m_floats[2] == 0;
|
return m_floats[0] == 0 && m_floats[1] == 0 && m_floats[2] == 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,7 @@ namespace etk
|
|||||||
/**
|
/**
|
||||||
* @brief No initialization constructor (faster ...)
|
* @brief No initialization constructor (faster ...)
|
||||||
*/
|
*/
|
||||||
Vector4D(void)
|
Vector4D()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// in debug mode we set supid value to prevent forget of the inits ...
|
// in debug mode we set supid value to prevent forget of the inits ...
|
||||||
@ -244,7 +244,7 @@ namespace etk
|
|||||||
/**
|
/**
|
||||||
* @brief Return a vector will the absolute values of each element
|
* @brief Return a vector will the absolute values of each element
|
||||||
*/
|
*/
|
||||||
Vector4D<T> absolute(void) const
|
Vector4D<T> absolute() const
|
||||||
{
|
{
|
||||||
return Vector4D<T>( abs(m_floats[0]),
|
return Vector4D<T>( abs(m_floats[0]),
|
||||||
abs(m_floats[1]),
|
abs(m_floats[1]),
|
||||||
@ -276,7 +276,7 @@ namespace etk
|
|||||||
* Note return values are 0,1,2 for x, y, or z
|
* Note return values are 0,1,2 for x, y, or z
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
int32_t minAxis(void) const
|
int32_t minAxis() const
|
||||||
{
|
{
|
||||||
return m_floats[0] < m_floats[1] ? (m_floats[0] <m_floats[2] ? 0 : 2) : (m_floats[1] <m_floats[2] ? 1 : 2);
|
return m_floats[0] < m_floats[1] ? (m_floats[0] <m_floats[2] ? 0 : 2) : (m_floats[1] <m_floats[2] ? 1 : 2);
|
||||||
}
|
}
|
||||||
@ -286,17 +286,17 @@ namespace etk
|
|||||||
* Note return values are 0,1,2 for x, y, or z
|
* Note return values are 0,1,2 for x, y, or z
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
int32_t maxAxis(void) const
|
int32_t maxAxis() const
|
||||||
{
|
{
|
||||||
return m_floats[0] < m_floats[1] ? (m_floats[1] <m_floats[2] ? 2 : 1) : (m_floats[0] <m_floats[2] ? 2 : 0);
|
return m_floats[0] < m_floats[1] ? (m_floats[1] <m_floats[2] ? 2 : 1) : (m_floats[0] <m_floats[2] ? 2 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t furthestAxis(void) const
|
int32_t furthestAxis() const
|
||||||
{
|
{
|
||||||
return absolute().minAxis();
|
return absolute().minAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t closestAxis(void) const
|
int32_t closestAxis() const
|
||||||
{
|
{
|
||||||
return absolute().maxAxis();
|
return absolute().maxAxis();
|
||||||
}
|
}
|
||||||
@ -453,12 +453,12 @@ namespace etk
|
|||||||
v2->setValue(-y() ,x() ,0.);
|
v2->setValue(-y() ,x() ,0.);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
void setZero(void)
|
void setZero()
|
||||||
{
|
{
|
||||||
setValue(0,0,0,0);
|
setValue(0,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isZero(void) const
|
bool isZero() const
|
||||||
{
|
{
|
||||||
return m_floats[0] == 0 && m_floats[1] == 0 && m_floats[2] == 0 && m_floats[3] == 0;
|
return m_floats[0] == 0 && m_floats[1] == 0 && m_floats[2] == 0 && m_floats[3] == 0;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ void etk::setArgZero(const std::string& _val) {
|
|||||||
Note that it is up to the calling process to set argv[0] correctly. It is right most of the times however there are occasions when the calling process cannot be trusted (ex. setuid executable).
|
Note that it is up to the calling process to set argv[0] correctly. It is right most of the times however there are occasions when the calling process cannot be trusted (ex. setuid executable).
|
||||||
On Windows: use GetModuleFileName(NULL, buf, bufsize)
|
On Windows: use GetModuleFileName(NULL, buf, bufsize)
|
||||||
*/
|
*/
|
||||||
std::string getApplicationPath(void) {
|
std::string getApplicationPath() {
|
||||||
std::string binaryName = "no-name";
|
std::string binaryName = "no-name";
|
||||||
char binaryCompleatePath[FILENAME_MAX];
|
char binaryCompleatePath[FILENAME_MAX];
|
||||||
memset(binaryCompleatePath, 0, FILENAME_MAX);
|
memset(binaryCompleatePath, 0, FILENAME_MAX);
|
||||||
@ -274,7 +274,7 @@ std::string getApplicationPath(void) {
|
|||||||
TK_INFO("Binary name : " << binaryName);
|
TK_INFO("Binary name : " << binaryName);
|
||||||
return binaryName;
|
return binaryName;
|
||||||
}
|
}
|
||||||
std::u32string getUApplicationPath(void) {
|
std::u32string getUApplicationPath() {
|
||||||
return to_u32string(getApplicationPath());
|
return to_u32string(getApplicationPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,23 +383,23 @@ void etk::initDefaultFolder(const char* _applName) {
|
|||||||
TK_INFO("baseFolderCache : '" << baseFolderCache << "'");
|
TK_INFO("baseFolderCache : '" << baseFolderCache << "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::getUserHomeFolder(void) {
|
std::string etk::getUserHomeFolder() {
|
||||||
return baseFolderHome;
|
return baseFolderHome;
|
||||||
}
|
}
|
||||||
std::u32string etk::getUUserHomeFolder(void) {
|
std::u32string etk::getUUserHomeFolder() {
|
||||||
return to_u32string(baseFolderHome);
|
return to_u32string(baseFolderHome);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::getUserRunFolder(void) {
|
std::string etk::getUserRunFolder() {
|
||||||
return baseRunPath;
|
return baseRunPath;
|
||||||
}
|
}
|
||||||
std::u32string etk::getUUserRunFolder(void) {
|
std::u32string etk::getUUserRunFolder() {
|
||||||
return to_u32string(baseRunPath);
|
return to_u32string(baseRunPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __TARGET_OS__Android
|
#ifdef __TARGET_OS__Android
|
||||||
bool etk::FSNode::loadDataZip(void)
|
bool etk::FSNode::loadDataZip()
|
||||||
{
|
{
|
||||||
if (NULL == s_APKArchive) {
|
if (NULL == s_APKArchive) {
|
||||||
return false;
|
return false;
|
||||||
@ -500,7 +500,7 @@ etk::FSNode::FSNode(const std::u32string& _nodeName) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
etk::FSNode::~FSNode(void) {
|
etk::FSNode::~FSNode() {
|
||||||
if( NULL != m_PointerFile
|
if( NULL != m_PointerFile
|
||||||
#ifdef __TARGET_OS__Android
|
#ifdef __TARGET_OS__Android
|
||||||
|| NULL != m_zipContent
|
|| NULL != m_zipContent
|
||||||
@ -725,7 +725,7 @@ bool directCheckFile(std::u32string _tmpFileNameDirect, bool _checkInAPKIfNeeded
|
|||||||
return directCheckFile(std::to_string(_tmpFileNameDirect));
|
return directCheckFile(std::to_string(_tmpFileNameDirect));
|
||||||
}
|
}
|
||||||
// Now we generate the real FS path:
|
// Now we generate the real FS path:
|
||||||
void etk::FSNode::generateFileSystemPath(void) {
|
void etk::FSNode::generateFileSystemPath() {
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
default:
|
default:
|
||||||
case etk::FSN_TYPE_UNKNOW:
|
case etk::FSN_TYPE_UNKNOW:
|
||||||
@ -820,7 +820,7 @@ void etk::FSNode::generateFileSystemPath(void) {
|
|||||||
|
|
||||||
|
|
||||||
// now we get all the right if the file existed:
|
// now we get all the right if the file existed:
|
||||||
void etk::FSNode::updateFileSystemProperty(void) {
|
void etk::FSNode::updateFileSystemProperty() {
|
||||||
// clean general properties :
|
// clean general properties :
|
||||||
m_rights.clear();
|
m_rights.clear();
|
||||||
m_timeCreate = 0;
|
m_timeCreate = 0;
|
||||||
@ -918,25 +918,25 @@ void etk::FSNode::setName(const std::u32string& _newName) {
|
|||||||
privateSetName(_newName);
|
privateSetName(_newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::FSNode::getNameFolder(void) const {
|
std::string etk::FSNode::getNameFolder() const {
|
||||||
size_t lastPos = m_systemFileName.rfind('/');
|
size_t lastPos = m_systemFileName.rfind('/');
|
||||||
if (lastPos != std::string::npos) {
|
if (lastPos != std::string::npos) {
|
||||||
return std::string(m_systemFileName, 0, lastPos);
|
return std::string(m_systemFileName, 0, lastPos);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
std::u32string etk::FSNode::getUNameFolder(void) const {
|
std::u32string etk::FSNode::getUNameFolder() const {
|
||||||
return to_u32string(getNameFolder());
|
return to_u32string(getNameFolder());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::FSNode::getFileSystemName(void) const {
|
std::string etk::FSNode::getFileSystemName() const {
|
||||||
return m_systemFileName;
|
return m_systemFileName;
|
||||||
}
|
}
|
||||||
std::u32string etk::FSNode::getUFileSystemName(void) const {
|
std::u32string etk::FSNode::getUFileSystemName() const {
|
||||||
return to_u32string(getFileSystemName());
|
return to_u32string(getFileSystemName());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::FSNode::getName(void) const {
|
std::string etk::FSNode::getName() const {
|
||||||
std::string output;
|
std::string output;
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
default:
|
default:
|
||||||
@ -969,22 +969,22 @@ std::string etk::FSNode::getName(void) const {
|
|||||||
output += m_userFileName;
|
output += m_userFileName;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
std::u32string etk::FSNode::getUName(void) const {
|
std::u32string etk::FSNode::getUName() const {
|
||||||
return to_u32string(getName());
|
return to_u32string(getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::FSNode::getNameFile(void) const {
|
std::string etk::FSNode::getNameFile() const {
|
||||||
size_t lastPos = m_systemFileName.rfind('/');
|
size_t lastPos = m_systemFileName.rfind('/');
|
||||||
if (lastPos != std::string::npos) {
|
if (lastPos != std::string::npos) {
|
||||||
return std::string(m_systemFileName, lastPos+1);
|
return std::string(m_systemFileName, lastPos+1);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
std::u32string etk::FSNode::getUNameFile(void) const {
|
std::u32string etk::FSNode::getUNameFile() const {
|
||||||
return to_u32string(getNameFile());
|
return to_u32string(getNameFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::FSNode::getRelativeFolder(void) const {
|
std::string etk::FSNode::getRelativeFolder() const {
|
||||||
std::string tmppp = getName();
|
std::string tmppp = getName();
|
||||||
TK_DBG_MODE("get REF folder : " << tmppp );
|
TK_DBG_MODE("get REF folder : " << tmppp );
|
||||||
switch (m_typeNode) {
|
switch (m_typeNode) {
|
||||||
@ -1022,12 +1022,12 @@ std::string etk::FSNode::getRelativeFolder(void) const {
|
|||||||
TK_DBG_MODE(" ==> : ''" );
|
TK_DBG_MODE(" ==> : ''" );
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
std::u32string etk::FSNode::getURelativeFolder(void) const {
|
std::u32string etk::FSNode::getURelativeFolder() const {
|
||||||
return to_u32string(getRelativeFolder());
|
return to_u32string(getRelativeFolder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool etk::FSNode::touch(void) {
|
bool etk::FSNode::touch() {
|
||||||
TK_DEBUG("Touch FILE : " << getName());
|
TK_DEBUG("Touch FILE : " << getName());
|
||||||
//just open in write an close ==> this will update the time
|
//just open in write an close ==> this will update the time
|
||||||
if (fileOpenAppend() == false) {
|
if (fileOpenAppend() == false) {
|
||||||
@ -1056,7 +1056,7 @@ bool etk::FSNode::move(const std::u32string& _path) {
|
|||||||
return move(std::to_string(_path));
|
return move(std::to_string(_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool etk::FSNode::remove(void) {
|
bool etk::FSNode::remove() {
|
||||||
if (getNodeType()==etk::FSN_FOLDER) {
|
if (getNodeType()==etk::FSN_FOLDER) {
|
||||||
// remove the folder
|
// remove the folder
|
||||||
if( 0!=rmdir(m_systemFileName.c_str()) ) {
|
if( 0!=rmdir(m_systemFileName.c_str()) ) {
|
||||||
@ -1075,11 +1075,11 @@ bool etk::FSNode::remove(void) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t etk::FSNode::timeCreated(void) const {
|
uint64_t etk::FSNode::timeCreated() const {
|
||||||
return m_timeCreate;
|
return m_timeCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::FSNode::timeCreatedString(void) const {
|
std::string etk::FSNode::timeCreatedString() 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[tmpTime.size()-1] == '\n') {
|
if (tmpTime[tmpTime.size()-1] == '\n') {
|
||||||
@ -1087,15 +1087,15 @@ std::string etk::FSNode::timeCreatedString(void) const {
|
|||||||
}
|
}
|
||||||
return tmpTime;
|
return tmpTime;
|
||||||
}
|
}
|
||||||
std::u32string etk::FSNode::timeUCreatedString(void) const {
|
std::u32string etk::FSNode::timeUCreatedString() const {
|
||||||
return to_u32string(timeCreatedString());
|
return to_u32string(timeCreatedString());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t etk::FSNode::timeModified(void) const {
|
uint64_t etk::FSNode::timeModified() const {
|
||||||
return m_timeModify;
|
return m_timeModify;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::FSNode::timeModifiedString(void) const {
|
std::string etk::FSNode::timeModifiedString() 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[tmpTime.size()-1] == '\n') {
|
if (tmpTime[tmpTime.size()-1] == '\n') {
|
||||||
@ -1103,15 +1103,15 @@ std::string etk::FSNode::timeModifiedString(void) const {
|
|||||||
}
|
}
|
||||||
return tmpTime;
|
return tmpTime;
|
||||||
}
|
}
|
||||||
std::u32string etk::FSNode::timeUModifiedString(void) const {
|
std::u32string etk::FSNode::timeUModifiedString() const {
|
||||||
return to_u32string(timeModifiedString());
|
return to_u32string(timeModifiedString());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t etk::FSNode::timeAccessed(void) const {
|
uint64_t etk::FSNode::timeAccessed() const {
|
||||||
return m_timeAccess;
|
return m_timeAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::FSNode::timeAccessedString(void) const {
|
std::string etk::FSNode::timeAccessedString() 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[tmpTime.size()-1] == '\n') {
|
if (tmpTime[tmpTime.size()-1] == '\n') {
|
||||||
@ -1119,7 +1119,7 @@ std::string etk::FSNode::timeAccessedString(void) const {
|
|||||||
}
|
}
|
||||||
return tmpTime;
|
return tmpTime;
|
||||||
}
|
}
|
||||||
std::u32string etk::FSNode::timeUAccessedString(void) const {
|
std::u32string etk::FSNode::timeUAccessedString() const {
|
||||||
return to_u32string(timeAccessedString());
|
return to_u32string(timeAccessedString());
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -1243,7 +1243,7 @@ std::ostream& etk::operator <<(std::ostream &_os, const enum etk::typeNode &_obj
|
|||||||
/*
|
/*
|
||||||
Folder specific :
|
Folder specific :
|
||||||
*/
|
*/
|
||||||
int64_t etk::FSNode::folderCount(void) {
|
int64_t etk::FSNode::folderCount() {
|
||||||
int64_t counter=0;
|
int64_t counter=0;
|
||||||
DIR *dir = NULL;
|
DIR *dir = NULL;
|
||||||
struct dirent *ent = NULL;
|
struct dirent *ent = NULL;
|
||||||
@ -1362,7 +1362,7 @@ std::vector<etk::FSNode *> etk::FSNode::folderGetSubList(bool _showHidenFile, bo
|
|||||||
return tmpp;
|
return tmpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::FSNode etk::FSNode::folderGetParent(void) {
|
etk::FSNode etk::FSNode::folderGetParent() {
|
||||||
etk::FSNode tmpp;
|
etk::FSNode tmpp;
|
||||||
return tmpp;
|
return tmpp;
|
||||||
}
|
}
|
||||||
@ -1447,7 +1447,7 @@ void etk::FSNode::folderGetRecursiveFiles(std::vector<std::u32string>& _output,
|
|||||||
/*
|
/*
|
||||||
File Specific :
|
File Specific :
|
||||||
*/
|
*/
|
||||||
bool etk::FSNode::fileHasExtention(void) {
|
bool etk::FSNode::fileHasExtention() {
|
||||||
size_t lastPos = m_userFileName.rfind('.');
|
size_t lastPos = m_userFileName.rfind('.');
|
||||||
if( lastPos != std::string::npos // Find a . at the fist position .jdlskjdfklj ==> hiden file
|
if( lastPos != std::string::npos // Find a . at the fist position .jdlskjdfklj ==> hiden file
|
||||||
&& m_userFileName.size() != lastPos ) { // Remove file ended with .
|
&& m_userFileName.size() != lastPos ) { // Remove file ended with .
|
||||||
@ -1457,7 +1457,7 @@ bool etk::FSNode::fileHasExtention(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::FSNode::fileGetExtention(void) {
|
std::string etk::FSNode::fileGetExtention() {
|
||||||
size_t lastPos = m_userFileName.rfind('.');
|
size_t lastPos = m_userFileName.rfind('.');
|
||||||
if( lastPos != std::string::npos // Find a . at the fist position .jdlskjdfklj ==> hiden file
|
if( lastPos != std::string::npos // Find a . at the fist position .jdlskjdfklj ==> hiden file
|
||||||
&& m_userFileName.size() != lastPos ) { // Remove file ended with .
|
&& m_userFileName.size() != lastPos ) { // Remove file ended with .
|
||||||
@ -1466,11 +1466,11 @@ std::string etk::FSNode::fileGetExtention(void) {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
std::u32string etk::FSNode::fileUGetExtention(void) {
|
std::u32string etk::FSNode::fileUGetExtention() {
|
||||||
return to_u32string(fileGetExtention());
|
return to_u32string(fileGetExtention());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t etk::FSNode::fileSize(void) {
|
uint64_t etk::FSNode::fileSize() {
|
||||||
if (etk::FSN_FILE != m_typeNode) {
|
if (etk::FSN_FILE != m_typeNode) {
|
||||||
TK_ERROR("Request size of a non file node : " << m_typeNode);
|
TK_ERROR("Request size of a non file node : " << m_typeNode);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1500,7 +1500,7 @@ uint64_t etk::FSNode::fileSize(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool etk::FSNode::fileOpenRead(void) {
|
bool etk::FSNode::fileOpenRead() {
|
||||||
#ifdef __TARGET_OS__Android
|
#ifdef __TARGET_OS__Android
|
||||||
if( etk::FSN_TYPE_DATA == m_type
|
if( etk::FSN_TYPE_DATA == m_type
|
||||||
|| etk::FSN_TYPE_THEME_DATA == m_type) {
|
|| etk::FSN_TYPE_THEME_DATA == m_type) {
|
||||||
@ -1523,7 +1523,7 @@ bool etk::FSNode::fileOpenRead(void) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool etk::FSNode::fileOpenWrite(void) {
|
bool etk::FSNode::fileOpenWrite() {
|
||||||
#ifdef __TARGET_OS__Android
|
#ifdef __TARGET_OS__Android
|
||||||
if( etk::FSN_TYPE_DATA == m_type
|
if( etk::FSN_TYPE_DATA == m_type
|
||||||
|| etk::FSN_TYPE_THEME_DATA == m_type) {
|
|| etk::FSN_TYPE_THEME_DATA == m_type) {
|
||||||
@ -1544,7 +1544,7 @@ bool etk::FSNode::fileOpenWrite(void) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool etk::FSNode::fileOpenAppend(void) {
|
bool etk::FSNode::fileOpenAppend() {
|
||||||
#ifdef __TARGET_OS__Android
|
#ifdef __TARGET_OS__Android
|
||||||
if( etk::FSN_TYPE_DATA == m_type
|
if( etk::FSN_TYPE_DATA == m_type
|
||||||
|| etk::FSN_TYPE_THEME_DATA == m_type) {
|
|| etk::FSN_TYPE_THEME_DATA == m_type) {
|
||||||
@ -1567,7 +1567,7 @@ bool etk::FSNode::fileOpenAppend(void) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool etk::FSNode::fileClose(void) {
|
bool etk::FSNode::fileClose() {
|
||||||
#ifdef __TARGET_OS__Android
|
#ifdef __TARGET_OS__Android
|
||||||
if( etk::FSN_TYPE_DATA == m_type
|
if( etk::FSN_TYPE_DATA == m_type
|
||||||
|| etk::FSN_TYPE_THEME_DATA == m_type) {
|
|| etk::FSN_TYPE_THEME_DATA == m_type) {
|
||||||
@ -1639,7 +1639,7 @@ char* etk::FSNode::fileGets(char* _elementLine, int64_t _maxData) {
|
|||||||
return fgets(_elementLine, _maxData, m_PointerFile);
|
return fgets(_elementLine, _maxData, m_PointerFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
char etk::FSNode::fileGet(void) {
|
char etk::FSNode::fileGet() {
|
||||||
char data='\0';
|
char data='\0';
|
||||||
if (fileRead(&data, 1, 1)!=1) {
|
if (fileRead(&data, 1, 1)!=1) {
|
||||||
return '\0';
|
return '\0';
|
||||||
@ -1755,7 +1755,7 @@ bool etk::FSNode::fileSeek(long int _offset, enum etk::seekNode _origin)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int64_t etk::FSNode::fileTell(void) {
|
int64_t etk::FSNode::fileTell() {
|
||||||
#ifdef __TARGET_OS__Android
|
#ifdef __TARGET_OS__Android
|
||||||
if( m_type == etk::FSN_TYPE_DATA
|
if( m_type == etk::FSN_TYPE_DATA
|
||||||
|| m_type == etk::FSN_TYPE_THEME_DATA) {
|
|| m_type == etk::FSN_TYPE_THEME_DATA) {
|
||||||
@ -1769,7 +1769,7 @@ int64_t etk::FSNode::fileTell(void) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void etk::FSNode::fileFlush(void) {
|
void etk::FSNode::fileFlush() {
|
||||||
#ifdef __TARGET_OS__Android
|
#ifdef __TARGET_OS__Android
|
||||||
if( m_type == etk::FSN_TYPE_DATA
|
if( m_type == etk::FSN_TYPE_DATA
|
||||||
|| m_type == etk::FSN_TYPE_THEME_DATA) {
|
|| m_type == etk::FSN_TYPE_THEME_DATA) {
|
||||||
@ -1810,14 +1810,14 @@ std::u32string etk::theme::getName(const std::u32string& _refName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the list of all the theme folder availlable in the user Home/appl
|
// get the list of all the theme folder availlable in the user Home/appl
|
||||||
std::vector<std::string> etk::theme::list(void) {
|
std::vector<std::string> etk::theme::list() {
|
||||||
std::vector<std::string> keys;
|
std::vector<std::string> keys;
|
||||||
for (auto &it : g_listTheme) {
|
for (auto &it : g_listTheme) {
|
||||||
keys.push_back(it.first);
|
keys.push_back(it.first);
|
||||||
}
|
}
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
std::vector<std::u32string> etk::theme::listU(void) {
|
std::vector<std::u32string> etk::theme::listU() {
|
||||||
std::vector<std::u32string> keys;
|
std::vector<std::u32string> keys;
|
||||||
for (auto &it : g_listTheme) {
|
for (auto &it : g_listTheme) {
|
||||||
keys.push_back(std::to_u32string(it.first));
|
keys.push_back(std::to_u32string(it.first));
|
||||||
|
@ -147,16 +147,16 @@ namespace etk {
|
|||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
* @note you will have some warning if you did not close your files
|
* @note you will have some warning if you did not close your files
|
||||||
*/
|
*/
|
||||||
~FSNode(void);
|
~FSNode();
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Internal methode that create the internal Real system name (transform DATA: HOME: DATA:GUI: in the real name of the files)
|
* @brief Internal methode that create the internal Real system name (transform DATA: HOME: DATA:GUI: in the real name of the files)
|
||||||
*/
|
*/
|
||||||
void generateFileSystemPath(void);
|
void generateFileSystemPath();
|
||||||
/**
|
/**
|
||||||
* @brief Update the internal data of the right type, and times
|
* @brief Update the internal data of the right type, and times
|
||||||
*/
|
*/
|
||||||
void updateFileSystemProperty(void);
|
void updateFileSystemProperty();
|
||||||
/**
|
/**
|
||||||
* @brief Common set name of the Node (if the user decide to change the node selection
|
* @brief Common set name of the Node (if the user decide to change the node selection
|
||||||
* @param[in] _newName Name of the Node
|
* @param[in] _newName Name of the Node
|
||||||
@ -170,7 +170,7 @@ namespace etk {
|
|||||||
* @return true : Load is OK
|
* @return true : Load is OK
|
||||||
* @return false : An error Occured
|
* @return false : An error Occured
|
||||||
*/
|
*/
|
||||||
bool loadDataZip(void);
|
bool loadDataZip();
|
||||||
const etk::Archive::Content* m_zipContent;
|
const etk::Archive::Content* m_zipContent;
|
||||||
int32_t m_zipReadingOffset;
|
int32_t m_zipReadingOffset;
|
||||||
#endif
|
#endif
|
||||||
@ -180,21 +180,21 @@ namespace etk {
|
|||||||
* @return true : The node existed.
|
* @return true : The node existed.
|
||||||
* @return false : The node does not exist.
|
* @return false : The node does not exist.
|
||||||
*/
|
*/
|
||||||
bool exist(void) const {
|
bool exist() const {
|
||||||
return (m_typeNode!=etk::FSN_UNKNOW);
|
return (m_typeNode!=etk::FSN_UNKNOW);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Get the node type
|
* @brief Get the node type
|
||||||
* @return the requested type, FSN_UNKNOW if it does not existed
|
* @return the requested type, FSN_UNKNOW if it does not existed
|
||||||
*/
|
*/
|
||||||
enum typeNode getNodeType(void) const {
|
enum typeNode getNodeType() const {
|
||||||
return m_typeNode;
|
return m_typeNode;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Get the node Right
|
* @brief Get the node Right
|
||||||
* @return the requested right
|
* @return the requested right
|
||||||
*/
|
*/
|
||||||
etk::FSNodeRight getRight(void) const {
|
etk::FSNodeRight getRight() const {
|
||||||
return m_rights;
|
return m_rights;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -216,41 +216,41 @@ namespace etk {
|
|||||||
* @brief Get the Generate FileSystem name
|
* @brief Get the Generate FileSystem name
|
||||||
* @return the requested filename
|
* @return the requested filename
|
||||||
*/
|
*/
|
||||||
std::string getFileSystemName(void) const;
|
std::string getFileSystemName() const;
|
||||||
std::u32string getUFileSystemName(void) const;
|
std::u32string getUFileSystemName() const;
|
||||||
/**
|
/**
|
||||||
* @brief Get the current folder of the Node. (file system name)
|
* @brief Get the current folder of the Node. (file system name)
|
||||||
* @return the common name define (like /xxxxx/xxxxx/ or c:/xxxxx/xxxxx/)
|
* @return the common name define (like /xxxxx/xxxxx/ or c:/xxxxx/xxxxx/)
|
||||||
* @note Auto remove of ../../../ and //
|
* @note Auto remove of ../../../ and //
|
||||||
*/
|
*/
|
||||||
std::string getNameFolder(void) const;
|
std::string getNameFolder() const;
|
||||||
std::u32string getUNameFolder(void) const;
|
std::u32string getUNameFolder() const;
|
||||||
/**
|
/**
|
||||||
* @brief Get the current compleate node name (file system name)
|
* @brief Get the current compleate node name (file system name)
|
||||||
* @return All the user name definition (like /xxxxx/xxxxx/myFile.kkk or c:/xxxxx/xxxxx/myFile.kkk)
|
* @return All the user name definition (like /xxxxx/xxxxx/myFile.kkk or c:/xxxxx/xxxxx/myFile.kkk)
|
||||||
* @note Auto remove of ../../../ and //
|
* @note Auto remove of ../../../ and //
|
||||||
*/
|
*/
|
||||||
std::string getName(void) const;
|
std::string getName() const;
|
||||||
std::u32string getUName(void) const;
|
std::u32string getUName() const;
|
||||||
/**
|
/**
|
||||||
* @brief Get the file or current file name (if it was a file)
|
* @brief Get the file or current file name (if it was a file)
|
||||||
* @return the name of the node (like myFile.kkk)
|
* @return the name of the node (like myFile.kkk)
|
||||||
*/
|
*/
|
||||||
std::string getNameFile(void) const;
|
std::string getNameFile() const;
|
||||||
std::u32string getUNameFile(void) const;
|
std::u32string getUNameFile() const;
|
||||||
/**
|
/**
|
||||||
* @brief Get the current folder of the Node.
|
* @brief Get the current folder of the Node.
|
||||||
* @return the common name define (like DATA:xxxxx/xxxxx/)
|
* @return the common name define (like DATA:xxxxx/xxxxx/)
|
||||||
* @note Auto remove of ../../../ and //
|
* @note Auto remove of ../../../ and //
|
||||||
*/
|
*/
|
||||||
std::string getRelativeFolder(void) const;
|
std::string getRelativeFolder() const;
|
||||||
std::u32string getURelativeFolder(void) const;
|
std::u32string getURelativeFolder() const;
|
||||||
/**
|
/**
|
||||||
* @brief update the Time of the file with the current time
|
* @brief update the Time of the file with the current time
|
||||||
* @return true : action done
|
* @return true : action done
|
||||||
* @return false : action not done
|
* @return false : action not done
|
||||||
*/
|
*/
|
||||||
bool touch(void);
|
bool touch();
|
||||||
/**
|
/**
|
||||||
* @brief Move the Node at a new path
|
* @brief Move the Node at a new path
|
||||||
* @param[in] _path The new path
|
* @param[in] _path The new path
|
||||||
@ -263,7 +263,7 @@ namespace etk {
|
|||||||
* @brief Get the node type (DATA/DIRECT...)
|
* @brief Get the node type (DATA/DIRECT...)
|
||||||
* @return the requested type
|
* @return the requested type
|
||||||
*/
|
*/
|
||||||
enum FSNType getTypeAccess(void) const {
|
enum FSNType getTypeAccess() const {
|
||||||
return m_type;
|
return m_type;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -271,40 +271,40 @@ namespace etk {
|
|||||||
* @return true : action done
|
* @return true : action done
|
||||||
* @return false : action not done
|
* @return false : action not done
|
||||||
*/
|
*/
|
||||||
bool remove(void);
|
bool remove();
|
||||||
/**
|
/**
|
||||||
* @brief Get the creating time of the File
|
* @brief Get the creating time of the File
|
||||||
* @return The time requested
|
* @return The time requested
|
||||||
*/
|
*/
|
||||||
uint64_t timeCreated(void) const;
|
uint64_t timeCreated() const;
|
||||||
/**
|
/**
|
||||||
* @brief Get the creating time of the File
|
* @brief Get the creating time of the File
|
||||||
* @return The time requested (in string)
|
* @return The time requested (in string)
|
||||||
*/
|
*/
|
||||||
std::string timeCreatedString(void) const;
|
std::string timeCreatedString() const;
|
||||||
std::u32string timeUCreatedString(void) const;
|
std::u32string timeUCreatedString() const;
|
||||||
/**
|
/**
|
||||||
* @brief Get the modifying time of the File
|
* @brief Get the modifying time of the File
|
||||||
* @return The time requested
|
* @return The time requested
|
||||||
*/
|
*/
|
||||||
uint64_t timeModified(void) const;
|
uint64_t timeModified() const;
|
||||||
/**
|
/**
|
||||||
* @brief Get the modifying time of the File
|
* @brief Get the modifying time of the File
|
||||||
* @return The time requested (in string)
|
* @return The time requested (in string)
|
||||||
*/
|
*/
|
||||||
std::string timeModifiedString(void) const;
|
std::string timeModifiedString() const;
|
||||||
std::u32string timeUModifiedString(void) const;
|
std::u32string timeUModifiedString() const;
|
||||||
/**
|
/**
|
||||||
* @brief Get the Accessed time of the File
|
* @brief Get the Accessed time of the File
|
||||||
* @return The time requested
|
* @return The time requested
|
||||||
*/
|
*/
|
||||||
uint64_t timeAccessed(void) const;
|
uint64_t timeAccessed() const;
|
||||||
/**
|
/**
|
||||||
* @brief Get the Accessed time of the File
|
* @brief Get the Accessed time of the File
|
||||||
* @return The time requested (in string)
|
* @return The time requested (in string)
|
||||||
*/
|
*/
|
||||||
std::string timeAccessedString(void) const;
|
std::string timeAccessedString() const;
|
||||||
std::u32string timeUAccessedString(void) const;
|
std::u32string timeUAccessedString() const;
|
||||||
/**
|
/**
|
||||||
* @brief copy the other FSnode ==> for vector
|
* @brief copy the other FSnode ==> for vector
|
||||||
* @param[in] _obj input node
|
* @param[in] _obj input node
|
||||||
@ -336,7 +336,7 @@ namespace etk {
|
|||||||
* @return >=0 nb of subElement
|
* @return >=0 nb of subElement
|
||||||
* @return -1 an error occured ==> not a folder ???
|
* @return -1 an error occured ==> not a folder ???
|
||||||
*/
|
*/
|
||||||
int64_t folderCount(void);
|
int64_t folderCount();
|
||||||
/**
|
/**
|
||||||
* @brief Get the List of all node inside a node (folder only)
|
* @brief Get the List of all node inside a node (folder only)
|
||||||
* @param[in] _showHidenFile Add hidden file/folder/...
|
* @param[in] _showHidenFile Add hidden file/folder/...
|
||||||
@ -353,7 +353,7 @@ namespace etk {
|
|||||||
* @brief Get the father node of this node
|
* @brief Get the father node of this node
|
||||||
* @return The requested node
|
* @return The requested node
|
||||||
*/
|
*/
|
||||||
etk::FSNode folderGetParent(void);
|
etk::FSNode folderGetParent();
|
||||||
/**
|
/**
|
||||||
* @brief Get all the File inside a Folder (done recursively)
|
* @brief Get all the File inside a Folder (done recursively)
|
||||||
* @param[out] _output List of all the File names (You must clear it before set it in)
|
* @param[out] _output List of all the File names (You must clear it before set it in)
|
||||||
@ -366,44 +366,44 @@ namespace etk {
|
|||||||
* @return true The file have an extention.
|
* @return true The file have an extention.
|
||||||
* @return false The file have NO extention.
|
* @return false The file have NO extention.
|
||||||
*/
|
*/
|
||||||
bool fileHasExtention(void);
|
bool fileHasExtention();
|
||||||
/**
|
/**
|
||||||
* @brief Get the extention of the Node
|
* @brief Get the extention of the Node
|
||||||
* @return the requested extention
|
* @return the requested extention
|
||||||
*/
|
*/
|
||||||
std::string fileGetExtention(void);
|
std::string fileGetExtention();
|
||||||
std::u32string fileUGetExtention(void);
|
std::u32string fileUGetExtention();
|
||||||
/**
|
/**
|
||||||
* @brief Get the File size
|
* @brief Get the File size
|
||||||
* @return the requested size
|
* @return the requested size
|
||||||
*/
|
*/
|
||||||
uint64_t fileSize(void);
|
uint64_t fileSize();
|
||||||
/**
|
/**
|
||||||
* @brief Open the file in Read mode
|
* @brief Open the file in Read mode
|
||||||
* @return true : action done
|
* @return true : action done
|
||||||
* @return false : action not done
|
* @return false : action not done
|
||||||
*/
|
*/
|
||||||
bool fileOpenRead(void);
|
bool fileOpenRead();
|
||||||
/**
|
/**
|
||||||
* @brief Open the file in write Mode
|
* @brief Open the file in write Mode
|
||||||
* @note You can not do it with the DATA: file ==> this is not allowed in some Board like Android)
|
* @note You can not do it with the DATA: file ==> this is not allowed in some Board like Android)
|
||||||
* @return true : action done
|
* @return true : action done
|
||||||
* @return false : action not done
|
* @return false : action not done
|
||||||
*/
|
*/
|
||||||
bool fileOpenWrite(void);
|
bool fileOpenWrite();
|
||||||
/**
|
/**
|
||||||
* @brief Open the file in write Append Mode
|
* @brief Open the file in write Append Mode
|
||||||
* @note You can not do it with the DATA: file ==> this is not allowed in some Board like Android)
|
* @note You can not do it with the DATA: file ==> this is not allowed in some Board like Android)
|
||||||
* @return true : action done
|
* @return true : action done
|
||||||
* @return false : action not done
|
* @return false : action not done
|
||||||
*/
|
*/
|
||||||
bool fileOpenAppend(void);
|
bool fileOpenAppend();
|
||||||
/**
|
/**
|
||||||
* @brief Close the cuurent file
|
* @brief Close the cuurent file
|
||||||
* @return true : action done
|
* @return true : action done
|
||||||
* @return false : action not done
|
* @return false : action not done
|
||||||
*/
|
*/
|
||||||
bool fileClose(void);
|
bool fileClose();
|
||||||
/**
|
/**
|
||||||
* @brief Get the pointer on the start line and the next line (or null)
|
* @brief Get the pointer on the start line and the next line (or null)
|
||||||
* @param[in,out] _elementLine Pointer to an array of chars where the string read is copied.
|
* @param[in,out] _elementLine Pointer to an array of chars where the string read is copied.
|
||||||
@ -415,7 +415,7 @@ namespace etk {
|
|||||||
* @brief Get a unique data in the file
|
* @brief Get a unique data in the file
|
||||||
* @return the next element in the file.
|
* @return the next element in the file.
|
||||||
*/
|
*/
|
||||||
char fileGet(void);
|
char fileGet();
|
||||||
/**
|
/**
|
||||||
* @brief Get a compleate line in a text file
|
* @brief Get a compleate line in a text file
|
||||||
* @param[out] _output the next element in the file.
|
* @param[out] _output the next element in the file.
|
||||||
@ -457,7 +457,7 @@ namespace etk {
|
|||||||
* @brief Get the position in the file.
|
* @brief Get the position in the file.
|
||||||
* @return the requested position.
|
* @return the requested position.
|
||||||
*/
|
*/
|
||||||
int64_t fileTell(void);
|
int64_t fileTell();
|
||||||
/**
|
/**
|
||||||
* @brief Move in the file Position
|
* @brief Move in the file Position
|
||||||
* @param[in] _offset Offset to apply at the file
|
* @param[in] _offset Offset to apply at the file
|
||||||
@ -469,7 +469,7 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Flush the current file
|
* @brief Flush the current file
|
||||||
*/
|
*/
|
||||||
void fileFlush(void);
|
void fileFlush();
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Order the list of subnode the folder first and the alphabetical order
|
* @brief Order the list of subnode the folder first and the alphabetical order
|
||||||
@ -504,14 +504,14 @@ namespace etk {
|
|||||||
* @brief Get the home folder of the user
|
* @brief Get the home folder of the user
|
||||||
* @return the home folder : like : "/home/machin/"
|
* @return the home folder : like : "/home/machin/"
|
||||||
*/
|
*/
|
||||||
std::string getUserHomeFolder(void);
|
std::string getUserHomeFolder();
|
||||||
std::u32string getUUserHomeFolder(void);
|
std::u32string getUUserHomeFolder();
|
||||||
/**
|
/**
|
||||||
* @brief Get the folder of the Program is running
|
* @brief Get the folder of the Program is running
|
||||||
* @return the basic folder name (ex : run ./appl in the pwd=/home/machin/sousFolder ==> this return the pwd folder)
|
* @return the basic folder name (ex : run ./appl in the pwd=/home/machin/sousFolder ==> this return the pwd folder)
|
||||||
*/
|
*/
|
||||||
std::string getUserRunFolder(void);
|
std::string getUserRunFolder();
|
||||||
std::u32string getUUserRunFolder(void);
|
std::u32string getUUserRunFolder();
|
||||||
|
|
||||||
namespace theme {
|
namespace theme {
|
||||||
// TODO : Add an INIT ...
|
// TODO : Add an INIT ...
|
||||||
@ -552,9 +552,9 @@ namespace etk {
|
|||||||
* @brief Get the list of all the theme folder availlable in the user Home/appl
|
* @brief Get the list of all the theme folder availlable in the user Home/appl
|
||||||
* @return The list of elements
|
* @return The list of elements
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> list(void);
|
std::vector<std::string> list();
|
||||||
//! @previous
|
//! @previous
|
||||||
std::vector<std::u32string> listU(void);
|
std::vector<std::u32string> listU();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +22,7 @@ enum {
|
|||||||
RIGHT_USER_READ = 1 << 8,
|
RIGHT_USER_READ = 1 << 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
etk::FSNodeRight::FSNodeRight(void) :
|
etk::FSNodeRight::FSNodeRight() :
|
||||||
m_rights(0)
|
m_rights(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -47,17 +47,17 @@ const etk::FSNodeRight& etk::FSNodeRight::operator= (const int32_t _newVal )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// User
|
// User
|
||||||
bool etk::FSNodeRight::isUserReadable(void) const
|
bool etk::FSNodeRight::isUserReadable() const
|
||||||
{
|
{
|
||||||
return ((m_rights&RIGHT_USER_READ)!=0)?true:false;
|
return ((m_rights&RIGHT_USER_READ)!=0)?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool etk::FSNodeRight::isUserWritable(void) const
|
bool etk::FSNodeRight::isUserWritable() const
|
||||||
{
|
{
|
||||||
return ((m_rights&RIGHT_USER_WRITE)!=0)?true:false;
|
return ((m_rights&RIGHT_USER_WRITE)!=0)?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool etk::FSNodeRight::isUserRunable(void) const
|
bool etk::FSNodeRight::isUserRunable() const
|
||||||
{
|
{
|
||||||
return ((m_rights&RIGHT_USER_EXECUTE)!=0)?true:false;
|
return ((m_rights&RIGHT_USER_EXECUTE)!=0)?true:false;
|
||||||
}
|
}
|
||||||
@ -90,17 +90,17 @@ void etk::FSNodeRight::setUserRunable(bool _newStatus)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// group
|
// group
|
||||||
bool etk::FSNodeRight::isGroupReadable(void) const
|
bool etk::FSNodeRight::isGroupReadable() const
|
||||||
{
|
{
|
||||||
return ((m_rights&RIGHT_GROUP_READ)!=0)?true:false;
|
return ((m_rights&RIGHT_GROUP_READ)!=0)?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool etk::FSNodeRight::isGroupWritable(void) const
|
bool etk::FSNodeRight::isGroupWritable() const
|
||||||
{
|
{
|
||||||
return ((m_rights&RIGHT_GROUP_WRITE)!=0)?true:false;
|
return ((m_rights&RIGHT_GROUP_WRITE)!=0)?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool etk::FSNodeRight::isGroupRunable(void) const
|
bool etk::FSNodeRight::isGroupRunable() const
|
||||||
{
|
{
|
||||||
return ((m_rights&RIGHT_GROUP_EXECUTE)!=0)?true:false;
|
return ((m_rights&RIGHT_GROUP_EXECUTE)!=0)?true:false;
|
||||||
}
|
}
|
||||||
@ -133,17 +133,17 @@ void etk::FSNodeRight::setGroupRunable(bool _newStatus)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// other
|
// other
|
||||||
bool etk::FSNodeRight::isOtherReadable(void) const
|
bool etk::FSNodeRight::isOtherReadable() const
|
||||||
{
|
{
|
||||||
return ((m_rights&RIGHT_OTHER_READ) != 0)?true:false;
|
return ((m_rights&RIGHT_OTHER_READ) != 0)?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool etk::FSNodeRight::isOtherWritable(void) const
|
bool etk::FSNodeRight::isOtherWritable() const
|
||||||
{
|
{
|
||||||
return ((m_rights&RIGHT_OTHER_WRITE) != 0)?true:false;
|
return ((m_rights&RIGHT_OTHER_WRITE) != 0)?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool etk::FSNodeRight::isOtherRunable(void) const
|
bool etk::FSNodeRight::isOtherRunable() const
|
||||||
{
|
{
|
||||||
return ((m_rights&RIGHT_OTHER_EXECUTE) != 0)?true:false;
|
return ((m_rights&RIGHT_OTHER_EXECUTE) != 0)?true:false;
|
||||||
}
|
}
|
||||||
@ -175,11 +175,11 @@ void etk::FSNodeRight::setOtherRunable(bool _newStatus)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u32string etk::FSNodeRight::getURight(void) const {
|
std::u32string etk::FSNodeRight::getURight() const {
|
||||||
return to_u32string(getRight());
|
return to_u32string(getRight());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string etk::FSNodeRight::getRight(void) const {
|
std::string etk::FSNodeRight::getRight() const {
|
||||||
std::string tmp;
|
std::string tmp;
|
||||||
if (isUserReadable() == true) {
|
if (isUserReadable() == true) {
|
||||||
tmp += "r";
|
tmp += "r";
|
||||||
|
@ -16,41 +16,41 @@ namespace etk {
|
|||||||
private:
|
private:
|
||||||
uint16_t m_rights;
|
uint16_t m_rights;
|
||||||
public:
|
public:
|
||||||
FSNodeRight(void);
|
FSNodeRight();
|
||||||
FSNodeRight(int16_t _newRight);
|
FSNodeRight(int16_t _newRight);
|
||||||
~FSNodeRight(void) { };
|
~FSNodeRight() { };
|
||||||
// copy operator :
|
// copy operator :
|
||||||
const etk::FSNodeRight& operator= (const etk::FSNodeRight &_obj );
|
const etk::FSNodeRight& operator= (const etk::FSNodeRight &_obj );
|
||||||
// set right :
|
// set right :
|
||||||
const etk::FSNodeRight& operator= (const int32_t _newVal );
|
const etk::FSNodeRight& operator= (const int32_t _newVal );
|
||||||
|
|
||||||
void clear(void) {
|
void clear() {
|
||||||
m_rights = 0;
|
m_rights = 0;
|
||||||
};
|
};
|
||||||
// User
|
// User
|
||||||
bool isUserReadable(void) const;
|
bool isUserReadable() const;
|
||||||
bool isUserWritable(void) const;
|
bool isUserWritable() const;
|
||||||
bool isUserRunable(void) const;
|
bool isUserRunable() const;
|
||||||
void setUserReadable(bool _newStatus);
|
void setUserReadable(bool _newStatus);
|
||||||
void setUserWritable(bool _newStatus);
|
void setUserWritable(bool _newStatus);
|
||||||
void setUserRunable(bool _newStatus);
|
void setUserRunable(bool _newStatus);
|
||||||
// group
|
// group
|
||||||
bool isGroupReadable(void) const;
|
bool isGroupReadable() const;
|
||||||
bool isGroupWritable(void) const;
|
bool isGroupWritable() const;
|
||||||
bool isGroupRunable(void) const;
|
bool isGroupRunable() const;
|
||||||
void setGroupReadable(bool _newStatus);
|
void setGroupReadable(bool _newStatus);
|
||||||
void setGroupWritable(bool _newStatus);
|
void setGroupWritable(bool _newStatus);
|
||||||
void setGroupRunable(bool _newStatus);
|
void setGroupRunable(bool _newStatus);
|
||||||
// other
|
// other
|
||||||
bool isOtherReadable(void) const;
|
bool isOtherReadable() const;
|
||||||
bool isOtherWritable(void) const;
|
bool isOtherWritable() const;
|
||||||
bool isOtherRunable(void) const;
|
bool isOtherRunable() const;
|
||||||
void setOtherReadable(bool _newStatus);
|
void setOtherReadable(bool _newStatus);
|
||||||
void setOtherWritable(bool _newStatus);
|
void setOtherWritable(bool _newStatus);
|
||||||
void setOtherRunable(bool _newStatus);
|
void setOtherRunable(bool _newStatus);
|
||||||
|
|
||||||
std::u32string getURight(void) const;
|
std::u32string getURight() const;
|
||||||
std::string getRight(void) const;
|
std::string getRight() const;
|
||||||
};
|
};
|
||||||
std::ostream& operator <<(std::ostream &_os, const etk::FSNodeRight &_obj);
|
std::ostream& operator <<(std::ostream &_os, const etk::FSNodeRight &_obj);
|
||||||
};
|
};
|
||||||
|
@ -30,13 +30,13 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Create a fifo with no message.
|
* @brief Create a fifo with no message.
|
||||||
*/
|
*/
|
||||||
Fifo(void) {
|
Fifo() {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Remove the fifo and all message inside.
|
* @brief Remove the fifo and all message inside.
|
||||||
*/
|
*/
|
||||||
~Fifo(void) {
|
~Fifo() {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -98,7 +98,7 @@ namespace etk {
|
|||||||
* @brief Get the number of message in the fifo.
|
* @brief Get the number of message in the fifo.
|
||||||
* @return Number of message in the fifo.
|
* @return Number of message in the fifo.
|
||||||
*/
|
*/
|
||||||
int32_t count(void) {
|
int32_t count() {
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
int32_t nbElement = m_data.size();
|
int32_t nbElement = m_data.size();
|
||||||
m_mutex.unLock();
|
m_mutex.unLock();
|
||||||
@ -117,7 +117,7 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Remove all the message in the fifo.
|
* @brief Remove all the message in the fifo.
|
||||||
*/
|
*/
|
||||||
void clean(void) {
|
void clean() {
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
// remove data
|
// remove data
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <etk/os/Mutex.h>
|
#include <etk/os/Mutex.h>
|
||||||
#include <etk/debug.h>
|
#include <etk/debug.h>
|
||||||
|
|
||||||
etk::Mutex::Mutex(void)
|
etk::Mutex::Mutex()
|
||||||
{
|
{
|
||||||
// create interface mutex :
|
// create interface mutex :
|
||||||
int ret = pthread_mutex_init(&m_mutex, NULL);
|
int ret = pthread_mutex_init(&m_mutex, NULL);
|
||||||
@ -18,7 +18,7 @@ etk::Mutex::Mutex(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
etk::Mutex::~Mutex(void)
|
etk::Mutex::~Mutex()
|
||||||
{
|
{
|
||||||
// Remove mutex
|
// Remove mutex
|
||||||
int ret = pthread_mutex_destroy(&m_mutex);
|
int ret = pthread_mutex_destroy(&m_mutex);
|
||||||
@ -26,19 +26,19 @@ etk::Mutex::~Mutex(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void etk::Mutex::lock(void)
|
void etk::Mutex::lock()
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&m_mutex);
|
pthread_mutex_lock(&m_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool etk::Mutex::tryLock(void)
|
bool etk::Mutex::tryLock()
|
||||||
{
|
{
|
||||||
return pthread_mutex_trylock(&m_mutex) != 0;
|
return pthread_mutex_trylock(&m_mutex) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void etk::Mutex::unLock(void)
|
void etk::Mutex::unLock()
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(&m_mutex);
|
pthread_mutex_unlock(&m_mutex);
|
||||||
}
|
}
|
||||||
|
@ -9,31 +9,31 @@
|
|||||||
|
|
||||||
#include <etk/os/Mutex.h>
|
#include <etk/os/Mutex.h>
|
||||||
|
|
||||||
etk::Mutex::Mutex(void)
|
etk::Mutex::Mutex()
|
||||||
{
|
{
|
||||||
InitializeCriticalSection(&m_mutex);
|
InitializeCriticalSection(&m_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
etk::Mutex::~Mutex(void)
|
etk::Mutex::~Mutex()
|
||||||
{
|
{
|
||||||
DeleteCriticalSection(&m_mutex);
|
DeleteCriticalSection(&m_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void etk::Mutex::lock(void)
|
void etk::Mutex::lock()
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&m_mutex);
|
EnterCriticalSection(&m_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool etk::Mutex::tryLock(void)
|
bool etk::Mutex::tryLock()
|
||||||
{
|
{
|
||||||
return TryEnterCriticalSection(&m_mutex) != 0;
|
return TryEnterCriticalSection(&m_mutex) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void etk::Mutex::unLock(void)
|
void etk::Mutex::unLock()
|
||||||
{
|
{
|
||||||
LeaveCriticalSection(&m_mutex);
|
LeaveCriticalSection(&m_mutex);
|
||||||
}
|
}
|
||||||
|
@ -32,25 +32,25 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Create a new mutex
|
* @brief Create a new mutex
|
||||||
*/
|
*/
|
||||||
Mutex(void);
|
Mutex();
|
||||||
/**
|
/**
|
||||||
* @brief Destroy the mutex.
|
* @brief Destroy the mutex.
|
||||||
*/
|
*/
|
||||||
~Mutex(void);
|
~Mutex();
|
||||||
/**
|
/**
|
||||||
* @brief Lock the mutex (Wait while the mutex is not lock)
|
* @brief Lock the mutex (Wait while the mutex is not lock)
|
||||||
*/
|
*/
|
||||||
void lock(void);
|
void lock();
|
||||||
/**
|
/**
|
||||||
* @brief Try to lock the mutex (exit if mutex is already locked)
|
* @brief Try to lock the mutex (exit if mutex is already locked)
|
||||||
* @return true The mutex is locked
|
* @return true The mutex is locked
|
||||||
* @return false The mutex is already locked.
|
* @return false The mutex is already locked.
|
||||||
*/
|
*/
|
||||||
bool tryLock(void);
|
bool tryLock();
|
||||||
/**
|
/**
|
||||||
* @brief Unloc the mutex
|
* @brief Unloc the mutex
|
||||||
*/
|
*/
|
||||||
void unLock(void);
|
void unLock();
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief AutoLock and un-lock when exit fuction.
|
* @brief AutoLock and un-lock when exit fuction.
|
||||||
@ -71,7 +71,7 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Destructor that Auto Unlock mutex when remove.
|
* @brief Destructor that Auto Unlock mutex when remove.
|
||||||
*/
|
*/
|
||||||
virtual ~AutoLockMutex(void){
|
virtual ~AutoLockMutex(){
|
||||||
m_protect.unLock();
|
m_protect.unLock();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -26,7 +26,7 @@ etk::Semaphore::Semaphore(uint32_t _nbBasicElement, uint32_t _nbMessageMax) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
etk::Semaphore::~Semaphore(void) {
|
etk::Semaphore::~Semaphore() {
|
||||||
// Remove condition
|
// Remove condition
|
||||||
int ret = pthread_cond_destroy(&m_condition);
|
int ret = pthread_cond_destroy(&m_condition);
|
||||||
TK_ASSERT(ret == 0, "Error destroying Condition ...");
|
TK_ASSERT(ret == 0, "Error destroying Condition ...");
|
||||||
@ -35,7 +35,7 @@ etk::Semaphore::~Semaphore(void) {
|
|||||||
TK_ASSERT(ret == 0, "Error destroying Mutex ...");
|
TK_ASSERT(ret == 0, "Error destroying Mutex ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t etk::Semaphore::getCount(void) {
|
uint32_t etk::Semaphore::getCount() {
|
||||||
int32_t tmpData = 0;
|
int32_t tmpData = 0;
|
||||||
pthread_mutex_lock(&m_mutex);
|
pthread_mutex_lock(&m_mutex);
|
||||||
tmpData = m_data;
|
tmpData = m_data;
|
||||||
@ -43,7 +43,7 @@ uint32_t etk::Semaphore::getCount(void) {
|
|||||||
return tmpData;
|
return tmpData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void etk::Semaphore::post(void) {
|
void etk::Semaphore::post() {
|
||||||
pthread_mutex_lock(&m_mutex);
|
pthread_mutex_lock(&m_mutex);
|
||||||
if (m_data>=m_maximum) {
|
if (m_data>=m_maximum) {
|
||||||
m_data = m_maximum;
|
m_data = m_maximum;
|
||||||
@ -56,7 +56,7 @@ void etk::Semaphore::post(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void etk::Semaphore::wait(void) {
|
void etk::Semaphore::wait() {
|
||||||
pthread_mutex_lock(&m_mutex);
|
pthread_mutex_lock(&m_mutex);
|
||||||
while(m_data == 0) {
|
while(m_data == 0) {
|
||||||
pthread_cond_wait(&m_condition, &m_mutex);
|
pthread_cond_wait(&m_condition, &m_mutex);
|
||||||
|
@ -16,22 +16,22 @@ etk::Semaphore::Semaphore(uint32_t _nbBasicElement, uint32_t _nbMessageMax) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
etk::Semaphore::~Semaphore(void) {
|
etk::Semaphore::~Semaphore() {
|
||||||
CloseHandle(m_semaphore);
|
CloseHandle(m_semaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t etk::Semaphore::getCount(void) {
|
uint32_t etk::Semaphore::getCount() {
|
||||||
LONG tmpData = 0;
|
LONG tmpData = 0;
|
||||||
releaseSemaphore(m_semaphore, 0, &tmpData);
|
releaseSemaphore(m_semaphore, 0, &tmpData);
|
||||||
return tmpData;
|
return tmpData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void etk::Semaphore::post(void) {
|
void etk::Semaphore::post() {
|
||||||
releaseSemaphore(m_semaphore, 1, NULL);
|
releaseSemaphore(m_semaphore, 1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void etk::Semaphore::wait(void) {
|
void etk::Semaphore::wait() {
|
||||||
waitForSingleObject(m_semaphore, INFINITE);
|
waitForSingleObject(m_semaphore, INFINITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,20 +41,20 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Generic destructor.
|
* @brief Generic destructor.
|
||||||
*/
|
*/
|
||||||
~Semaphore(void);
|
~Semaphore();
|
||||||
/**
|
/**
|
||||||
* @brief Get the number of element in the semaphore.
|
* @brief Get the number of element in the semaphore.
|
||||||
* @return Number of stored elements.
|
* @return Number of stored elements.
|
||||||
*/
|
*/
|
||||||
uint32_t getCount(void);
|
uint32_t getCount();
|
||||||
/**
|
/**
|
||||||
* @brief Post a new semaphore
|
* @brief Post a new semaphore
|
||||||
*/
|
*/
|
||||||
void post(void);
|
void post();
|
||||||
/**
|
/**
|
||||||
* @brief Wait for a new semaphore post by an other thread.
|
* @brief Wait for a new semaphore post by an other thread.
|
||||||
*/
|
*/
|
||||||
void wait(void);
|
void wait();
|
||||||
/**
|
/**
|
||||||
* @brief Wait for a new semaphore post by an other thread,
|
* @brief Wait for a new semaphore post by an other thread,
|
||||||
* with a timeout in micro-second.
|
* with a timeout in micro-second.
|
||||||
|
@ -24,7 +24,7 @@ int32_t etk::tool::irand(int32_t _a, int32_t _b)
|
|||||||
return (int32_t)(( rand()/(double)RAND_MAX ) * ((double)_b-(double)_a) + (double)_a);
|
return (int32_t)(( rand()/(double)RAND_MAX ) * ((double)_b-(double)_a) + (double)_a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void etk::tool::resetRandom(void) {
|
void etk::tool::resetRandom() {
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace etk {
|
|||||||
/**
|
/**
|
||||||
* @brief Reset the random system with a random value (time).
|
* @brief Reset the random system with a random value (time).
|
||||||
*/
|
*/
|
||||||
void resetRandom(void);
|
void resetRandom();
|
||||||
/**
|
/**
|
||||||
* @brief Reset the random system with The specify value.
|
* @brief Reset the random system with The specify value.
|
||||||
* @param[in] _val Seek value for the pseudo random system.
|
* @param[in] _val Seek value for the pseudo random system.
|
||||||
|
@ -17,15 +17,15 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "etktest"
|
#define __class__ "etktest"
|
||||||
|
|
||||||
void testVector(void) {
|
void testVector() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void testUChar(void) {
|
void testUChar() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void testHash(void) {
|
void testHash() {
|
||||||
TK_INFO("==> Start test of Hach table");
|
TK_INFO("==> Start test of Hach table");
|
||||||
etk::Hash<std::string> testData;
|
etk::Hash<std::string> testData;
|
||||||
testData.add("TEST", "testData");
|
testData.add("TEST", "testData");
|
||||||
@ -43,7 +43,7 @@ void testHash(void) {
|
|||||||
TK_INFO("==> End test of Hach table");
|
TK_INFO("==> End test of Hach table");
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFSNode(void) {
|
void testFSNode() {
|
||||||
TK_INFO("==> Start test of FSNode");
|
TK_INFO("==> Start test of FSNode");
|
||||||
std::string fileName("USERDATA:myFileTest.txt");
|
std::string fileName("USERDATA:myFileTest.txt");
|
||||||
etk::FSNode myNodeTest1(fileName);
|
etk::FSNode myNodeTest1(fileName);
|
||||||
@ -103,7 +103,7 @@ void testFSNode(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void testArchive(void) {
|
void testArchive() {
|
||||||
TK_INFO("==> Start test of archive");
|
TK_INFO("==> Start test of archive");
|
||||||
etk::Archive* tmpArchive = etk::Archive::load("testzip.zip");
|
etk::Archive* tmpArchive = etk::Archive::load("testzip.zip");
|
||||||
tmpArchive->display();
|
tmpArchive->display();
|
||||||
@ -112,7 +112,7 @@ void testArchive(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void testDimension(void) {
|
void testDimension() {
|
||||||
TK_INFO("==> test of Dimension (START)");
|
TK_INFO("==> test of Dimension (START)");
|
||||||
|
|
||||||
ewol::Dimension myDimention(vec2(5,5), ewol::Dimension::Centimeter);
|
ewol::Dimension myDimention(vec2(5,5), ewol::Dimension::Centimeter);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user