[DEV] continue removing STL
This commit is contained in:
parent
45fbda3786
commit
3cd626eb9d
278
etk/Hash.hpp
278
etk/Hash.hpp
@ -1,278 +0,0 @@
|
|||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
* @license MPL v2.0 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <etk/types.hpp>
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <etk/String.hpp>
|
|
||||||
|
|
||||||
namespace etk {
|
|
||||||
/**
|
|
||||||
* @brief Internal data of the [class[etk::hash]] class, it contain
|
|
||||||
* the name and the value of the hash vector.
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
template<class MY_TYPE> class HashData {
|
|
||||||
public:
|
|
||||||
etk::String m_key; //!< name of the current hash
|
|
||||||
MY_TYPE m_value; //!< data of the current Hash
|
|
||||||
/**
|
|
||||||
* @brief Constructor of the data for hash table.
|
|
||||||
* @param[in] _key name of the hash table.
|
|
||||||
* @param[in] _val Value of the hash element.
|
|
||||||
*/
|
|
||||||
HashData(const etk::String& _key, const MY_TYPE& _val) :
|
|
||||||
m_key(_key),
|
|
||||||
m_value(_val) {
|
|
||||||
// nothing to do ...
|
|
||||||
}
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @brief Hash table template is a simple classical hash interface.
|
|
||||||
* A hash table is a equivalent of the dictionary in python, this is a
|
|
||||||
* simple interface between a name and a value:
|
|
||||||
* - "name" : 19
|
|
||||||
* - "name 2" : 99
|
|
||||||
*
|
|
||||||
* @note The name is unique and the value is what you want
|
|
||||||
*
|
|
||||||
* @todo check if something else exist in the generic library. (not the etk::Map and the std::unordered_map
|
|
||||||
*
|
|
||||||
* @note The index are all time available since they are created. The order is the the one created
|
|
||||||
*
|
|
||||||
* A simple example of use:
|
|
||||||
* @code{.cpp}
|
|
||||||
* // Create a integer hash table
|
|
||||||
* Hash<int> myValue;
|
|
||||||
* // add some element (note add and set is the same function)
|
|
||||||
* myValue.add("example", 98837);
|
|
||||||
* myValue.add("plop", 88);
|
|
||||||
* // Display an element:
|
|
||||||
* printf("my value is : %d", myValue["example"]);
|
|
||||||
* // Change value of an element:
|
|
||||||
* myValue.set("example", 99);
|
|
||||||
* // Remove an element:
|
|
||||||
* myValue.remove("plop");
|
|
||||||
* //Clean all the table:
|
|
||||||
* myValue.clear();
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
template<class MY_TYPE> class Hash {
|
|
||||||
private:
|
|
||||||
etk::Vector<HashData<MY_TYPE>* > m_data; //!< Data of the hash ==> the Hash table is composed of pointer, this permit to have high speed when resize the vector ...
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Constructor of the Hash table.
|
|
||||||
* @param[in] _count Number of basic element in the table.
|
|
||||||
*/
|
|
||||||
Hash(int32_t _count = 0) :
|
|
||||||
m_data(_count) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Destructor of the Hash table (clear all element in the table)
|
|
||||||
*/
|
|
||||||
~Hash() {
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Remove all entry in the Hash table.
|
|
||||||
* @note It does not delete pointer if your value is a pointer type...
|
|
||||||
*/
|
|
||||||
void clear() {
|
|
||||||
for (auto &it : m_data) {
|
|
||||||
if (it != nullptr) {
|
|
||||||
delete(it);
|
|
||||||
it=nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_data.clear();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Get a current element ID in the Hash table
|
|
||||||
* @param[in] _key Name of the hash requested
|
|
||||||
* @return Id of the element in the table or -1 of it does not existed
|
|
||||||
*/
|
|
||||||
int64_t getId(const etk::String& _key) const {
|
|
||||||
for (size_t iii=0; iii<m_data.size(); iii++) {
|
|
||||||
if (m_data[iii] != nullptr) {
|
|
||||||
//TK_INFO("Compare key : '" << m_data[iii]->m_key << "' with '" << _key << "'" );
|
|
||||||
if (m_data[iii]->m_key == _key) {
|
|
||||||
return iii;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//TK_ERROR(" ==> not fund key '" << _key << "'" );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Check if an element exist or not
|
|
||||||
* @param[in] _name Name of the hash requested
|
|
||||||
* @return true if the element exist
|
|
||||||
*/
|
|
||||||
bool exist(const etk::String& _name) const {
|
|
||||||
int64_t elementId = getId(_name);
|
|
||||||
//TK_INFO(" Exist ? '" << _name << "' id=" << elementId );
|
|
||||||
if (elementId<0) {
|
|
||||||
//TK_INFO(" ==> return false" );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//TK_INFO(" ==> return true" );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Get a current element in the hash table, with his name.
|
|
||||||
* @param[in] _key Name of the hash requested
|
|
||||||
* @return Reference on the Element
|
|
||||||
*/
|
|
||||||
MY_TYPE& get(const etk::String& _key) const {
|
|
||||||
static MY_TYPE g_error;
|
|
||||||
int64_t elementId = getId(_key);
|
|
||||||
if (elementId<0) {
|
|
||||||
//TK_ERROR("try to access at an inexistent hash element : " << _key);
|
|
||||||
return g_error;
|
|
||||||
}
|
|
||||||
return m_data[elementId]->m_value;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Get an copy Element an a special position
|
|
||||||
* @param[in] _key Name of the hash requested
|
|
||||||
* @return An reference on the copy of selected element
|
|
||||||
*/
|
|
||||||
MY_TYPE& operator[] (const etk::String& _key) {
|
|
||||||
return get(_key);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Get an copy Element an a special position
|
|
||||||
* @param[in] _key Name of the hash requested
|
|
||||||
* @return An reference on the copy of selected element
|
|
||||||
*/
|
|
||||||
const MY_TYPE& operator[] (const etk::String& _key) const {
|
|
||||||
return get(_key);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Add an element OR set an element value
|
|
||||||
* @note add and set is the same function.
|
|
||||||
* @param[in] _key Name of the value to set in the hash table.
|
|
||||||
* @param[in] _value Value to set in the hash table.
|
|
||||||
*/
|
|
||||||
void add(const etk::String& _key, const MY_TYPE& _value) {
|
|
||||||
int64_t elementId = getId(_key);
|
|
||||||
if (elementId <0) {
|
|
||||||
HashData<MY_TYPE>* tmp = new HashData<MY_TYPE>(_key, _value);
|
|
||||||
if (tmp == nullptr) {
|
|
||||||
//TK_ERROR("allocation error in Hash table : '" << _key << "'");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_data.pushBack(tmp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_data[elementId]->m_value = _value;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Set an element value
|
|
||||||
* @note add and set is the same function.
|
|
||||||
* @param[in] _key Name of the value to set in the hash table.
|
|
||||||
* @param[in] _value Value to set in the hash table.
|
|
||||||
*/
|
|
||||||
void set(const etk::String& _key, const MY_TYPE& _value) {
|
|
||||||
add(_key, _value);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Remove an element in the hash table.
|
|
||||||
* @param[in] _key Name of the element to remove.
|
|
||||||
*/
|
|
||||||
void remove(const etk::String& _key) {
|
|
||||||
int64_t elementId = getId(_key);
|
|
||||||
if (elementId <0) {
|
|
||||||
//nothing to do ==> not existed
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
delete(m_data[elementId]);
|
|
||||||
m_data[elementId] = nullptr;
|
|
||||||
m_data.erase(m_data.begin()+elementId);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Get the number of element in the hash table
|
|
||||||
* @return number of elements
|
|
||||||
*/
|
|
||||||
size_t size() const {
|
|
||||||
return m_data.size();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief get an element with his id.
|
|
||||||
* @param[in] _pos Position on the element in the hash table.
|
|
||||||
* @return requested element at this position.
|
|
||||||
* @note this is a dangerous use of the hash table. Maybe you will use a simple vector.
|
|
||||||
*/
|
|
||||||
MY_TYPE& operator[] (size_t _pos) {
|
|
||||||
return getValue(_pos);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief get an element with his id.
|
|
||||||
* @param[in] _pos Position on the element in the hash table.
|
|
||||||
* @return requested element at this position.
|
|
||||||
* @note this is a dangerous use of the hash table. Maybe you will use a simple vector.
|
|
||||||
*/
|
|
||||||
const MY_TYPE& operator[] (size_t _pos) const {
|
|
||||||
return getValue(_pos);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Get the name of the element at a specific position.
|
|
||||||
* @param[in] _pos Position of the element in the hash table.
|
|
||||||
* @return name of the element (key).
|
|
||||||
*/
|
|
||||||
const etk::String& getKey(size_t _pos) const {
|
|
||||||
// NOTE :Do not change log level, this generate error only in debug mode
|
|
||||||
#if DEBUG_LEVEL > 2
|
|
||||||
if(_pos>m_data.size()){
|
|
||||||
//TK_CRITICAL("Access to an inexistent data in hash : " << _pos << "/ " << m_data.size());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return m_data[_pos]->m_key;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Get all the element name (keys).
|
|
||||||
* @return a vector of all name (key).
|
|
||||||
*/
|
|
||||||
etk::Vector<etk::String> getKeys() const {
|
|
||||||
etk::Vector<etk::String> keys;
|
|
||||||
for (auto &it : m_data) {
|
|
||||||
if (it != nullptr) {
|
|
||||||
keys.pushBack(it->m_key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Get a value of the hash table at a specific position.
|
|
||||||
* @param[in] _pos of the element in the hash table.
|
|
||||||
* @return Value available at this position.
|
|
||||||
*/
|
|
||||||
const MY_TYPE& getValue(size_t _pos) const {
|
|
||||||
// NOTE :Do not change log level, this generate error only in debug mode
|
|
||||||
#if DEBUG_LEVEL > 2
|
|
||||||
if(_pos>m_data.size()){
|
|
||||||
//TK_CRITICAL("Access to an inexistent data in hash : " << _pos << "/ " << m_data.size());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return m_data[_pos]->m_value;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @copydoc getValue (size_t)
|
|
||||||
*/
|
|
||||||
MY_TYPE& getValue(size_t _pos) {
|
|
||||||
// NOTE :Do not change log level, this generate error only in debug mode
|
|
||||||
#if DEBUG_LEVEL > 2
|
|
||||||
if(_pos>m_data.size()){
|
|
||||||
//TK_CRITICAL("Access to an inexistent data in hash : " << _pos << "/ " << m_data.size());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return m_data[_pos]->m_value;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
33
etk/Map.hpp
33
etk/Map.hpp
@ -187,16 +187,16 @@ namespace etk {
|
|||||||
* @brief Get reference on the current Element
|
* @brief Get reference on the current Element
|
||||||
* @return the reference on the current Element
|
* @return the reference on the current Element
|
||||||
*/
|
*/
|
||||||
ETK_MAP_TYPE_DATA& operator-> () const {
|
etk::Pair<ETK_MAP_TYPE_KEY, ETK_MAP_TYPE_DATA>* operator-> () const {
|
||||||
//TK_CHECK_INOUT(m_current < m_map->size());
|
//TK_CHECK_INOUT(m_current < m_map->size());
|
||||||
return &m_map->getValue(m_current);
|
return &m_map->getContent(m_current);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Get reference on the current Element
|
* @brief Get reference on the current Element
|
||||||
* @return the reference on the current Element
|
* @return the reference on the current Element
|
||||||
*/
|
*/
|
||||||
ETK_MAP_TYPE_DATA& operator* () const {
|
etk::Pair<ETK_MAP_TYPE_KEY, ETK_MAP_TYPE_DATA>& operator* () const {
|
||||||
return m_map->getValue(m_current);
|
return m_map->getContent(m_current);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Get Key on the current Element
|
* @brief Get Key on the current Element
|
||||||
@ -219,7 +219,14 @@ namespace etk {
|
|||||||
ETK_MAP_TYPE_DATA& getValue () {
|
ETK_MAP_TYPE_DATA& getValue () {
|
||||||
return m_map->getValue(m_current);
|
return m_map->getValue(m_current);
|
||||||
}
|
}
|
||||||
|
bool operator== (const Iterator& _obj) const{
|
||||||
|
return m_map == _obj.m_map
|
||||||
|
&& m_current == _obj.m_current;
|
||||||
|
}
|
||||||
|
bool operator!= (const Iterator& _obj) const {
|
||||||
|
return m_map != _obj.m_map
|
||||||
|
|| m_current != _obj.m_current;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
Iterator(const etk::Map<ETK_MAP_TYPE_KEY, ETK_MAP_TYPE_DATA> * _obj, int32_t _pos):
|
Iterator(const etk::Map<ETK_MAP_TYPE_KEY, ETK_MAP_TYPE_DATA> * _obj, int32_t _pos):
|
||||||
m_current(_pos),
|
m_current(_pos),
|
||||||
@ -312,7 +319,7 @@ namespace etk {
|
|||||||
//TK_ERROR("try to access at an inexistent Map element : " << _key);
|
//TK_ERROR("try to access at an inexistent Map element : " << _key);
|
||||||
return g_error;
|
return g_error;
|
||||||
}
|
}
|
||||||
return m_data[elementId]->m_value;
|
return m_data[elementId]->second;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Get an copy Element an a special position
|
* @brief Get an copy Element an a special position
|
||||||
@ -393,13 +400,19 @@ namespace etk {
|
|||||||
size_t size() const {
|
size_t size() const {
|
||||||
return m_data.size();
|
return m_data.size();
|
||||||
}
|
}
|
||||||
|
const etk::Pair<ETK_MAP_TYPE_KEY, ETK_MAP_TYPE_DATA>& getContent(size_t _pos) const {
|
||||||
|
return *m_data[_pos];
|
||||||
|
}
|
||||||
|
etk::Pair<ETK_MAP_TYPE_KEY, ETK_MAP_TYPE_DATA>& getContent(size_t _pos) {
|
||||||
|
return *m_data[_pos];
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Get the name of the element at a specific position.
|
* @brief Get the name of the element at a specific position.
|
||||||
* @param[in] _pos Position of the element in the Map table.
|
* @param[in] _pos Position of the element in the Map table.
|
||||||
* @return name of the element (key).
|
* @return name of the element (key).
|
||||||
*/
|
*/
|
||||||
const ETK_MAP_TYPE_KEY& getKey(size_t _pos) const {
|
const ETK_MAP_TYPE_KEY& getKey(size_t _pos) const {
|
||||||
return m_data[_pos]->m_key;
|
return m_data[_pos]->first;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Get all the element name (keys).
|
* @brief Get all the element name (keys).
|
||||||
@ -409,7 +422,7 @@ namespace etk {
|
|||||||
etk::Vector<ETK_MAP_TYPE_KEY> keys;
|
etk::Vector<ETK_MAP_TYPE_KEY> keys;
|
||||||
for (auto &it : m_data) {
|
for (auto &it : m_data) {
|
||||||
if (it != nullptr) {
|
if (it != nullptr) {
|
||||||
keys.pushBack(it->m_key);
|
keys.pushBack(it->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return etk::move(keys);
|
return etk::move(keys);
|
||||||
@ -455,10 +468,10 @@ namespace etk {
|
|||||||
* @return The Iterator
|
* @return The Iterator
|
||||||
*/
|
*/
|
||||||
Iterator end() {
|
Iterator end() {
|
||||||
return position(size()-1);
|
return position(size());
|
||||||
}
|
}
|
||||||
const Iterator end() const {
|
const Iterator end() const {
|
||||||
return position(size()-1);
|
return position(size());
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator find(const ETK_MAP_TYPE_KEY& _key) {
|
Iterator find(const ETK_MAP_TYPE_KEY& _key) {
|
||||||
|
@ -12,6 +12,7 @@ namespace etk {
|
|||||||
template<class ETK_PAIR_TYPE_1, class ETK_PAIR_TYPE_2>
|
template<class ETK_PAIR_TYPE_1, class ETK_PAIR_TYPE_2>
|
||||||
class Pair {
|
class Pair {
|
||||||
public:
|
public:
|
||||||
|
// this is bad for coding rules, but an idiom of c++ pair imposed by the STL
|
||||||
ETK_PAIR_TYPE_1 first;
|
ETK_PAIR_TYPE_1 first;
|
||||||
ETK_PAIR_TYPE_2 second;
|
ETK_PAIR_TYPE_2 second;
|
||||||
Pair():
|
Pair():
|
||||||
@ -30,6 +31,14 @@ namespace etk {
|
|||||||
second(_pair.second) {
|
second(_pair.second) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
bool operator== (const Pair<ETK_PAIR_TYPE_1, ETK_PAIR_TYPE_2>& _obj) const{
|
||||||
|
return first == _obj.first
|
||||||
|
&& second == _obj.second;
|
||||||
|
}
|
||||||
|
bool operator!= (const Pair<ETK_PAIR_TYPE_1, ETK_PAIR_TYPE_2>& _obj) const{
|
||||||
|
return first != _obj.first
|
||||||
|
|| second != _obj.second;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
template<class ETK_PAIR_TYPE_1, class ETK_PAIR_TYPE_2>
|
template<class ETK_PAIR_TYPE_1, class ETK_PAIR_TYPE_2>
|
||||||
Pair<ETK_PAIR_TYPE_1, ETK_PAIR_TYPE_2> makePair(ETK_PAIR_TYPE_1 _obj1, ETK_PAIR_TYPE_2 _obj2) {
|
Pair<ETK_PAIR_TYPE_1, ETK_PAIR_TYPE_2> makePair(ETK_PAIR_TYPE_1 _obj1, ETK_PAIR_TYPE_2 _obj2) {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <etk/stdTools.hpp>
|
#include <etk/stdTools.hpp>
|
||||||
#include <etk/String.hpp>
|
#include <etk/String.hpp>
|
||||||
#include <etk/UString.hpp>
|
#include <etk/UString.hpp>
|
||||||
#include <etk/pair.hpp>
|
#include <etk/Pair.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#define TK_REG_DEBUG TK_HIDDEN
|
#define TK_REG_DEBUG TK_HIDDEN
|
||||||
|
@ -933,6 +933,13 @@ etk::Vector<etk::String> etk::String::split(etk::String _val) const {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void etk::String::append(Iterator _start, Iterator _stop) {
|
||||||
|
while (_stop != _start) {
|
||||||
|
pushBack(*_start);
|
||||||
|
++_start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
long double string_to_long_double(const etk::String& _obj) {
|
long double string_to_long_double(const etk::String& _obj) {
|
||||||
return _obj.to<long double>();
|
return _obj.to<long double>();
|
||||||
|
@ -420,6 +420,7 @@ namespace etk {
|
|||||||
* @param[in] _value Value to set at the new element
|
* @param[in] _value Value to set at the new element
|
||||||
*/
|
*/
|
||||||
void resize(size_t _newSize, char _value = '\0');
|
void resize(size_t _newSize, char _value = '\0');
|
||||||
|
void append(Iterator _start, Iterator _stop);
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
* == operator
|
* == operator
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
|
@ -189,7 +189,7 @@ namespace etk {
|
|||||||
* @brief Get reference on the current Element
|
* @brief Get reference on the current Element
|
||||||
* @return the reference on the current Element
|
* @return the reference on the current Element
|
||||||
*/
|
*/
|
||||||
ETK_VECTOR_TYPE & operator-> () const {
|
ETK_VECTOR_TYPE* operator-> () const {
|
||||||
//TK_CHECK_INOUT(m_current < m_vector->size());
|
//TK_CHECK_INOUT(m_current < m_vector->size());
|
||||||
return &m_vector->get(m_current);
|
return &m_vector->get(m_current);
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ namespace etk {
|
|||||||
* @brief Get reference on the current Element
|
* @brief Get reference on the current Element
|
||||||
* @return the reference on the current Element
|
* @return the reference on the current Element
|
||||||
*/
|
*/
|
||||||
ETK_VECTOR_TYPE & operator* () const {
|
ETK_VECTOR_TYPE& operator* () const {
|
||||||
//TK_CHECK_INOUT(m_current < m_vector->size());
|
//TK_CHECK_INOUT(m_current < m_vector->size());
|
||||||
return m_vector->get(m_current);
|
return m_vector->get(m_current);
|
||||||
}
|
}
|
||||||
@ -626,10 +626,10 @@ namespace etk {
|
|||||||
* @return The Iterator
|
* @return The Iterator
|
||||||
*/
|
*/
|
||||||
Iterator end() {
|
Iterator end() {
|
||||||
return position( size()-1 );
|
return position(size());
|
||||||
}
|
}
|
||||||
const Iterator end() const {
|
const Iterator end() const {
|
||||||
return position( size()-1 );
|
return position(size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,7 @@ const etk::String& etk::Archive::getName(size_t _id) const {
|
|||||||
size_t id = 0;
|
size_t id = 0;
|
||||||
for (auto &it : m_content) {
|
for (auto &it : m_content) {
|
||||||
if (id == _id) {
|
if (id == _id) {
|
||||||
return it.getKey();
|
return it.first;
|
||||||
}
|
}
|
||||||
++id;
|
++id;
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ const etk::ArchiveContent& etk::Archive::getContent(size_t _id) const {
|
|||||||
size_t id = 0;
|
size_t id = 0;
|
||||||
for (auto &it : m_content) {
|
for (auto &it : m_content) {
|
||||||
if (id == _id) {
|
if (id == _id) {
|
||||||
return it.getValue();
|
return it.second;
|
||||||
}
|
}
|
||||||
++id;
|
++id;
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ const etk::ArchiveContent& etk::Archive::getContent(const etk::String& _key) con
|
|||||||
if (it == m_content.end()) {
|
if (it == m_content.end()) {
|
||||||
return g_error;
|
return g_error;
|
||||||
}
|
}
|
||||||
return it->getValue();
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -55,9 +55,9 @@ bool etk::Archive::exist(const etk::String& _key) const {
|
|||||||
void etk::Archive::display() {
|
void etk::Archive::display() {
|
||||||
std::unique_lock<std::mutex> lock(m_mutex);
|
std::unique_lock<std::mutex> lock(m_mutex);
|
||||||
for (auto &it : m_content) {
|
for (auto &it : m_content) {
|
||||||
int32_t size = it.getValue().getTheoricSize();
|
int32_t size = it.second.getTheoricSize();
|
||||||
int32_t sizeR = it.getValue().size();
|
int32_t sizeR = it.second.size();
|
||||||
TK_INFO(" element : " << it.getKey() << " size=" << size << " allocated=" << sizeR);
|
TK_INFO(" element : " << it.first << " size=" << size << " allocated=" << sizeR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,11 +118,11 @@ void etk::Archive::open(const etk::String& _key) {
|
|||||||
TK_ERROR("Try open an unexistant file : '" << _key << "'");
|
TK_ERROR("Try open an unexistant file : '" << _key << "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (it->getValue().getNumberOfRef()==-1) {
|
if (it->second.getNumberOfRef()==-1) {
|
||||||
loadFile(it);
|
loadFile(it);
|
||||||
it->getValue().increaseRef();
|
it->second.increaseRef();
|
||||||
}
|
}
|
||||||
it->getValue().increaseRef();
|
it->second.increaseRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
void etk::Archive::close(const etk::String& _key) {
|
void etk::Archive::close(const etk::String& _key) {
|
||||||
@ -132,10 +132,10 @@ void etk::Archive::close(const etk::String& _key) {
|
|||||||
TK_ERROR("Try close an unexistant file : '" << _key << "'");
|
TK_ERROR("Try close an unexistant file : '" << _key << "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (it->getValue().getNumberOfRef()==0){
|
if (it->second.getNumberOfRef()==0){
|
||||||
TK_ERROR("Try close one more time the file : '" << _key << "'");
|
TK_ERROR("Try close one more time the file : '" << _key << "'");
|
||||||
} else {
|
} else {
|
||||||
it->getValue().decreaseRef();
|
it->second.decreaseRef();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ etk::archive::Zip::Zip(const etk::String& _fileName, uint64_t _offset) :
|
|||||||
// find directory ...
|
// find directory ...
|
||||||
} else {
|
} else {
|
||||||
TK_INFO("find file : " << tmpFileName);
|
TK_INFO("find file : " << tmpFileName);
|
||||||
m_content.insert(etk::Pair<etk::String, etk::ArchiveContent>(tmpFileName, etk::ArchiveContent(tmpFileInfo.uncompressed_size)));
|
m_content.set(tmpFileName, etk::ArchiveContent(tmpFileInfo.uncompressed_size));
|
||||||
}
|
}
|
||||||
/* Go the the next entry listed in the zip file. */
|
/* Go the the next entry listed in the zip file. */
|
||||||
if((iii+1) < m_info.number_entry) {
|
if((iii+1) < m_info.number_entry) {
|
||||||
|
33
etk/move.hpp
33
etk/move.hpp
@ -1 +1,32 @@
|
|||||||
https://stackoverflow.com/questions/7510182/how-does-stdmove-transfer-values-into-rvalues
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL-2 (see license file)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
namespace etk {
|
||||||
|
template<class ETK_MOVE_TYPE>
|
||||||
|
struct _Remove_reference {
|
||||||
|
// remove reference
|
||||||
|
typedef ETK_MOVE_TYPE m_type;
|
||||||
|
};
|
||||||
|
template<class ETK_MOVE_TYPE>
|
||||||
|
struct _Remove_reference<ETK_MOVE_TYPE&> {
|
||||||
|
// remove reference
|
||||||
|
typedef ETK_MOVE_TYPE m_type;
|
||||||
|
};
|
||||||
|
template<class ETK_MOVE_TYPE>
|
||||||
|
struct _Remove_reference<ETK_MOVE_TYPE&&> {
|
||||||
|
// remove rvalue reference
|
||||||
|
typedef ETK_MOVE_TYPE m_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class ETK_MOVE_TYPE> inline
|
||||||
|
typename etk::_Remove_reference<ETK_MOVE_TYPE>::m_type&& move(ETK_MOVE_TYPE&& _obj) {
|
||||||
|
// forward _Arg as movable
|
||||||
|
return ((typename etk::_Remove_reference<ETK_MOVE_TYPE>::m_type&&)_obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -489,11 +489,6 @@ etk::String getApplicationPath() {
|
|||||||
TK_INFO("Binary name : " << binaryName);
|
TK_INFO("Binary name : " << binaryName);
|
||||||
return binaryName;
|
return binaryName;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString getUApplicationPath() {
|
|
||||||
return etk::toUString(getApplicationPath());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void etk::initDefaultFolder(const char* _applName) {
|
void etk::initDefaultFolder(const char* _applName) {
|
||||||
baseApplName = _applName;
|
baseApplName = _applName;
|
||||||
@ -652,20 +647,10 @@ void etk::initDefaultFolder(const char* _applName) {
|
|||||||
etk::String etk::getUserHomeFolder() {
|
etk::String etk::getUserHomeFolder() {
|
||||||
return baseFolderHome;
|
return baseFolderHome;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::getUUserHomeFolder() {
|
|
||||||
return etk::toUString(baseFolderHome);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
etk::String etk::getUserRunFolder() {
|
etk::String etk::getUserRunFolder() {
|
||||||
return baseRunPath;
|
return baseRunPath;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::getUUserRunFolder() {
|
|
||||||
return etk::toUString(baseRunPath);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_ZIP_DATA
|
#ifdef HAVE_ZIP_DATA
|
||||||
@ -704,23 +689,6 @@ etk::FSNode::FSNode(const etk::String& _nodeName) :
|
|||||||
{
|
{
|
||||||
privateSetName(_nodeName);
|
privateSetName(_nodeName);
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::FSNode::FSNode(const etk::UString& _nodeName) :
|
|
||||||
m_userFileName(""),
|
|
||||||
m_type(etk::FSNType_unknow),
|
|
||||||
m_typeNode(etk::typeNode_unknow),
|
|
||||||
m_PointerFile(nullptr),
|
|
||||||
m_timeCreate(0),
|
|
||||||
m_timeModify(0),
|
|
||||||
m_timeAccess(0)
|
|
||||||
#ifdef HAVE_ZIP_DATA
|
|
||||||
, m_zipContent(nullptr),
|
|
||||||
m_zipReadingOffset(-1)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
privateSetName(_nodeName);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
etk::FSNode::~FSNode() {
|
etk::FSNode::~FSNode() {
|
||||||
@ -939,11 +907,6 @@ void etk::FSNode::privateSetName(etk::String _newName) {
|
|||||||
updateFileSystemProperty();
|
updateFileSystemProperty();
|
||||||
TK_DBG_MODE("6 : type : [" << m_typeNode << "] right :" << m_rights);
|
TK_DBG_MODE("6 : type : [" << m_typeNode << "] right :" << m_rights);
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
void etk::FSNode::privateSetName(const etk::UString& _newName) {
|
|
||||||
privateSetName(etk::toString(_newName));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool directCheckFile(etk::String _tmpFileNameDirect, bool _checkInAPKIfNeeded = false) {
|
bool directCheckFile(etk::String _tmpFileNameDirect, bool _checkInAPKIfNeeded = false) {
|
||||||
#ifdef HAVE_ZIP_DATA
|
#ifdef HAVE_ZIP_DATA
|
||||||
@ -962,11 +925,6 @@ bool directCheckFile(etk::String _tmpFileNameDirect, bool _checkInAPKIfNeeded =
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool directCheckFile(etk::UString _tmpFileNameDirect, bool _checkInAPKIfNeeded = false) {
|
|
||||||
return directCheckFile(etk::toString(_tmpFileNameDirect));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// Now we generate the real FS path:
|
// Now we generate the real FS path:
|
||||||
void etk::FSNode::generateFileSystemPath() {
|
void etk::FSNode::generateFileSystemPath() {
|
||||||
bool forceLibFolder(false);
|
bool forceLibFolder(false);
|
||||||
@ -1026,7 +984,6 @@ void etk::FSNode::generateFileSystemPath() {
|
|||||||
case etk::FSNType_theme:
|
case etk::FSNType_theme:
|
||||||
case etk::FSNType_themeData:
|
case etk::FSNType_themeData:
|
||||||
{
|
{
|
||||||
//etk::UString myCompleateName=baseFolderData + "/theme/";
|
|
||||||
etk::String themeName("");
|
etk::String themeName("");
|
||||||
etk::String basicName(m_userFileName);
|
etk::String basicName(m_userFileName);
|
||||||
size_t firstPos = m_userFileName.find(':');
|
size_t firstPos = m_userFileName.find(':');
|
||||||
@ -1230,11 +1187,6 @@ bool etk::FSNode::setRight(etk::FSNodeRight _newRight) {
|
|||||||
void etk::FSNode::setName(const etk::String& _newName) {
|
void etk::FSNode::setName(const etk::String& _newName) {
|
||||||
privateSetName(_newName);
|
privateSetName(_newName);
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
void etk::FSNode::setName(const etk::UString& _newName) {
|
|
||||||
privateSetName(_newName);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
etk::String etk::FSNode::getNameFolder() const {
|
etk::String etk::FSNode::getNameFolder() const {
|
||||||
size_t lastPos = m_systemFileName.rfind('/');
|
size_t lastPos = m_systemFileName.rfind('/');
|
||||||
@ -1243,20 +1195,10 @@ etk::String etk::FSNode::getNameFolder() const {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::FSNode::getUNameFolder() const {
|
|
||||||
return etk::toUString(getNameFolder());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
etk::String etk::FSNode::getFileSystemName() const {
|
etk::String etk::FSNode::getFileSystemName() const {
|
||||||
return m_systemFileName;
|
return m_systemFileName;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::FSNode::getUFileSystemName() const {
|
|
||||||
return etk::toUString(getFileSystemName());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
etk::String etk::FSNode::getName() const {
|
etk::String etk::FSNode::getName() const {
|
||||||
etk::String output("");
|
etk::String output("");
|
||||||
@ -1296,11 +1238,6 @@ etk::String etk::FSNode::getName() const {
|
|||||||
output += m_userFileName;
|
output += m_userFileName;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::FSNode::getUName() const {
|
|
||||||
return etk::toUString(getName());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
etk::String etk::FSNode::getNameFile() const {
|
etk::String etk::FSNode::getNameFile() const {
|
||||||
size_t lastPos = m_systemFileName.rfind('/');
|
size_t lastPos = m_systemFileName.rfind('/');
|
||||||
@ -1309,11 +1246,6 @@ etk::String etk::FSNode::getNameFile() const {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::FSNode::getUNameFile() const {
|
|
||||||
return etk::toUString(getNameFile());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
etk::String etk::FSNode::getRelativeFolder() const {
|
etk::String etk::FSNode::getRelativeFolder() const {
|
||||||
etk::String tmppp = getName();
|
etk::String tmppp = getName();
|
||||||
@ -1353,11 +1285,6 @@ etk::String etk::FSNode::getRelativeFolder() const {
|
|||||||
TK_DBG_MODE(" ==> : ''" );
|
TK_DBG_MODE(" ==> : ''" );
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::FSNode::getURelativeFolder() const {
|
|
||||||
return etk::toUString(getRelativeFolder());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
bool etk::FSNode::touch() {
|
bool etk::FSNode::touch() {
|
||||||
@ -1389,11 +1316,6 @@ bool etk::FSNode::move(const etk::String& _path) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool etk::FSNode::move(const etk::UString& _path) {
|
|
||||||
return move(etk::toString(_path));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool etk::FSNode::remove() {
|
bool etk::FSNode::remove() {
|
||||||
if (getNodeType()==etk::typeNode_folder) {
|
if (getNodeType()==etk::typeNode_folder) {
|
||||||
@ -1426,11 +1348,6 @@ etk::String etk::FSNode::timeCreatedString() const {
|
|||||||
}
|
}
|
||||||
return tmpTime;
|
return tmpTime;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::FSNode::timeUCreatedString() const {
|
|
||||||
return etk::toUString(timeCreatedString());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint64_t etk::FSNode::timeModified() const {
|
uint64_t etk::FSNode::timeModified() const {
|
||||||
return m_timeModify;
|
return m_timeModify;
|
||||||
@ -1444,11 +1361,6 @@ etk::String etk::FSNode::timeModifiedString() const {
|
|||||||
}
|
}
|
||||||
return tmpTime;
|
return tmpTime;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::FSNode::timeUModifiedString() const {
|
|
||||||
return etk::toUString(timeModifiedString());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint64_t etk::FSNode::timeAccessed() const {
|
uint64_t etk::FSNode::timeAccessed() const {
|
||||||
return m_timeAccess;
|
return m_timeAccess;
|
||||||
@ -1462,11 +1374,6 @@ etk::String etk::FSNode::timeAccessedString() const {
|
|||||||
}
|
}
|
||||||
return tmpTime;
|
return tmpTime;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::FSNode::timeUAccessedString() const {
|
|
||||||
return etk::toUString(timeAccessedString());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
Operator :
|
Operator :
|
||||||
*/
|
*/
|
||||||
@ -1903,16 +1810,6 @@ void etk::FSNode::folderGetRecursiveFiles(etk::Vector<etk::String>& _output, boo
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
void etk::FSNode::folderGetRecursiveFiles(etk::Vector<etk::UString>& _output, bool _recursiveEnable) {
|
|
||||||
_output.clear();
|
|
||||||
etk::Vector<etk::String> tmpVal;
|
|
||||||
folderGetRecursiveFiles(tmpVal, _recursiveEnable);
|
|
||||||
for (size_t iii=0; iii<tmpVal.size(); ++iii) {
|
|
||||||
_output.pushBack(toUString(tmpVal[iii]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
File Specific :
|
File Specific :
|
||||||
@ -1936,11 +1833,6 @@ etk::String etk::FSNode::fileGetExtention() {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::FSNode::fileUGetExtention() {
|
|
||||||
return etk::toUString(fileGetExtention());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint64_t etk::FSNode::fileSize() {
|
uint64_t etk::FSNode::fileSize() {
|
||||||
if (m_typeNode != etk::typeNode_file) {
|
if (m_typeNode != etk::typeNode_file) {
|
||||||
@ -2317,99 +2209,43 @@ static etk::Map<etk::String, etk::String> g_listTheme;
|
|||||||
|
|
||||||
void etk::theme::setName(const etk::String& _refName, const etk::String& _folderName) {
|
void etk::theme::setName(const etk::String& _refName, const etk::String& _folderName) {
|
||||||
TK_WARNING("Change theme : '" << _refName << "' : '" << _folderName << "'");
|
TK_WARNING("Change theme : '" << _refName << "' : '" << _folderName << "'");
|
||||||
#if __CPP_VERSION__ >= 2011
|
g_listTheme.set(_refName, _folderName);
|
||||||
auto it = g_listTheme.find(_refName);
|
|
||||||
#else
|
|
||||||
etk::Map<etk::String, etk::String>::iterator it = g_listTheme.find(_refName);
|
|
||||||
#endif
|
|
||||||
if (it != g_listTheme.end()) {
|
|
||||||
it->second = _folderName;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_listTheme.insert(etk::Pair<etk::String,etk::String>(_refName, _folderName));
|
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
void etk::theme::setName(const etk::UString& _refName, const etk::UString& _folderName) {
|
|
||||||
setName(etk::toString(_refName), etk::toString(_folderName));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
etk::String etk::theme::getName(const etk::String& _refName) {
|
etk::String etk::theme::getName(const etk::String& _refName) {
|
||||||
#if __CPP_VERSION__ >= 2011
|
auto it = g_listTheme.find(_refName);
|
||||||
auto it = g_listTheme.find(_refName);
|
|
||||||
#else
|
|
||||||
etk::Map<etk::String, etk::String>::iterator it = g_listTheme.find(_refName);
|
|
||||||
#endif
|
|
||||||
if (it != g_listTheme.end()) {
|
if (it != g_listTheme.end()) {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
return _refName;
|
return _refName;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::theme::getName(const etk::UString& _refName) {
|
|
||||||
return etk::toUString(getName(etk::toString(_refName)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 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
|
||||||
etk::Vector<etk::String> etk::theme::list() {
|
etk::Vector<etk::String> etk::theme::list() {
|
||||||
etk::Vector<etk::String> keys;
|
etk::Vector<etk::String> keys;
|
||||||
#if __CPP_VERSION__ >= 2011
|
for (auto &it : g_listTheme) {
|
||||||
for (auto &it : g_listTheme) {
|
keys.pushBack(it.first);
|
||||||
keys.pushBack(it.first);
|
}
|
||||||
}
|
|
||||||
#else
|
|
||||||
for (etk::Map<etk::String, etk::String>::iterator it(g_listTheme.begin()); it != g_listTheme.end(); ++it) {
|
|
||||||
keys.pushBack(it->first);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::Vector<etk::UString> etk::theme::listU() {
|
|
||||||
etk::Vector<etk::UString> keys;
|
|
||||||
for (auto &it : g_listTheme) {
|
|
||||||
keys.pushBack(etk::toUString(it.first));
|
|
||||||
}
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static etk::Map<etk::String, etk::String> g_listThemeDefault;
|
static etk::Map<etk::String, etk::String> g_listThemeDefault;
|
||||||
void etk::theme::setNameDefault(const etk::String& _refName, const etk::String& _folderName) {
|
void etk::theme::setNameDefault(const etk::String& _refName, const etk::String& _folderName) {
|
||||||
#if __CPP_VERSION__ >= 2011
|
auto it = g_listThemeDefault.find(_refName);
|
||||||
auto it = g_listThemeDefault.find(_refName);
|
|
||||||
#else
|
|
||||||
etk::Map<etk::String, etk::String>::iterator it = g_listThemeDefault.find(_refName);
|
|
||||||
#endif
|
|
||||||
if (it != g_listThemeDefault.end()) {
|
if (it != g_listThemeDefault.end()) {
|
||||||
it->second = _folderName;
|
it->second = _folderName;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g_listThemeDefault.insert(etk::Pair<etk::String,etk::String>(_refName, _folderName));
|
g_listThemeDefault.set(_refName, _folderName);
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
void etk::theme::setNameDefault(const etk::UString& _refName, const etk::UString& _folderName) {
|
|
||||||
setNameDefault(etk::toString(_refName), etk::toString(_folderName));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
etk::String etk::theme::getNameDefault(const etk::String& _refName) {
|
etk::String etk::theme::getNameDefault(const etk::String& _refName) {
|
||||||
#if __CPP_VERSION__ >= 2011
|
auto it = g_listThemeDefault.find(_refName);
|
||||||
auto it=g_listThemeDefault.find(_refName);
|
|
||||||
#else
|
|
||||||
etk::Map<etk::String, etk::String>::iterator it = g_listThemeDefault.find(_refName);
|
|
||||||
#endif
|
|
||||||
if (it != g_listThemeDefault.end()) {
|
if (it != g_listThemeDefault.end()) {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
return "default";
|
return "default";
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::theme::getNameDefault(const etk::UString& _refName) {
|
|
||||||
return etk::toUString(getNameDefault(etk::toString(_refName)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2420,16 +2256,11 @@ etk::String etk::theme::getNameDefault(const etk::String& _refName) {
|
|||||||
* -------------------------------------------------------------------------- */
|
* -------------------------------------------------------------------------- */
|
||||||
uint64_t etk::FSNodeGetSize(const etk::String& _path) {
|
uint64_t etk::FSNodeGetSize(const etk::String& _path) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
if (false==tmpNode.exist()) {
|
if (tmpNode.exist() == false) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return tmpNode.fileSize();
|
return tmpNode.fileSize();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
uint64_t etk::FSNodeGetSize(const etk::UString& _path) {
|
|
||||||
return FSNodeGetSize(etk::toString(_path));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool etk::FSNodeRemove(const etk::String& _path) {
|
bool etk::FSNodeRemove(const etk::String& _path) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
@ -2438,11 +2269,6 @@ bool etk::FSNodeRemove(const etk::String& _path) {
|
|||||||
}
|
}
|
||||||
return tmpNode.remove();
|
return tmpNode.remove();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool etk::FSNodeRemove(const etk::UString& _path) {
|
|
||||||
return FSNodeRemove(etk::toString(_path));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int64_t etk::FSNodeGetCount(const etk::String& _path) {
|
int64_t etk::FSNodeGetCount(const etk::String& _path) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
@ -2451,31 +2277,16 @@ int64_t etk::FSNodeGetCount(const etk::String& _path) {
|
|||||||
}
|
}
|
||||||
return tmpNode.folderCount();
|
return tmpNode.folderCount();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
int64_t etk::FSNodeGetCount(const etk::UString& _path) {
|
|
||||||
return FSNodeGetCount(etk::toString(_path));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool etk::FSNodeCreate(const etk::String& _path, etk::FSNodeRight _right, enum etk::typeNode _type) {
|
bool etk::FSNodeCreate(const etk::String& _path, etk::FSNodeRight _right, enum etk::typeNode _type) {
|
||||||
// TODO :
|
// TODO :
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool etk::FSNodeCreate(const etk::UString& _path, etk::FSNodeRight _right, enum etk::typeNode _type) {
|
|
||||||
return FSNodeCreate(etk::toString(_path), _right, _type);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool etk::FSNodeExist(const etk::String& _path) {
|
bool etk::FSNodeExist(const etk::String& _path) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
return tmpNode.exist();
|
return tmpNode.exist();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool etk::FSNodeExist(const etk::UString& _path) {
|
|
||||||
return FSNodeExist(etk::toString(_path));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool etk::FSNodeMove(const etk::String& _path1, const etk::String& _path2) {
|
bool etk::FSNodeMove(const etk::String& _path1, const etk::String& _path2) {
|
||||||
etk::FSNode tmpNode(_path1);
|
etk::FSNode tmpNode(_path1);
|
||||||
@ -2488,71 +2299,36 @@ bool etk::FSNodeMove(const etk::String& _path1, const etk::String& _path2) {
|
|||||||
//move the node
|
//move the node
|
||||||
return tmpNode.move(_path2);
|
return tmpNode.move(_path2);
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool etk::FSNodeMove(const etk::UString& _path1, const etk::UString& _path2) {
|
|
||||||
return FSNodeMove(etk::toString(_path1), etk::toString(_path2));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
etk::FSNodeRight etk::FSNodeGetRight(const etk::String& _path) {
|
etk::FSNodeRight etk::FSNodeGetRight(const etk::String& _path) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
return tmpNode.getRight();
|
return tmpNode.getRight();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::FSNodeRight etk::FSNodeGetRight(const etk::UString& _path) {
|
|
||||||
return FSNodeGetRight(etk::toString(_path));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum etk::typeNode etk::FSNodeGetType(const etk::String& _path) {
|
enum etk::typeNode etk::FSNodeGetType(const etk::String& _path) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
return tmpNode.getNodeType();
|
return tmpNode.getNodeType();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
enum etk::typeNode etk::FSNodeGetType(const etk::UString& _path) {
|
|
||||||
return FSNodeGetType(etk::toString(_path));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint64_t etk::FSNodeGetTimeCreated(const etk::String& _path) {
|
uint64_t etk::FSNodeGetTimeCreated(const etk::String& _path) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
return tmpNode.timeCreated();
|
return tmpNode.timeCreated();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
uint64_t etk::FSNodeGetTimeCreated(const etk::UString& _path) {
|
|
||||||
return FSNodeGetTimeCreated(etk::toString(_path));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint64_t etk::FSNodeGetTimeModified(const etk::String& _path) {
|
uint64_t etk::FSNodeGetTimeModified(const etk::String& _path) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
return tmpNode.timeModified();
|
return tmpNode.timeModified();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
uint64_t etk::FSNodeGetTimeModified(const etk::UString& _path) {
|
|
||||||
return FSNodeGetTimeModified(etk::toString(_path));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint64_t etk::FSNodeGetTimeAccessed(const etk::String& _path) {
|
uint64_t etk::FSNodeGetTimeAccessed(const etk::String& _path) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
return tmpNode.timeAccessed();
|
return tmpNode.timeAccessed();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
uint64_t etk::FSNodeGetTimeAccessed(const etk::UString& _path) {
|
|
||||||
return FSNodeGetTimeAccessed(etk::toString(_path));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool etk::FSNodeTouch(const etk::String& _path) {
|
bool etk::FSNodeTouch(const etk::String& _path) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
return tmpNode.touch();
|
return tmpNode.touch();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool etk::FSNodeTouch(const etk::UString& _path) {
|
|
||||||
return FSNodeTouch(etk::toString(_path));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool etk::FSNodeEcho(const etk::String& _path, const etk::String& _dataTowrite) {
|
bool etk::FSNodeEcho(const etk::String& _path, const etk::String& _dataTowrite) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
@ -2572,11 +2348,6 @@ bool etk::FSNodeEcho(const etk::String& _path, const etk::String& _dataTowrite)
|
|||||||
}
|
}
|
||||||
return tmpNode.fileClose();
|
return tmpNode.fileClose();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool etk::FSNodeEcho(const etk::UString& _path, const etk::UString& _dataTowrite) {
|
|
||||||
return FSNodeEcho(etk::toString(_path), etk::toString(_dataTowrite));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool etk::FSNodeEchoAdd(const etk::String& _path, const etk::String& _dataTowrite) {
|
bool etk::FSNodeEchoAdd(const etk::String& _path, const etk::String& _dataTowrite) {
|
||||||
etk::FSNode tmpNode(_path);
|
etk::FSNode tmpNode(_path);
|
||||||
@ -2596,11 +2367,6 @@ bool etk::FSNodeEchoAdd(const etk::String& _path, const etk::String& _dataTowrit
|
|||||||
}
|
}
|
||||||
return tmpNode.fileClose();
|
return tmpNode.fileClose();
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool etk::FSNodeEchoAdd(const etk::UString& _path, const etk::UString& _dataTowrite) {
|
|
||||||
return FSNodeEchoAdd(etk::toString(_path), etk::toString(_dataTowrite));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void etk::FSNodeHistory(const etk::String& _path, int32_t _historyCount) {
|
void etk::FSNodeHistory(const etk::String& _path, int32_t _historyCount) {
|
||||||
// step 1 : Move the file to prevent writing error
|
// step 1 : Move the file to prevent writing error
|
||||||
@ -2614,11 +2380,6 @@ void etk::FSNodeHistory(const etk::String& _path, int32_t _historyCount) {
|
|||||||
etk::FSNodeMove(_path, _path + "-1");
|
etk::FSNodeMove(_path, _path + "-1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
void etk::FSNodeHistory(const etk::UString& _path, int32_t _historyCount) {
|
|
||||||
return FSNodeHistory(etk::toString(_path), _historyCount);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
etk::String etk::FSNodeReadAllData(const etk::String& _path) {
|
etk::String etk::FSNodeReadAllData(const etk::String& _path) {
|
||||||
etk::String output;
|
etk::String output;
|
||||||
|
@ -196,9 +196,6 @@ namespace etk {
|
|||||||
* @param[in] _path Path of the curent file /folder ...
|
* @param[in] _path Path of the curent file /folder ...
|
||||||
*/
|
*/
|
||||||
FSNode(const etk::String& _path = "~");
|
FSNode(const etk::String& _path = "~");
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
FSNode(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @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
|
||||||
@ -218,9 +215,6 @@ namespace etk {
|
|||||||
* @param[in] _newName Name of the Node
|
* @param[in] _newName Name of the Node
|
||||||
*/
|
*/
|
||||||
void privateSetName(etk::String _newName);
|
void privateSetName(etk::String _newName);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
void privateSetName(const etk::UString& _newName);
|
|
||||||
#endif
|
|
||||||
private:
|
private:
|
||||||
#ifdef HAVE_ZIP_DATA
|
#ifdef HAVE_ZIP_DATA
|
||||||
/**
|
/**
|
||||||
@ -269,52 +263,34 @@ namespace etk {
|
|||||||
* @return false action not done
|
* @return false action not done
|
||||||
*/
|
*/
|
||||||
void setName(const etk::String& _newName);
|
void setName(const etk::String& _newName);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
void setName(const etk::UString& _newName);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the Generate FileSystem name
|
* @brief Get the Generate FileSystem name
|
||||||
* @return the requested filename
|
* @return the requested filename
|
||||||
*/
|
*/
|
||||||
etk::String getFileSystemName() const;
|
etk::String getFileSystemName() const;
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString getUFileSystemName() const;
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @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 //
|
||||||
*/
|
*/
|
||||||
etk::String getNameFolder() const;
|
etk::String getNameFolder() const;
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString getUNameFolder() const;
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @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 //
|
||||||
*/
|
*/
|
||||||
etk::String getName() const;
|
etk::String getName() const;
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString getUName() const;
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @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)
|
||||||
*/
|
*/
|
||||||
etk::String getNameFile() const;
|
etk::String getNameFile() const;
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString getUNameFile() const;
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @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 //
|
||||||
*/
|
*/
|
||||||
etk::String getRelativeFolder() const;
|
etk::String getRelativeFolder() const;
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString getURelativeFolder() const;
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @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
|
||||||
@ -328,9 +304,6 @@ namespace etk {
|
|||||||
* @return false : action not done
|
* @return false : action not done
|
||||||
*/
|
*/
|
||||||
bool move(const etk::String& _path);
|
bool move(const etk::String& _path);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool move(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the node type (DATA/DIRECT...)
|
* @brief Get the node type (DATA/DIRECT...)
|
||||||
* @return the requested type
|
* @return the requested type
|
||||||
@ -354,9 +327,6 @@ namespace etk {
|
|||||||
* @return The time requested (in string)
|
* @return The time requested (in string)
|
||||||
*/
|
*/
|
||||||
etk::String timeCreatedString() const;
|
etk::String timeCreatedString() const;
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString timeUCreatedString() const;
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the modifying time of the File
|
* @brief Get the modifying time of the File
|
||||||
* @return The time requested
|
* @return The time requested
|
||||||
@ -367,9 +337,6 @@ namespace etk {
|
|||||||
* @return The time requested (in string)
|
* @return The time requested (in string)
|
||||||
*/
|
*/
|
||||||
etk::String timeModifiedString() const;
|
etk::String timeModifiedString() const;
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString timeUModifiedString() const;
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the Accessed time of the File
|
* @brief Get the Accessed time of the File
|
||||||
* @return The time requested
|
* @return The time requested
|
||||||
@ -380,9 +347,6 @@ namespace etk {
|
|||||||
* @return The time requested (in string)
|
* @return The time requested (in string)
|
||||||
*/
|
*/
|
||||||
etk::String timeAccessedString() const;
|
etk::String timeAccessedString() const;
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString timeUAccessedString() const;
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief copy the other FSnode ==> for vector
|
* @brief copy the other FSnode ==> for vector
|
||||||
* @param[in] _obj input node
|
* @param[in] _obj input node
|
||||||
@ -458,9 +422,6 @@ namespace etk {
|
|||||||
* @param[in] _recursiveEnable Activate the recursive mode (enable by default)
|
* @param[in] _recursiveEnable Activate the recursive mode (enable by default)
|
||||||
*/
|
*/
|
||||||
void folderGetRecursiveFiles(etk::Vector<etk::String>& _output, bool _recursiveEnable=true);
|
void folderGetRecursiveFiles(etk::Vector<etk::String>& _output, bool _recursiveEnable=true);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
void folderGetRecursiveFiles(etk::Vector<etk::UString>& _output, bool _recursiveEnable=true);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if the file have an extention ( ***.ccc)
|
* @brief Check if the file have an extention ( ***.ccc)
|
||||||
* @return true The file have an extention.
|
* @return true The file have an extention.
|
||||||
@ -472,9 +433,6 @@ namespace etk {
|
|||||||
* @return the requested extention
|
* @return the requested extention
|
||||||
*/
|
*/
|
||||||
etk::String fileGetExtention();
|
etk::String fileGetExtention();
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString fileUGetExtention();
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the File size
|
* @brief Get the File size
|
||||||
* @return the requested size
|
* @return the requested size
|
||||||
@ -616,11 +574,6 @@ namespace etk {
|
|||||||
fileRead(&value[0], sizeof(char), fileSize()/sizeof(char));
|
fileRead(&value[0], sizeof(char), fileSize()/sizeof(char));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString fileReadAllU32String() {
|
|
||||||
return utf8::convertUnicode(fileReadAllString());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Write all the vector in a file
|
* @brief Write all the vector in a file
|
||||||
* @param[in] _value Data to write in the File
|
* @param[in] _value Data to write in the File
|
||||||
@ -636,11 +589,6 @@ namespace etk {
|
|||||||
void fileWriteAll(const etk::String& _value) {
|
void fileWriteAll(const etk::String& _value) {
|
||||||
fileWrite(static_cast<const void*>(&(_value[0])), sizeof(char), _value.size()/sizeof(char));
|
fileWrite(static_cast<const void*>(&(_value[0])), sizeof(char), _value.size()/sizeof(char));
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
void fileWriteAll(const etk::UString& _value) {
|
|
||||||
fileWriteAll(u32char::convertToUtf8(_value));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
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
|
||||||
@ -677,17 +625,11 @@ namespace etk {
|
|||||||
* @return the home folder : like : "/home/machin/"
|
* @return the home folder : like : "/home/machin/"
|
||||||
*/
|
*/
|
||||||
etk::String getUserHomeFolder();
|
etk::String getUserHomeFolder();
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString getUUserHomeFolder();
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @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)
|
||||||
*/
|
*/
|
||||||
etk::String getUserRunFolder();
|
etk::String getUserRunFolder();
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString getUUserRunFolder();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace theme {
|
namespace theme {
|
||||||
// TODO : Add an INIT ...
|
// TODO : Add an INIT ...
|
||||||
@ -697,49 +639,29 @@ namespace etk {
|
|||||||
* @param[in] _folderName The associated folder of the Theme (like "myTheme/folder/folder2/")
|
* @param[in] _folderName The associated folder of the Theme (like "myTheme/folder/folder2/")
|
||||||
*/
|
*/
|
||||||
void setName(const etk::String& _refName, const etk::String& _folderName);
|
void setName(const etk::String& _refName, const etk::String& _folderName);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
//! @previous
|
|
||||||
void setName(const etk::UString& _refName, const etk::UString& _folderName);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief get the folder from a Reference theme
|
* @brief get the folder from a Reference theme
|
||||||
* @param[in] _refName Theme cathegorie ex : "GUI" "SHADER" "DEFAULT"
|
* @param[in] _refName Theme cathegorie ex : "GUI" "SHADER" "DEFAULT"
|
||||||
* @return the path of the theme
|
* @return the path of the theme
|
||||||
*/
|
*/
|
||||||
etk::String getName(const etk::String& _refName);
|
etk::String getName(const etk::String& _refName);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
//! @previous
|
|
||||||
etk::UString getName(const etk::UString& _refName);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the default folder of a subset of a theme ...
|
* @brief Set the default folder of a subset of a theme ...
|
||||||
* @param[in] _refName Theme cathegorie ex : "GUI" "SHADER" "DEFAULT"
|
* @param[in] _refName Theme cathegorie ex : "GUI" "SHADER" "DEFAULT"
|
||||||
* @param[in] _folderName The associated default folder of the Theme (like "myTheme/color/default/")
|
* @param[in] _folderName The associated default folder of the Theme (like "myTheme/color/default/")
|
||||||
*/
|
*/
|
||||||
void setNameDefault(const etk::String& _refName, const etk::String& _folderName);
|
void setNameDefault(const etk::String& _refName, const etk::String& _folderName);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
//! @previous
|
|
||||||
void setNameDefault(const etk::UString& _refName, const etk::UString& _folderName);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief get the default folder from a Reference theme
|
* @brief get the default folder from a Reference theme
|
||||||
* @param[in] _refName Theme cathegorie ex : "GUI" "SHADER" "DEFAULT"
|
* @param[in] _refName Theme cathegorie ex : "GUI" "SHADER" "DEFAULT"
|
||||||
* @return the path of the theme
|
* @return the path of the theme
|
||||||
*/
|
*/
|
||||||
etk::String getNameDefault(const etk::String& _refName);
|
etk::String getNameDefault(const etk::String& _refName);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
//! @previous
|
|
||||||
etk::UString getNameDefault(const etk::UString& _refName);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
etk::Vector<etk::String> list();
|
etk::Vector<etk::String> list();
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
//! @previous
|
|
||||||
etk::Vector<etk::UString> listU();
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Get the size of a specific file
|
* @brief Get the size of a specific file
|
||||||
@ -747,9 +669,6 @@ namespace etk {
|
|||||||
* @return size of the file
|
* @return size of the file
|
||||||
*/
|
*/
|
||||||
uint64_t FSNodeGetSize(const etk::String& _path);
|
uint64_t FSNodeGetSize(const etk::String& _path);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
uint64_t FSNodeGetSize(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Remove folder and subFolder, files pipes ...
|
* @brief Simple access for : Remove folder and subFolder, files pipes ...
|
||||||
@ -758,9 +677,6 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
bool FSNodeRemove(const etk::String& _path);
|
bool FSNodeRemove(const etk::String& _path);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool FSNodeRemove(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : count the number of element in a path (if it is not a path ==> return -1)
|
* @brief Simple access for : count the number of element in a path (if it is not a path ==> return -1)
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
@ -768,9 +684,6 @@ namespace etk {
|
|||||||
* @return -1 : An error occured
|
* @return -1 : An error occured
|
||||||
*/
|
*/
|
||||||
int64_t FSNodeGetCount(const etk::String& _path);
|
int64_t FSNodeGetCount(const etk::String& _path);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
int64_t FSNodeGetCount(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Create a file or a folder depending of the request
|
* @brief Simple access for : Create a file or a folder depending of the request
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
@ -780,9 +693,6 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
bool FSNodeCreate(const etk::String& _path, etk::FSNodeRight _right, enum etk::typeNode _type=etk::typeNode_folder);
|
bool FSNodeCreate(const etk::String& _path, etk::FSNodeRight _right, enum etk::typeNode _type=etk::typeNode_folder);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool FSNodeCreate(const etk::UString& _path, etk::FSNodeRight _right, enum etk::typeNode _type=etk::typeNode_folder);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : chexk the exestance of an element
|
* @brief Simple access for : chexk the exestance of an element
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
@ -790,9 +700,6 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
bool FSNodeExist(const etk::String& _path);
|
bool FSNodeExist(const etk::String& _path);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool FSNodeExist(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : chexk the exestance of an element
|
* @brief Simple access for : chexk the exestance of an element
|
||||||
* @param[in] _path1 Folder/File/Pipe path of the node sources
|
* @param[in] _path1 Folder/File/Pipe path of the node sources
|
||||||
@ -801,9 +708,6 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
bool FSNodeMove(const etk::String& _path1, const etk::String& _path2);
|
bool FSNodeMove(const etk::String& _path1, const etk::String& _path2);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool FSNodeMove(const etk::UString& _path1, const etk::UString& _path2);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Get right of the current Node
|
* @brief Simple access for : Get right of the current Node
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
@ -811,9 +715,6 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
etk::FSNodeRight FSNodeGetRight(const etk::String& _path);
|
etk::FSNodeRight FSNodeGetRight(const etk::String& _path);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::FSNodeRight FSNodeGetRight(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Get type of the current node
|
* @brief Simple access for : Get type of the current node
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
@ -821,9 +722,6 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
enum etk::typeNode FSNodeGetType(const etk::String& _path);
|
enum etk::typeNode FSNodeGetType(const etk::String& _path);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
enum etk::typeNode FSNodeGetType(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Getting creation time of the current node
|
* @brief Simple access for : Getting creation time of the current node
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
@ -831,9 +729,6 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
uint64_t FSNodeGetTimeCreated(const etk::String& _path);
|
uint64_t FSNodeGetTimeCreated(const etk::String& _path);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
uint64_t FSNodeGetTimeCreated(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Getting Modification time of the current node
|
* @brief Simple access for : Getting Modification time of the current node
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
@ -841,9 +736,6 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
uint64_t FSNodeGetTimeModified(const etk::String& _path);
|
uint64_t FSNodeGetTimeModified(const etk::String& _path);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
uint64_t FSNodeGetTimeModified(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Getting Accessing time of the current node
|
* @brief Simple access for : Getting Accessing time of the current node
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
@ -851,9 +743,6 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
uint64_t FSNodeGetTimeAccessed(const etk::String& _path);
|
uint64_t FSNodeGetTimeAccessed(const etk::String& _path);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
uint64_t FSNodeGetTimeAccessed(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Update Modification time with the current time of the node (>)
|
* @brief Simple access for : Update Modification time with the current time of the node (>)
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
@ -861,9 +750,6 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
bool FSNodeTouch(const etk::String& _path);
|
bool FSNodeTouch(const etk::String& _path);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool FSNodeTouch(const etk::UString& _path);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Basic write on the node (like console echo)
|
* @brief Simple access for : Basic write on the node (like console echo)
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
@ -872,9 +758,6 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
bool FSNodeEcho(const etk::String& _path, const etk::String& _dataTowrite);
|
bool FSNodeEcho(const etk::String& _path, const etk::String& _dataTowrite);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool FSNodeEcho(const etk::UString& _path, const etk::UString& _dataTowrite);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Basic write on the node (like console echo) in adding mode (>>)
|
* @brief Simple access for : Basic write on the node (like console echo) in adding mode (>>)
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
@ -883,18 +766,12 @@ namespace etk {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
bool FSNodeEchoAdd(const etk::String& _path, const etk::String& _dataTowrite);
|
bool FSNodeEchoAdd(const etk::String& _path, const etk::String& _dataTowrite);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
bool FSNodeEchoAdd(const etk::UString& _path, const etk::UString& _dataTowrite);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief move file to generate an history of the current file
|
* @brief move file to generate an history of the current file
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
* @param[in] _historyCount number of saved file in the history (-xxx)
|
* @param[in] _historyCount number of saved file in the history (-xxx)
|
||||||
*/
|
*/
|
||||||
void FSNodeHistory(const etk::String& _path, int32_t _historyCount);
|
void FSNodeHistory(const etk::String& _path, int32_t _historyCount);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
void FSNodeHistory(const etk::UString& _path, int32_t _historyCount);
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Read all the data from a file
|
* @brief Read all the data from a file
|
||||||
* @param[in] _path Folder/File/Pipe path of the node
|
* @param[in] _path Folder/File/Pipe path of the node
|
||||||
|
@ -147,11 +147,6 @@ void etk::FSNodeRight::setOtherRunable(bool _newStatus) {
|
|||||||
m_rights |= right_other_execute;
|
m_rights |= right_other_execute;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
etk::UString etk::FSNodeRight::getURight() const {
|
|
||||||
return etk::toUString(getRight());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
etk::String etk::FSNodeRight::getRight() const {
|
etk::String etk::FSNodeRight::getRight() const {
|
||||||
etk::String tmp;
|
etk::String tmp;
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <etk/String.hpp>
|
#include <etk/String.hpp>
|
||||||
#include <etk/UString.hpp>
|
|
||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
/**
|
/**
|
||||||
@ -139,13 +138,6 @@ namespace etk {
|
|||||||
* @param[in] _newStatus New value to set on the file/folder/...
|
* @param[in] _newStatus New value to set on the file/folder/...
|
||||||
*/
|
*/
|
||||||
void setOtherRunable(bool _newStatus);
|
void setOtherRunable(bool _newStatus);
|
||||||
#if __CPP_VERSION__ >= 2011
|
|
||||||
/**
|
|
||||||
* @brief Get the write written in a string mode (like in linux rw-r-----)
|
|
||||||
* @return String with the right in string
|
|
||||||
*/
|
|
||||||
etk::UString getURight() const;
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the write written in a string mode (like in linux rw-r-----)
|
* @brief Get the write written in a string mode (like in linux rw-r-----)
|
||||||
* @return String with the right in string
|
* @return String with the right in string
|
||||||
|
@ -97,30 +97,7 @@ namespace etk {
|
|||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class ETK_MOVE_TYPE>
|
|
||||||
struct _Remove_reference {
|
|
||||||
// remove reference
|
|
||||||
typedef ETK_MOVE_TYPE m_type;
|
|
||||||
};
|
|
||||||
template<class ETK_MOVE_TYPE>
|
|
||||||
struct _Remove_reference<ETK_MOVE_TYPE&> {
|
|
||||||
// remove reference
|
|
||||||
typedef ETK_MOVE_TYPE m_type;
|
|
||||||
};
|
|
||||||
template<class ETK_MOVE_TYPE>
|
|
||||||
struct _Remove_reference<ETK_MOVE_TYPE&&> {
|
|
||||||
// remove rvalue reference
|
|
||||||
typedef ETK_MOVE_TYPE m_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class ETK_MOVE_TYPE> inline
|
|
||||||
typename etk::_Remove_reference<ETK_MOVE_TYPE>::m_type&& move(ETK_MOVE_TYPE&& _obj) {
|
|
||||||
// forward _Arg as movable
|
|
||||||
return ((typename etk::_Remove_reference<ETK_MOVE_TYPE>::m_type&&)_obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#include <etk/move.hpp>
|
||||||
#include <etk/Stream.hpp>
|
#include <etk/Stream.hpp>
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ etk::String u32char::convertToUtf8(const etk::UString& _input) {
|
|||||||
|
|
||||||
size_t u32char::strlen(const char32_t* _input) {
|
size_t u32char::strlen(const char32_t* _input) {
|
||||||
uint32_t out = 0;
|
uint32_t out = 0;
|
||||||
while (_input != 0) {
|
while (*_input != 0) {
|
||||||
out++;
|
out++;
|
||||||
_input++;
|
_input++;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ def configure(target, my_module):
|
|||||||
'etk/types.hpp',
|
'etk/types.hpp',
|
||||||
'etk/stdTools.hpp',
|
'etk/stdTools.hpp',
|
||||||
'etk/Buffer.hpp',
|
'etk/Buffer.hpp',
|
||||||
'etk/Hash.hpp',
|
|
||||||
'etk/String.hpp',
|
'etk/String.hpp',
|
||||||
'etk/UString.hpp',
|
'etk/UString.hpp',
|
||||||
'etk/utf8.hpp',
|
'etk/utf8.hpp',
|
||||||
@ -47,6 +46,7 @@ def configure(target, my_module):
|
|||||||
'etk/Stream.hpp',
|
'etk/Stream.hpp',
|
||||||
'etk/Pair.hpp',
|
'etk/Pair.hpp',
|
||||||
'etk/Map.hpp',
|
'etk/Map.hpp',
|
||||||
|
'etk/move.hpp',
|
||||||
])
|
])
|
||||||
|
|
||||||
# build in C++ mode
|
# build in C++ mode
|
||||||
|
@ -8,17 +8,17 @@
|
|||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include <etk/Hash.hpp>
|
#include <etk/Map.hpp>
|
||||||
#include <test-debug/debug.hpp>
|
#include <test-debug/debug.hpp>
|
||||||
#define NAME "Hash"
|
#define NAME "MAP_unorderer"
|
||||||
|
|
||||||
TEST(TestEtkHash, Creation) {
|
TEST(TestEtkMap_unordered, Creation) {
|
||||||
etk::Hash<etk::String> testData;
|
etk::Map<etk::String, etk::String> testData(0,false);
|
||||||
EXPECT_EQ(testData.size(), 0);
|
EXPECT_EQ(testData.size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestEtkHash, AddElement) {
|
TEST(TestEtkMap_unordered, AddElement) {
|
||||||
etk::Hash<etk::String> testData;
|
etk::Map<etk::String, etk::String> testData(0,false);
|
||||||
testData.add("TEST", "testData");
|
testData.add("TEST", "testData");
|
||||||
testData.add("TEST2", "22222222222222222");
|
testData.add("TEST2", "22222222222222222");
|
||||||
testData.add("TEST4", "4444444444444444444");
|
testData.add("TEST4", "4444444444444444444");
|
||||||
@ -30,8 +30,8 @@ TEST(TestEtkHash, AddElement) {
|
|||||||
EXPECT_EQ(testData["TEST3"], "3333333333");
|
EXPECT_EQ(testData["TEST3"], "3333333333");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestEtkHash, OverWriteElement) {
|
TEST(TestEtkMap_unordered, OverWriteElement) {
|
||||||
etk::Hash<etk::String> testData;
|
etk::Map<etk::String, etk::String> testData(0,false);
|
||||||
testData.add("TEST", "testData");
|
testData.add("TEST", "testData");
|
||||||
testData.add("TEST2", "22222222222222222");
|
testData.add("TEST2", "22222222222222222");
|
||||||
testData.add("TEST4", "4444444444444444444");
|
testData.add("TEST4", "4444444444444444444");
|
||||||
@ -44,8 +44,8 @@ TEST(TestEtkHash, OverWriteElement) {
|
|||||||
EXPECT_EQ(testData["TEST"], "testData22");
|
EXPECT_EQ(testData["TEST"], "testData22");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestEtkHash, RemoveElement) {
|
TEST(TestEtkMap_unordered, RemoveElement) {
|
||||||
etk::Hash<etk::String> testData;
|
etk::Map<etk::String, etk::String> testData(0,false);
|
||||||
testData.add("TEST", "testData");
|
testData.add("TEST", "testData");
|
||||||
testData.add("TEST2", "22222222222222222");
|
testData.add("TEST2", "22222222222222222");
|
||||||
testData.add("TEST4", "4444444444444444444");
|
testData.add("TEST4", "4444444444444444444");
|
||||||
@ -53,20 +53,20 @@ TEST(TestEtkHash, RemoveElement) {
|
|||||||
testData.add("TEST1", "11111111111");
|
testData.add("TEST1", "11111111111");
|
||||||
testData.add("TEST55", "555555555555555((((5555");
|
testData.add("TEST55", "555555555555555((((5555");
|
||||||
EXPECT_EQ(testData.size(), 6);
|
EXPECT_EQ(testData.size(), 6);
|
||||||
testData.remove("TEST1");
|
testData.erase("TEST1");
|
||||||
EXPECT_EQ(testData.size(), 5);
|
EXPECT_EQ(testData.size(), 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestEtkHash, ExistElement) {
|
TEST(TestEtkMap_unordered, ExistElement) {
|
||||||
etk::Hash<etk::String> testData;
|
etk::Map<etk::String, etk::String> testData(0,false);
|
||||||
testData.add("TEST", "testData");
|
testData.add("TEST", "testData");
|
||||||
testData.add("TEST2", "22222222222222222");
|
testData.add("TEST2", "22222222222222222");
|
||||||
EXPECT_EQ(testData.exist("TEST"), true);
|
EXPECT_EQ(testData.exist("TEST"), true);
|
||||||
EXPECT_EQ(testData.exist("Tlskdfjgmsqlkdfjgmlqskdfg"), false);
|
EXPECT_EQ(testData.exist("Tlskdfjgmsqlkdfjgmlqskdfg"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestEtkHash, clear) {
|
TEST(TestEtkMap_unordered, clear) {
|
||||||
etk::Hash<etk::String> testData;
|
etk::Map<etk::String, etk::String> testData(0,false);
|
||||||
testData.add("TEST", "1");
|
testData.add("TEST", "1");
|
||||||
testData.add("TEST2", "2");
|
testData.add("TEST2", "2");
|
||||||
EXPECT_EQ(testData.size(), 2);
|
EXPECT_EQ(testData.size(), 2);
|
||||||
@ -74,16 +74,16 @@ TEST(TestEtkHash, clear) {
|
|||||||
EXPECT_EQ(testData.size(), 0);
|
EXPECT_EQ(testData.size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestEtkHash, getKey) {
|
TEST(TestEtkMap_unordered, getKey) {
|
||||||
etk::Hash<etk::String> testData;
|
etk::Map<etk::String, etk::String> testData(0,false);
|
||||||
testData.add("TEST", "1");
|
testData.add("TEST", "1");
|
||||||
testData.add("TEST2", "2");
|
testData.add("TEST2", "2");
|
||||||
testData.add("TEST3", "3");
|
testData.add("TEST3", "3");
|
||||||
EXPECT_EQ(testData.getKey(1), "TEST2");
|
EXPECT_EQ(testData.getKey(1), "TEST2");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestEtkHash, getKeys) {
|
TEST(TestEtkMap_unordered, getKeys) {
|
||||||
etk::Hash<etk::String> testData;
|
etk::Map<etk::String, etk::String> testData(0,false);
|
||||||
testData.add("TEST", "1");
|
testData.add("TEST", "1");
|
||||||
testData.add("TEST2", "2");
|
testData.add("TEST2", "2");
|
||||||
testData.add("TEST3", "3");
|
testData.add("TEST3", "3");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user