diff --git a/Sources/libetk/etk/RegExp.cpp b/Sources/libetk/etk/RegExp.cpp index bcf3ca0a..cfd699e0 100644 --- a/Sources/libetk/etk/RegExp.cpp +++ b/Sources/libetk/etk/RegExp.cpp @@ -88,10 +88,10 @@ const int32_t etk::constConvertionTableSize = sizeof(etk::constConvertionTable) * @return --- * */ -void etk::DisplayData(etk::VectorType &data) +void etk::DisplayData(std::vector &data) { int32_t i; - for (i=0; i<(int32_t)data.Size() ; i++) { + for (i=0; i<(int32_t)data.size() ; i++) { etk::cout<< (char)(data[i]&0x00FF ); } } @@ -106,11 +106,11 @@ void etk::DisplayData(etk::VectorType &data) * @return --- * */ -void etk::DisplayElem(etk::VectorType &data, int32_t start, int32_t stop) +void etk::DisplayElem(std::vector &data, int32_t start, int32_t stop) { int32_t i; etk::cout<< ETK_BASH_COLOR_NORMAL; - for (i=start; i<(int32_t)data.Size() && i &data, int32_t start, int32_t sto } } } -char * etk::levelSpace(int32_t level) + +static const char* tmpSpaceArray = " "; + +const char * etk::levelSpace(int32_t level) { - switch(level) - { - case 0: return (char*)""; - case 1: return (char*)" "; - case 2: return (char*)" "; - case 3: return (char*)" "; - case 4: return (char*)" "; - case 5: return (char*)" "; - case 6: return (char*)" "; - case 7: return (char*)" "; - case 8: return (char*)" "; - case 9: return (char*)" "; - case 10: return (char*)" "; - case 11: return (char*)" "; - case 12: return (char*)" "; - case 13: return (char*)" "; - case 14: return (char*)" "; - case 15: return (char*)" "; - case 16: return (char*)" "; - default: return (char*)" "; + int32_t len = strlen(tmpSpaceArray); + if (level*2 > len) { + return tmpSpaceArray; } + return tmpSpaceArray + len - level*2; } @@ -176,7 +163,7 @@ char * etk::levelSpace(int32_t level) * @return --- * */ -int32_t etk::GetLenOfPTheseElem(etk::VectorType &data, int32_t startPos) +int32_t etk::GetLenOfPTheseElem(std::vector &data, int32_t startPos) { int32_t pos = startPos; int32_t nbOpen = 0; @@ -186,7 +173,7 @@ int32_t etk::GetLenOfPTheseElem(etk::VectorType &data, int32_t startPos return 0; } // find size ... - while (pos < (int32_t)data.Size() ) { + while (pos < (int32_t)data.size() ) { if(REGEXP_OPCODE_PTHESE_IN == data[pos]) { // find a sub section : nbOpen++; @@ -225,7 +212,7 @@ int32_t etk::GetLenOfPTheseElem(etk::VectorType &data, int32_t startPos * @return --- * */ -int32_t etk::GetLenOfPThese(etk::VectorType &data, int32_t startPos) +int32_t etk::GetLenOfPThese(std::vector &data, int32_t startPos) { int32_t pos = startPos; int32_t nbOpen = 0; @@ -236,7 +223,7 @@ int32_t etk::GetLenOfPThese(etk::VectorType &data, int32_t startPos) { pos++; // find size ... - while (pos < (int32_t)data.Size() ) { + while (pos < (int32_t)data.size() ) { if(REGEXP_OPCODE_PTHESE_IN == data[pos]) { // find a sub section : nbOpen++; @@ -278,7 +265,7 @@ int32_t etk::GetLenOfPThese(etk::VectorType &data, int32_t startPos) * @return --- * */ -int32_t etk::GetLenOfBracket(etk::VectorType &data, int32_t startPos) +int32_t etk::GetLenOfBracket(std::vector &data, int32_t startPos) { int32_t pos = startPos; // special case of the (...) or | ==> we search '|' or ')' @@ -287,7 +274,7 @@ int32_t etk::GetLenOfBracket(etk::VectorType &data, int32_t startPos) } else if( REGEXP_OPCODE_BRACKET_IN == data[pos]) { pos++; // find size ... - while (pos < (int32_t)data.Size() ) { + while (pos < (int32_t)data.size() ) { if(REGEXP_OPCODE_BRACKET_OUT == data[pos]) { // Find the end of the [...] // just return the size inside @@ -322,7 +309,7 @@ int32_t etk::GetLenOfBracket(etk::VectorType &data, int32_t startPos) * @return --- * */ -int32_t etk::GetLenOfBrace(etk::VectorType &data, int32_t startPos) +int32_t etk::GetLenOfBrace(std::vector &data, int32_t startPos) { int32_t pos = startPos; // special case of the (...) or | ==> we search '|' or ')' @@ -331,7 +318,7 @@ int32_t etk::GetLenOfBrace(etk::VectorType &data, int32_t startPos) } else if( REGEXP_OPCODE_BRACE_IN == data[pos]) { pos++; // find size ... - while (pos < (int32_t)data.Size() ) { + while (pos < (int32_t)data.size() ) { if(REGEXP_OPCODE_BRACE_OUT == data[pos]) { // Find the end of the [...] // just return the size inside @@ -366,12 +353,12 @@ int32_t etk::GetLenOfBrace(etk::VectorType &data, int32_t startPos) * @return --- * */ -int32_t etk::GetLenOfNormal(etk::VectorType &data, int32_t startPos) +int32_t etk::GetLenOfNormal(std::vector &data, int32_t startPos) { int32_t pos = startPos; // find size ... - while (pos < (int32_t)data.Size() ) { + while (pos < (int32_t)data.size() ) { switch(data[pos]) { case REGEXP_OPCODE_PTHESE_IN: @@ -423,7 +410,7 @@ int32_t etk::GetLenOfNormal(etk::VectorType &data, int32_t startPos) * @return --- * */ -bool etk::ParseBrace(etk::VectorType &data, int32_t &min, int32_t &max) +bool etk::ParseBrace(std::vector &data, int32_t &min, int32_t &max) { //TK_INFO("parse {...} in "; DisplayElem(data); ); int32_t k=0; @@ -431,7 +418,7 @@ bool etk::ParseBrace(etk::VectorType &data, int32_t &min, int32_t &max) int32_t firstElement = 0; int32_t SecondElement = 0; - while(k &data, int32_t &min, int32_t &max) } k++; } - if (k==data.Size()) { + if (k==data.size()) { SecondElement = firstElement; } - while(k #include #include -#include +#include namespace etk { @@ -94,15 +94,15 @@ typedef struct { extern const convertionTable_ts constConvertionTable[]; extern const int32_t constConvertionTableSize; -void DisplayData(etk::VectorType &data); -void DisplayElem(etk::VectorType &data, int32_t start=0, int32_t stop=0x7FFFFFFF); -char * levelSpace(int32_t level); -int32_t GetLenOfPTheseElem(etk::VectorType &data, int32_t startPos); -int32_t GetLenOfPThese(etk::VectorType &data, int32_t startPos); -int32_t GetLenOfBracket(etk::VectorType &data, int32_t startPos); -int32_t GetLenOfBrace(etk::VectorType &data, int32_t startPos); -int32_t GetLenOfNormal(etk::VectorType &data, int32_t startPos); -bool ParseBrace(etk::VectorType &data, int32_t &min, int32_t &max); +void DisplayData(std::vector &data); +void DisplayElem(std::vector &data, int32_t start=0, int32_t stop=0x7FFFFFFF); +const char * levelSpace(int32_t level); +int32_t GetLenOfPTheseElem(std::vector &data, int32_t startPos); +int32_t GetLenOfPThese(std::vector &data, int32_t startPos); +int32_t GetLenOfBracket(std::vector &data, int32_t startPos); +int32_t GetLenOfBrace(std::vector &data, int32_t startPos); +int32_t GetLenOfNormal(std::vector &data, int32_t startPos); +bool ParseBrace(std::vector &data, int32_t &min, int32_t &max); #undef __class__ @@ -139,7 +139,7 @@ template class RegExpNode{ * @param[in,out] * @return */ - virtual int32_t Generate(etk::VectorType &data) + virtual int32_t Generate(std::vector &data) { return 0; }; @@ -199,7 +199,7 @@ template class RegExpNode{ int32_t m_multipleMin; //!< minimum repetition (included) int32_t m_multipleMax; //!< maximum repetition (included) // Data Section ... (can have no data...) - etk::VectorType m_RegExpData; //!< data to parse and compare in some case ... + std::vector m_RegExpData; //!< data to parse and compare in some case ... }; #undef __class__ @@ -233,15 +233,15 @@ template class RegExpNodeValue : public RegExpNode * @param[in,out] * @return */ - int32_t Generate(etk::VectorType &data) + int32_t Generate(std::vector &data) { RegExpNode::m_RegExpData = data; //TK_DEBUG("Request Parse \"Value\" data="; DisplayElem(RegExpNode::m_RegExpData);); - m_data.Clear(); - for (int32_t i=0; i::m_RegExpData.Size(); i++) { - m_data.PushBack((char)RegExpNode::m_RegExpData[i]); + m_data.clear(); + for (int32_t i=0; i::m_RegExpData.size(); i++) { + m_data.push_back((char)RegExpNode::m_RegExpData[i]); } - return data.Size(); + return data.size(); }; /** @@ -253,7 +253,7 @@ template class RegExpNodeValue : public RegExpNode { findLen = 0; //TK_INFO("Parse node : Value{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); - if (0==m_data.Size()) { + if (0==m_data.size()) { TK_ERROR("No data inside type elemTypeValue"); return false; } @@ -263,14 +263,14 @@ template class RegExpNodeValue : public RegExpNode for (j=0; j::m_multipleMax && tmpFind == true; j++) { int32_t ofset = 0; int32_t k; - for (k=0; findLen+k class RegExpNodeValue : public RegExpNode }; protected : // SubNodes : - etk::VectorType m_data; + std::vector m_data; }; #undef __class__ #define __class__ "etk::RegExpNodeBracket" @@ -336,38 +336,38 @@ template class RegExpNodeBracket : public RegExpNode &data) + int32_t Generate(std::vector &data) { RegExpNode::m_RegExpData = data; //TK_DEBUG("Request Parse [...] data="; DisplayElem(RegExpNode::m_RegExpData);); - m_data.Clear(); + m_data.clear(); char lastElement = 'a'; bool multipleElement = false; // - for (int32_t k=0; k::m_RegExpData.Size(); k++) { + for (int32_t k=0; k::m_RegExpData.size(); k++) { if (RegExpNode::m_RegExpData[k] == REGEXP_OPCODE_TO && multipleElement == true) { TK_ERROR("Can not have 2 consecutive - in [...]"); return 0; } else if (multipleElement == true) { char j='\0'; for (j=lastElement+1; j <= (char)RegExpNode::m_RegExpData[k]; j++) { - m_data.PushBack(j); + m_data.push_back(j); } multipleElement = false; } else if(RegExpNode::m_RegExpData[k] == REGEXP_OPCODE_TO) { multipleElement = true; } else { lastElement = (char)RegExpNode::m_RegExpData[k]; - m_data.PushBack(lastElement); + m_data.push_back(lastElement); } } // check size ... - if (m_data.Size() == 0) { + if (m_data.size() == 0) { TK_ERROR("No data inside [...] "); return 0; } - return data.Size(); + return data.size(); }; /** @@ -379,7 +379,7 @@ template class RegExpNodeBracket : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); - if (0==m_data.Size()) { + if (0==m_data.size()) { TK_ERROR("No data inside type elemTypeValue"); return false; } @@ -389,7 +389,7 @@ template class RegExpNodeBracket : public RegExpNode::m_multipleMax && tmpFind ==true && j < lenMax; j++) { int32_t i; tmpFind=false; - for (i=0; i class RegExpNodeBracket : public RegExpNode m_data; + std::vector m_data; }; #undef __class__ #define __class__ "etk::RegExpNodeDigit" @@ -1211,28 +1211,28 @@ template class RegExpNodePTheseElem : public RegExpNode &data) + int32_t Generate(std::vector &data) { RegExpNode::m_RegExpData = data; //TK_DEBUG("Request Parse (elem) data="; DisplayElem(RegExpNode::m_RegExpData);); int32_t pos = 0; int32_t elementSize = 0; - etk::VectorType tmpData; - while (pos < RegExpNode::m_RegExpData.Size()) { - tmpData.Clear(); + std::vector tmpData; + while (pos < RegExpNode::m_RegExpData.size()) { + tmpData.clear(); switch (RegExpNode::m_RegExpData[pos]) { case REGEXP_OPCODE_PTHESE_IN: { elementSize=GetLenOfPThese(RegExpNode::m_RegExpData, pos); for (int32_t k=pos+1; k::m_RegExpData[k]); + tmpData.push_back(RegExpNode::m_RegExpData[k]); } RegExpNodePThese * myElem = new RegExpNodePThese(); (void)myElem->Generate(tmpData); // add to the subnode list : - m_subNode.PushBack(myElem); + m_subNode.push_back(myElem); // move current position ... pos += elementSize+1; } @@ -1245,12 +1245,12 @@ template class RegExpNodePTheseElem : public RegExpNode::m_RegExpData, pos); for (int32_t k=pos+1; k::m_RegExpData[k]); + tmpData.push_back(RegExpNode::m_RegExpData[k]); } RegExpNodeBracket * myElem = new RegExpNodeBracket(); (void)myElem->Generate(tmpData); // add to the subnode list : - m_subNode.PushBack(myElem); + m_subNode.push_back(myElem); // move current position ... pos += elementSize+1; } @@ -1263,7 +1263,7 @@ template class RegExpNodePTheseElem : public RegExpNode::m_RegExpData, pos); for (int32_t k=pos+1; k::m_RegExpData[k]); + tmpData.push_back(RegExpNode::m_RegExpData[k]); } int32_t min = 0; int32_t max = 0; @@ -1299,59 +1299,59 @@ template class RegExpNodePTheseElem : public RegExpNode()); + m_subNode.push_back(new RegExpNodeDot()); break; case REGEXP_OPCODE_START_OF_LINE: - m_subNode.PushBack(new RegExpNodeSOL()); + m_subNode.push_back(new RegExpNodeSOL()); break; case REGEXP_OPCODE_END_OF_LINE: - m_subNode.PushBack(new RegExpNodeEOL()); + m_subNode.push_back(new RegExpNodeEOL()); break; case REGEXP_OPCODE_DIGIT: - m_subNode.PushBack(new RegExpNodeDigit()); + m_subNode.push_back(new RegExpNodeDigit()); break; case REGEXP_OPCODE_DIGIT_NOT: - m_subNode.PushBack(new RegExpNodeDigitNot()); + m_subNode.push_back(new RegExpNodeDigitNot()); break; case REGEXP_OPCODE_LETTER: - m_subNode.PushBack(new RegExpNodeLetter()); + m_subNode.push_back(new RegExpNodeLetter()); break; case REGEXP_OPCODE_LETTER_NOT: - m_subNode.PushBack(new RegExpNodeLetterNot()); + m_subNode.push_back(new RegExpNodeLetterNot()); break; case REGEXP_OPCODE_SPACE: - m_subNode.PushBack(new RegExpNodeWhiteSpace()); + m_subNode.push_back(new RegExpNodeWhiteSpace()); break; case REGEXP_OPCODE_SPACE_NOT: - m_subNode.PushBack(new RegExpNodeWhiteSpaceNot()); + m_subNode.push_back(new RegExpNodeWhiteSpaceNot()); break; case REGEXP_OPCODE_WORD: - m_subNode.PushBack(new RegExpNodeWordChar()); + m_subNode.push_back(new RegExpNodeWordChar()); break; case REGEXP_OPCODE_WORD_NOT: - m_subNode.PushBack(new RegExpNodeWordCharNot()); + m_subNode.push_back(new RegExpNodeWordCharNot()); break; default: { elementSize=GetLenOfNormal(RegExpNode::m_RegExpData, pos); for (int32_t k=pos; k::m_RegExpData[k]); + tmpData.push_back(RegExpNode::m_RegExpData[k]); } RegExpNodeValue * myElem = new RegExpNodeValue(); (void)myElem->Generate(tmpData); // add to the subnode list : - m_subNode.PushBack(myElem); + m_subNode.push_back(myElem); // move current position ... pos += elementSize-1; } @@ -1359,7 +1359,7 @@ template class RegExpNodePTheseElem : public RegExpNode class RegExpNodePTheseElem : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); // NOTE 1 : Must done only one time in EVERY case ... // NOTE 2 : All element inside must be OK - if (0 == m_subNode.Size()) { + if (0 == m_subNode.size()) { return false; } int32_t tmpCurrentPos = currentPos; - for (int32_t i=0; iParse(data, tmpCurrentPos, lenMax, tmpFindLen)) { findLen = 0; @@ -1398,13 +1398,13 @@ template class RegExpNodePTheseElem : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "} subdata="; DisplayElem(RegExpNode::m_RegExpData);); - for(int32_t i=0; iDisplay(level+1); } }; protected : // SubNodes : - etk::VectorType*> m_subNode; + std::vector*> m_subNode; private : /** * @brief Set the number of repeate time on a the last node in the list ... @@ -1417,11 +1417,11 @@ template class RegExpNodePTheseElem : public RegExpNode * myNode = m_subNode[m_subNode.Size()-1]; + RegExpNode * myNode = m_subNode[m_subNode.size()-1]; if (NULL==myNode) { TK_ERROR("INTERNAL error ==> node not generated"); return false; @@ -1461,7 +1461,7 @@ template class RegExpNodePThese : public RegExpNode &data) + int32_t Generate(std::vector &data) { RegExpNode::m_RegExpData = data; //TK_DEBUG("Request Parse (...) data="; DisplayElem(RegExpNode::m_RegExpData);); @@ -1471,14 +1471,14 @@ template class RegExpNodePThese : public RegExpNode0) { // geerate output deta ... - etk::VectorType tmpData; + std::vector tmpData; for (int32_t k=pos; k::m_RegExpData[k]); + tmpData.push_back(RegExpNode::m_RegExpData[k]); } RegExpNodePTheseElem * myElem = new RegExpNodePTheseElem(); (void)myElem->Generate(tmpData); // add to the subnode list : - m_subNode.PushBack(myElem); + m_subNode.push_back(myElem); pos += elementSize+1; //TK_DEBUG("plop="; DisplayElem(data, pos, pos+1);); elementSize = GetLenOfPTheseElem(RegExpNode::m_RegExpData, pos); @@ -1488,7 +1488,7 @@ template class RegExpNodePThese : public RegExpNode class RegExpNodePThese : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); - if (0 == m_subNode.Size()) { + if (0 == m_subNode.size()) { return false; } bool tmpFind = true; int32_t j; for (j=0; j::m_multipleMax && tmpFind == true ; j++) { tmpFind = false; - for (int32_t i=0; iParse(data, currentPos+findLen, lenMax, tmpFindLen)) { findLen += tmpFindLen; @@ -1539,7 +1539,7 @@ template class RegExpNodePThese : public RegExpNode::m_RegExpData);); } else { TK_INFO("Find NODE : " << levelSpace(level) << "@(...)@ {" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "} subdata="; DisplayElem(RegExpNode::m_RegExpData);); - for(int32_t i=0; iDisplay(level+1); } } @@ -1547,7 +1547,7 @@ template class RegExpNodePThese : public RegExpNode*> m_subNode; + std::vector*> m_subNode; //int32_t m_posPthese; //!< position of the element is detected in the output element }; #undef __class__ @@ -1634,7 +1634,7 @@ template class RegExp { void SetRegExp(etk::UString &expressionRequested) { m_expressionRequested = expressionRequested; // TODO : Must be deprecated ... - etk::VectorType tmpExp; + std::vector tmpExp; //TK_DEBUG("Parse RegExp : " << expressionRequested.c_str() ); m_isOk = false; @@ -1667,7 +1667,7 @@ template class RegExp { if( true == constConvertionTable[j].haveBackSlash && exp[iii+1] == constConvertionTable[j].inputValue) { - tmpExp.PushBack(constConvertionTable[j].newValue); + tmpExp.push_back(constConvertionTable[j].newValue); break; } } @@ -1699,13 +1699,13 @@ template class RegExp { if( false == constConvertionTable[j].haveBackSlash && exp[iii] == constConvertionTable[j].inputValue) { - tmpExp.PushBack(constConvertionTable[j].newValue); + tmpExp.push_back(constConvertionTable[j].newValue); break; } } // not find : normal element if (j==constConvertionTableSize) { - tmpExp.PushBack( ((int16_t)exp[iii]) & 0x00FF); + tmpExp.push_back( ((int16_t)exp[iii]) & 0x00FF); } } } @@ -1730,25 +1730,25 @@ template class RegExp { return; } - //TK_DEBUG("Main element :"; DisplayElem(tmpExp, 0, tmpExp.Size()); ); - if( tmpExp.Size()>0 + //TK_DEBUG("Main element :"; DisplayElem(tmpExp, 0, tmpExp.size()); ); + if( tmpExp.size()>0 && REGEXP_OPCODE_NO_CHAR == tmpExp[0]) { //TK_DEBUG("=> must not begin with char"); m_notBeginWithChar = true; // remove element - tmpExp.Erase(0); + tmpExp.erase(tmpExp.begin()); } - if( tmpExp.Size()>0 - && REGEXP_OPCODE_NO_CHAR == tmpExp[tmpExp.Size()-1]) + if( tmpExp.size()>0 + && REGEXP_OPCODE_NO_CHAR == *tmpExp.end()) { //TK_DEBUG("=> must not end with char"); m_notEndWithChar = true; // remove element - tmpExp.Erase(tmpExp.Size()-1); + tmpExp.erase(tmpExp.end()); } - if (tmpExp.Size() != m_exprRootNode.Generate(tmpExp) ) { + if (tmpExp.size() != m_exprRootNode.Generate(tmpExp) ) { return; } // TODO : optimize node here ... @@ -1793,7 +1793,7 @@ template class RegExp { if (false == m_isOk) { return false; } - int32_t buflen = SearchIn.Size(); + int32_t buflen = SearchIn.size(); if (endPos > buflen) { endPos = buflen; } @@ -1831,7 +1831,7 @@ template class RegExp { } // Check end : if (true == m_notEndWithChar) { - if (i+findLen < SearchIn.Size() ) { + if (i+findLen < SearchIn.size() ) { char tmpVal = SearchIn[i+findLen]; if( ( 'a' <= tmpVal && 'z' >= tmpVal ) @@ -1874,7 +1874,7 @@ template class RegExp { if (false == m_isOk) { return false; } - int32_t buflen = SearchIn.Size(); + int32_t buflen = SearchIn.size(); if (endPos > buflen) { endPos = buflen; } @@ -1910,7 +1910,7 @@ template class RegExp { } // Check end : if (true == m_notEndWithChar) { - if (startPos+findLen < SearchIn.Size() ) { + if (startPos+findLen < SearchIn.size() ) { char tmpVal = SearchIn[startPos+findLen]; if( ( 'a' <= tmpVal && 'z' >= tmpVal ) @@ -1977,7 +1977,7 @@ template class RegExp { * @param[in,out] * @return */ - bool CheckGoodPosition(etk::VectorType tmpExp, int32_t &pos) + bool CheckGoodPosition(std::vector tmpExp, int32_t &pos) { int16_t curentCode = tmpExp[pos]; int16_t endCode = REGEXP_OPCODE_PTHESE_OUT; @@ -1990,7 +1990,7 @@ template class RegExp { input = (char*)"{x,x}"; } pos++; - if (pos >= (int32_t)tmpExp.Size()) { + if (pos >= (int32_t)tmpExp.size()) { TK_ERROR("ended with: ( or { or [ ... not permited"); return false; } @@ -1998,7 +1998,7 @@ template class RegExp { // case dependent : if( REGEXP_OPCODE_BRACKET_IN == curentCode || REGEXP_OPCODE_BRACE_IN == curentCode) { - while(pos< (int32_t)tmpExp.Size()) { + while(pos< (int32_t)tmpExp.size()) { //TK_DEBUG("check : " << tmpExp[pos]); // if we find the end : if (endCode == tmpExp[pos]) { @@ -2041,7 +2041,7 @@ template class RegExp { pos++; } } else { - while(pos< (int32_t)tmpExp.Size()) { + while(pos< (int32_t)tmpExp.size()) { if (endCode == tmpExp[pos]) { // find the last element return true; @@ -2083,10 +2083,10 @@ template class RegExp { * @param[in,out] * @return */ - bool CheckGoodPosition(etk::VectorType tmpExp) + bool CheckGoodPosition(std::vector tmpExp) { int32_t pos = 0; - while (pos < (int32_t)tmpExp.Size()) { + while (pos < (int32_t)tmpExp.size()) { //TK_DEBUG("check : " << tmpExp[pos]); if( REGEXP_OPCODE_PTHESE_IN == tmpExp[pos] || REGEXP_OPCODE_BRACKET_IN == tmpExp[pos] diff --git a/Sources/libetk/etk/UString.cpp b/Sources/libetk/etk/UString.cpp index ea2e68e4..4d83182d 100644 --- a/Sources/libetk/etk/UString.cpp +++ b/Sources/libetk/etk/UString.cpp @@ -22,6 +22,7 @@ ******************************************************************************* */ +#include #include #include #include @@ -47,9 +48,9 @@ int32_t strlen(const uniChar_t * data) etk::CCout& etk::operator <<(etk::CCout &os, const etk::UString &obj) { - etk::VectorType output_UTF8; + std::vector output_UTF8; unicode::convertUnicodeToUtf8(obj.m_data, output_UTF8); - output_UTF8.PushBack('\0'); + output_UTF8.push_back('\0'); os << &output_UTF8[0]; return os; } @@ -64,8 +65,8 @@ etk::CCout& etk::operator <<(etk::CCout &os, const etk::UString &obj) */ etk::UString::~UString(void) { - m_data.Clear(); - m_dataUtf8.Clear(); + m_data.clear(); + m_dataUtf8.clear(); } @@ -80,8 +81,8 @@ etk::UString::~UString(void) etk::UString::UString(void) { //TK_INFO("new etk::UString()"); - m_data.Clear(); - m_data.PushBack('\0'); + m_data.clear(); + m_data.push_back('\0'); } @@ -95,8 +96,8 @@ etk::UString::UString(void) */ etk::UString::UString(const char* inputData, int32_t len) { - m_data.Clear(); - m_data.PushBack('\0'); + m_data.clear(); + m_data.push_back('\0'); Set(inputData, len); } @@ -111,8 +112,8 @@ etk::UString::UString(const char* inputData, int32_t len) */ etk::UString::UString(const uniChar_t* inputData, int32_t len) { - m_data.Clear(); - m_data.PushBack('\0'); + m_data.clear(); + m_data.push_back('\0'); Set(inputData, len); } /* @@ -135,18 +136,18 @@ void etk::UString::Set(const char * inputData, int32_t len) len = strlen(inputData); } // convert the string - etk::VectorType tmpChar; + std::vector tmpChar; for (int32_t iii=0; iii inputData) +const etk::UString& etk::UString::operator= (std::vector inputData) { - etk::VectorType output_Unicode; + std::vector output_Unicode; unicode::convertUtf8ToUnicode(inputData, output_Unicode); *this = output_Unicode; return *this; @@ -292,9 +295,9 @@ const etk::UString& etk::UString::operator= (etk::VectorType inputData) * @return * */ -const etk::UString& etk::UString::operator= (etk::VectorType inputData) +const etk::UString& etk::UString::operator= (std::vector inputData) { - etk::VectorType output_Unicode; + std::vector output_Unicode; unicode::convertUtf8ToUnicode(inputData, output_Unicode); *this = output_Unicode; return *this; @@ -309,12 +312,12 @@ const etk::UString& etk::UString::operator= (etk::VectorType inputData) * @return * */ -const etk::UString& etk::UString::operator= (etk::VectorType inputData) +const etk::UString& etk::UString::operator= (std::vector inputData) { m_data = inputData; - if (m_data.Size()>0) { - if (m_data[m_data.Size()-1] != '\0') { - m_data.PushBack('\0'); + if (m_data.size()>0) { + if (m_data[m_data.size()-1] != '\0') { + m_data.push_back('\0'); } } //TK_DEBUG("m_dataLen="<'" << (char)etkS.m_data[iii] << "' ==> " << changeOrder(m_data[iii]) << ">" << changeOrder(etkS.m_data[iii]) << ""); uniChar_t elemA = changeOrder(m_data[iii]); uniChar_t elemB = changeOrder(etkS.m_data[iii]); @@ -354,7 +357,7 @@ bool etk::UString::operator> (const etk::UString& etkS) const return false; } } - if (m_data.Size() > etkS.m_data.Size()) { + if (m_data.size() > etkS.m_data.size()) { return true; } } @@ -364,7 +367,7 @@ bool etk::UString::operator> (const etk::UString& etkS) const bool etk::UString::operator>= (const etk::UString& etkS) const { if( this != &etkS ) { - for (int32_t iii=0; iii < m_data.Size() && iii < etkS.m_data.Size(); iii++) { + for (int32_t iii=0; iii < m_data.size() && iii < etkS.m_data.size(); iii++) { uniChar_t elemA = changeOrder(m_data[iii]); uniChar_t elemB = changeOrder(etkS.m_data[iii]); if (elemA != elemB) { @@ -374,7 +377,7 @@ bool etk::UString::operator>= (const etk::UString& etkS) const return false; } } - if (m_data.Size() >= etkS.m_data.Size()) { + if (m_data.size() >= etkS.m_data.size()) { return true; } } @@ -384,7 +387,7 @@ bool etk::UString::operator>= (const etk::UString& etkS) const bool etk::UString::operator< (const etk::UString& etkS) const { if( this != &etkS ) { - for (int32_t iii=0; iii < m_data.Size() && iii < etkS.m_data.Size(); iii++) { + for (int32_t iii=0; iii < m_data.size() && iii < etkS.m_data.size(); iii++) { uniChar_t elemA = changeOrder(m_data[iii]); uniChar_t elemB = changeOrder(etkS.m_data[iii]); if (elemA != elemB) { @@ -394,7 +397,7 @@ bool etk::UString::operator< (const etk::UString& etkS) const return false; } } - if (m_data.Size() < etkS.m_data.Size()) { + if (m_data.size() < etkS.m_data.size()) { return true; } } @@ -404,7 +407,7 @@ bool etk::UString::operator< (const etk::UString& etkS) const bool etk::UString::operator<= (const etk::UString& etkS) const { if( this != &etkS ) { - for (int32_t iii=0; iii < m_data.Size() && iii < etkS.m_data.Size(); iii++) { + for (int32_t iii=0; iii < m_data.size() && iii < etkS.m_data.size(); iii++) { uniChar_t elemA = changeOrder(m_data[iii]); uniChar_t elemB = changeOrder(etkS.m_data[iii]); if (elemA != elemB) { @@ -414,7 +417,7 @@ bool etk::UString::operator<= (const etk::UString& etkS) const return false; } } - if (m_data.Size() <= etkS.m_data.Size()) { + if (m_data.size() <= etkS.m_data.size()) { return true; } } @@ -433,11 +436,11 @@ bool etk::UString::operator<= (const etk::UString& etkS) const bool etk::UString::operator== (const etk::UString& etkS) const { if( this != &etkS ) { - if (etkS.m_data.Size() != m_data.Size()) { + if (etkS.m_data.size() != m_data.size()) { //TK_DEBUG(" not the same size : " << etkS.m_data.Size() << "!=" << m_data.Size()); return false; } - for (int32_t iii= 0; iii maxSize ... (" << Size() << ") ==> add at the end ..."); - m_data.PushBack(inputData, len); + for (int32_t iii=0; iii= Size() ) { posEnd = Size(); } - out.m_data = m_data.Extract(posStart, posEnd); - out.m_data.PushBack('\0'); + out.m_data.clear(); + out.m_data.insert(out.m_data.begin(), m_data.begin()+posStart, m_data.begin()+posEnd); + out.m_data.push_back('\0'); return out; } @@ -734,10 +742,10 @@ etk::UString etk::UString::Extract(int32_t posStart, int32_t posEnd) * @return The desired vector with data * */ -etk::VectorType etk::UString::GetVector(void) +std::vector etk::UString::GetVector(void) { - etk::VectorType out = m_data; - out.PopBack(); + std::vector out = m_data; + out.pop_back(); return out; } @@ -783,9 +791,9 @@ bool etk::UString::EndWith(const etk::UString& data) char * etk::UString::Utf8Data(void) { // UTF8 generation : - m_dataUtf8.Clear(); + m_dataUtf8.clear(); unicode::convertUnicodeToUtf8(m_data, m_dataUtf8); - m_dataUtf8.PushBack('\0'); + m_dataUtf8.push_back('\0'); return &m_dataUtf8[0]; } diff --git a/Sources/libetk/etk/UString.h b/Sources/libetk/etk/UString.h index 5839bc50..acb6ddfd 100644 --- a/Sources/libetk/etk/UString.h +++ b/Sources/libetk/etk/UString.h @@ -26,7 +26,7 @@ #define __ETK_USTRING_H__ #include -#include +#include namespace etk { @@ -54,9 +54,9 @@ namespace etk * = assigment *****************************************************/ const etk::UString& operator= (const etk::UString &etkS ); - const etk::UString& operator= (etk::VectorType inputData); - const etk::UString& operator= (etk::VectorType inputData); - const etk::UString& operator= (etk::VectorType inputData); + const etk::UString& operator= (std::vector inputData); + const etk::UString& operator= (std::vector inputData); + const etk::UString& operator= (std::vector inputData); /***************************************************** * == operator *****************************************************/ @@ -131,7 +131,7 @@ namespace etk void Remove(int32_t currentID, int32_t len); void Clear(void); - etk::VectorType GetVector(void); + std::vector GetVector(void); uniChar_t * pointer(void) { return &m_data[0]; }; // generate temporary allocation (auto unallocated...) char * Utf8Data(void); @@ -140,8 +140,8 @@ namespace etk etk::UString Extract(int32_t posStart=0, int32_t posEnd=0x7FFFFFFF); private : - etk::VectorType m_data; //!< internal data is stored in the Unicode properties ... - etk::VectorType m_dataUtf8; //!< Tmp data for the Utf8Data() function + std::vector m_data; //!< internal data is stored in the Unicode properties ... + std::vector m_dataUtf8; //!< Tmp data for the Utf8Data() function }; etk::CCout& operator <<(etk::CCout &os, const etk::UString &obj); diff --git a/Sources/libetk/etk/Vector.h b/Sources/libetk/etk/Vector.h deleted file mode 100644 index e6951458..00000000 --- a/Sources/libetk/etk/Vector.h +++ /dev/null @@ -1,323 +0,0 @@ -/** - ******************************************************************************* - * @file etk/Vector.h - * @brief Ewol Tool Kit : Basic etk::Vector (template) - * @author Edouard DUPIN - * @date 07/04/2011 - * @par Project - * Ewol TK - * - * @par Copyright - * Copyright 2011 Edouard DUPIN, all right reserved - * - * This software is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY. - * - * Licence summary : - * You can modify and redistribute the sources code and binaries. - * You can send me the bug-fix - * - * Term of the licence in in the file licence.txt. - * - ******************************************************************************* - */ - -#ifndef __ETK_VECTOR_H__ -#define __ETK_VECTOR_H__ - -#include -#include -#include - -#undef __class__ -#define __class__ "etk::Vector" - -/** - * @brief etkVector classes ... - * - * @tparam[in] T The type of objects to store. - * @tparam[in] INC Incrementation mode (0 : Exponential to 200 and increment by stemp of 200) - * - * @todo : Need to add : popBack / Assign / Insert / Erase / Swap / Clear - * - * m_data - * ---------- |-----------------------| - * | 0 |-------->| Class Data | - * |--------| |-----------------------| - * | 1 |----| - * |--------| | - * | 2 |====|==============| |-----------------------| - * |--------| | --->| Class Data | - * m_count | 3 |-| | |-----------------------| - * |--------| | | - * | x | | | |-----------------------| - * |--------| | -------->| Class Data | - * | x | | |-----------------------| - * |--------| | - * | x | | - * |--------| | |-----------------------| - * | x | --------------------->| Class Data | - * |--------| |-----------------------| - * | x | - * |--------| - * | x | - * |--------| - * m_size | x | - * ---------- - * - */ -namespace etk -{ - -template class Vector -{ - public: - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - Vector(int count = 0): - m_data(NULL), - m_count(0), - m_size(0) - { - Resize(count); - } - - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - Vector(const etk::Vector & myVector): - m_size(myVector.m_size), - m_count(myVector.m_count), - m_data(NULL) - { - int32_t i; - ETK_MALLOC_CAST(m_data, m_size, T, T*);//reinterpret_cast); - for(i=0; i & etkVector) - { - int32_t i; - this->~etkVector(); - m_size = etkVector.m_size; - m_count = etkVector.m_count; - ETK_MALLOC_CAST(m_data, m_size, T, T*);//reinterpret_cast); - for(i=0; i res - || res >= Size()) - { - return -1; - } else { - return res; - } - } - - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - void PushBack(const T& item) - { - int32_t idx = Size(); - Resize(idx+1); - Get(idx) = item; - } - - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - void Resize(int32_t count) - { - int32_t i; - // Reallocate memory - if (count > m_size) { - ChangeAllocation(count); - } - - // Remove deprecated element - for(i=count; i m_size) { - // generate new size - while(count > m_size) { - if (INC) { - m_size = (m_size + INC); - } else if (m_size==0) { - m_size = 1; - } else { - m_size = m_size * 2; - } - } - // Allocate the curent element - T * data = NULL; - ETK_MALLOC_CAST(data, m_size, T, T*);//reinterpret_cast); - for(int i=0; i -#include -#include - -#undef __class__ -#define __class__ "etk::VectorType" - -/** - * @brief VectorType classes ... - * - * @tparam[in] SIZE Size of the current element. - * - * m_data - * <------------ m_dataSize ------------> - * ---------------------------------------- - * | 0 | - * |--------------------------------------| - * | 1 | - * |--------------------------------------| - * | 2 | - * |--------------------------------------| - * m_size | 3 | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * m_allocated | x | - * ---------------------------------------- - * - */ - -namespace etk -{ - -template class VectorType -{ - public: - class Iterator - { - // Private data : - private: - int32_t m_current; //!< curent Id on the vector - VectorType * m_VectorType; //!< Pointer on the curent element of the vectorBin - public: - /** - * @brief Basic itarator constructor with no link with an etkVector - */ - Iterator(): - m_current(-1), - m_VectorType(NULL) - { - // nothing to do ... - } - /** - * @brief Recopy constructor on a specific etkVector. - * @param[in] otherIterator The Iterator that might be copy - */ - Iterator(const Iterator & otherIterator): - m_current(otherIterator.m_current), - m_VectorType(otherIterator.m_VectorType) - { - // nothing to do ... - } - /** - * @brief Asignation operator. - * @param[in] otherIterator The Iterator that might be copy - * @return reference on the curent Iterator - */ - Iterator& operator=(const Iterator & otherIterator) - { - m_current = otherIterator.m_current; - m_VectorType = otherIterator.m_VectorType; - return *this; - } - /** - * @brief Basic destructor - */ - ~Iterator() - { - m_current = -1; - m_VectorType = NULL; - } - /** - * @brief basic boolean cast - * @return true if the element is present in the etkVector size - */ - operator bool () - { - if( 0 <= m_current - && m_current < m_VectorType->Size() ) - { - return true; - } else { - return false; - } - } - /** - * @brief Incremental operator - * @return Reference on the current iterator incremented - */ - Iterator& operator++ () - { - if( NULL != m_VectorType - && m_current < m_VectorType->Size() ) - { - m_current++; - } - return *this; - } - /** - * @brief Decremental operator - * @return Reference on the current iterator decremented - */ - Iterator& operator-- () - { - if (m_current >= 0) { - m_current--; - } - return *this; - } - /** - * @brief Incremental operator - * @return Reference on a new iterator and increment the other one - */ - Iterator operator++ (int32_t) - { - Iterator it(*this); - ++(*this); - return it; - } - /** - * @brief Decremental operator - * @return Reference on a new iterator and decrement the other one - */ - Iterator operator-- (int32_t) - { - Iterator it(*this); - --(*this); - return it; - } - /** - * @brief Get reference on the current Element - * @return the reference on the current Element - */ - MY_TYPE & operator-> () const - { - TK_CHECK_INOUT(m_current >= 0 && m_current < m_VectorType->Size()); - return &m_VectorType->Get(m_current); - } - /** - * @brief Get reference on the current Element - * @return the reference on the current Element - */ - MY_TYPE & operator* () const - { - TK_CHECK_INOUT(m_current >= 0 && m_current < m_VectorType->Size()); - return m_VectorType->Get(m_current); - } - private: - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - Iterator(VectorType * Evb, int32_t pos): - m_current(pos), - m_VectorType(Evb) - { - // nothing to do ... - } - friend class VectorType; - }; - - private: - MY_TYPE * m_data; //!< pointer on the curetn table of Data - int32_t m_size; //!< nb Element in the buffer - int32_t m_allocated; //!< Current allocated size - int32_t m_increment; //!< methode of increment - public: - /** - * @brief Create an empty vector - * @param[in] count Minimum request size of the Buffer - */ - VectorType(int32_t count = 0): - m_data(NULL), - m_size(0), - m_allocated(0), - m_increment(1) - { - ChangeAllocation(count); - } - - /** - * @brief Re-copy constructor (copy all needed data) - * @param[in] Evb Vector that might be copy - */ - VectorType(const etk::VectorType & Evb) - { - m_allocated = Evb.m_allocated; - m_size = Evb.m_size; - m_increment = Evb.m_increment; - m_data = NULL; - //TK_DEBUG("USE Specific vector allocator ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment); - // allocate all same data - ETK_MALLOC(m_data, m_allocated, MY_TYPE); - TK_ASSERT(NULL!=m_data, "Error in data allocation"); - // Copy all data ... - memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) ); - } - - /** - * @brief Destructor of the current Class - */ - ~VectorType() - { - if (NULL!=m_data) { - ETK_FREE(m_data); - m_data = NULL; - } - m_allocated = 0; - m_size = 0; - m_increment = 0; - } - - /** - * @brief Re-copy operator - * @param[in] Evb Vector that might be copy - * @return reference on the curent re-copy vector - */ - VectorType& operator=(const etk::VectorType & Evb) - { - //TK_DEBUG("USE RECOPY vector ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment); - if( this != &Evb ) // avoid copy to itself - { - if (NULL!=m_data) { - ETK_FREE(m_data); - m_data = NULL; - } - // Set the new value - m_allocated = Evb.m_allocated; - m_size = Evb.m_size; - m_increment = Evb.m_increment; - // allocate all same data - ETK_MALLOC(m_data, m_allocated, MY_TYPE); - TK_ASSERT(NULL!=m_data, "Error in data allocation"); - // Copy all data ... - memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) ); - } - // Return the curent pointer - return *this; - } - - /** - * @brief Add at the Last position of the Vector - * @param[in] item Element to add at the end of vector - */ - VectorType& operator+= (const etk::VectorType & Evb) // += operator - { - int32_t nbElememt = Evb.Size(); - int32_t idx = m_size; - Resize(m_size+nbElememt); - memcpy(&m_data[idx], &Evb.m_data[0], nbElememt*sizeof(MY_TYPE) ); - // Return the curent pointer - return *this; - } - - /** - * @brief Set increment mode of this vector (default it match corectly with the number of element inside) - * @param[in] newIncrementNumber methode requested - */ - void SetIncrement(int32_t newIncrementNumber) - { - m_increment = newIncrementNumber; - } - - /** - * @brief Get the number of element in the vector - * @return The number requested - */ - int32_t Size() const - { - return m_size; - } - - /** - * @brief Get the Allocated size in the vector - * @return The size of allocation - */ - int32_t AllocatedSize() const - { - return m_allocated; - } - - /** - * @brief Get a current element in the vector - * @param[in] pos Desired position read - * @return Reference on the Element - */ - MY_TYPE& Get(int32_t pos) - { - return m_data[pos]; - } - - /** - * @brief Get an copy Element an a special position - * @param[in] pos Position in the vector that might be get [0..Size()] - * @return An reference on the copy of selected element - */ - MY_TYPE& operator[] (int32_t pos) - { - return Get(pos); - } - - /** - * @brief Get an Element an a special position - * @param[in] pos Position in the vector that might be get [0..Size()] - * @return An reference on the selected element - */ - const MY_TYPE& operator[] (int32_t pos) const - { - return m_data[pos]; - } - - /** - * @brief Add at the Last position of the Vector - * @param[in] item Element to add at the end of vector - */ - void PushBack(const MY_TYPE& item) - { - int32_t idx = m_size; - Resize(m_size+1); - m_data[idx] = item; - } - - /** - * @brief Add at the Last position of the Vector - * @param[in] item Element to add at the end of vector - */ - void PushBack(const MY_TYPE * item, int32_t nbElement) - { - if (NULL == item) { - return; - } - int32_t idx = m_size; - Resize(m_size+nbElement); - memcpy(&m_data[idx], item, nbElement*sizeof(MY_TYPE) ); - } - - /** - * @brief Remove the last element of the vector - */ - void PopBack(void) - { - if(m_size>0) { - Resize(m_size-1); - } - } - - /** - * @brief Remove all alement in the current vector - */ - void Clear(void) - { - if(m_size>0) { - Resize(0); - } - } - - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - void Insert(int32_t pos, const MY_TYPE& item) - { - if (pos>m_size) { - TK_ERROR(" can not insert Element at this position : " << pos << " > " << m_size<< " add it at the end ... "); - PushBack(item); - return; - } - int32_t tmpSize = m_size; - // Request resize of the current buffer - Resize(m_size+1); - // move curent data - int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE); - if ( 0 < sizeToMove) { - memmove((m_data + pos + 1), (m_data + pos), sizeToMove ); - } - // affectation of the current element - m_data[pos] = item; - } - - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - void Insert(int32_t pos, const MY_TYPE * item, int32_t nbElement) - { - if (pos>m_size) { - TK_WARNING(" can not insert Element at this position : " << pos << " > " << m_size << " add it at the end ... "); - PushBack(item, nbElement); - return; - } - int32_t tmpSize = m_size; - // Request resize of the current buffer - Resize(m_size+nbElement); - // move curent data (after the position) - int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE); - if ( 0 < sizeToMove) { - memmove((m_data + pos + nbElement), (m_data + pos), sizeToMove ); - } - // affectation of all input element - memcpy(&m_data[pos], item, nbElement*sizeof(MY_TYPE) ); - } - - /** - * @brief Remove one element - * - * @param[in] pos Position to remove the data - * - * @return --- - * - */ - void Erase(int32_t pos) - { - if (pos<0 || (uint32_t)pos>m_size) { - TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size); - return; - } - int32_t tmpSize = m_size; - int32_t sizeToMove = (tmpSize - (pos+1))*sizeof(MY_TYPE); - if ( 0 < sizeToMove) { - // move curent data - memmove((m_data + pos), (m_data + pos + 1), sizeToMove ); - } - // Request resize of the current buffer - Resize(m_size-1); - } - - /** - * @brief Remove N elements - * - * @param[in] pos Position to remove the data - * @param[in] posEnd Last position number - * - * @return --- - * - */ - void Erase(int32_t pos, int32_t posEnd) - { - if (pos>m_size) { - TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size); - return; - } - if (posEnd>m_size) { - posEnd = m_size; - } - int32_t nbElement = m_size - pos; - int32_t tmpSize = m_size; - // move curent data - int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE); - if ( 0 < sizeToMove) { - memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove ); - } - // Request resize of the current buffer - Resize(m_size-nbElement); - } - - /** - * @brief Remove N element - * - * @param[in] pos Position to remove the data - * @param[in] nbElement number of element to remove - * - * @return --- - * - */ - void EraseLen(int32_t pos, int32_t nbElement) - { - if (pos>m_size) { - TK_ERROR(" can not Erase Len Element at this position : " << pos << " > " << m_size); - return; - } - if (pos+nbElement>m_size) { - nbElement = m_size - pos; - } - int32_t tmpSize = m_size; - // move curent data - int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE); - if ( 0 < sizeToMove) { - memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove ); - } - // Request resize of the current buffer - Resize(m_size-nbElement); - } - - /** - * @brief extract data between two point : - * @param[in] posStart start position to extract data - * @param[in] posEnd End position to extract data - * @return the extracted vector - */ - VectorType Extract(int32_t posStart = 0, int32_t posEnd=0x7FFFFFFF) - { - VectorType out; - if (posStart < 0) { - posStart = 0; - } else if (posStart >= Size() ) { - return out; - } - if (posEnd < 0) { - return out; - } else if (posEnd >= Size() ) { - posEnd = Size(); - } - out.PushBack(&m_data[posStart], posEnd-posStart); - return out; - } - - /** - * @brief Set the minimum allocation in memory for the curent vector ==> reallocate the - * buffer to fit exactly the mumber of element needed - */ - void Fit(void) - { - if (m_size > m_allocated) { - // Reallocate the curent data to the correct size ... - ETK_REALLOC(m_data, m_size, MY_TYPE); - } - // Check result with assert : - TK_ASSERT(NULL!=m_data, "Error in data Fitting"); - m_allocated = m_size; - } - - /** - * @brief Get an iterator an an specific position - * @param[in] pos Requested position of the iterator in the vector - * @return The Iterator - */ - Iterator Position(int32_t pos) - { - return Iterator(this, pos); - } - - /** - * @brief Get an Iterator on the start position of the Vector - * @return The Iterator - */ - Iterator Begin(void) - { - return Position(0); - } - - /** - * @brief Get an Iterator on the end position of the Vector - * @return The Iterator - */ - Iterator End(void) - { - return Position( Size()-1 ); - } - - private: - /** - * @brief Change the current size of the vector - * @param[in] newSize New requested size of element in the vector - */ - void Resize(int32_t newSize) - { - // Reallocate memory - if (newSize > m_allocated) { - ChangeAllocation(newSize); - } - m_size = newSize; - } - - /** - * @brief Change the current allocation to the corect one (depend on the current size) - * @param[in] newSize Minimum number of element needed - */ - void ChangeAllocation(int32_t newSize) - { - // set the minimal size to 1 - if(newSize <= 0) { - newSize = 1; - } - int32_t requestSize = m_allocated; - // set the size with the corect chose type : - if (newSize == m_allocated) { - return; - } else if (newSize < requestSize) { - // down the size of the vector: - if (0==m_increment) { - // never down size... - } else { - int32_t devide = m_increment; - if (devide == 0) { - devide = 1; - } - int32_t numberOfStep = m_allocated / devide; - if (newSize< ((numberOfStep-2)*devide + devide/2) ) { - //Allow Reallocation of a new size shorter - requestSize = ((newSize / devide)+1) * devide; - } - } - } else { - while(newSize > requestSize) { - if (0 == requestSize) { - requestSize = 1; - } else if (0==m_increment) { - requestSize = requestSize * 2; - } else { - requestSize = (requestSize + m_increment); - } - } - } - // No reallocation needed : - if (requestSize == m_allocated) { - return; - } - // check if something is allocated : - if (NULL == m_data) { - // no data allocated ==> request an allocation (might be the first) - ETK_MALLOC(m_data, requestSize, MY_TYPE); - } else { - // move datas - ETK_REALLOC(m_data, requestSize, MY_TYPE); - } - // Check result with assert : - TK_ASSERT(NULL!=m_data, "Error in data allocation"); - // set the new allocation size - m_allocated = requestSize; - } -}; -} - -#undef __class__ -#define __class__ NULL - -#endif - diff --git a/Sources/libetk/etk/tool.cpp b/Sources/libetk/etk/tool.cpp index 1dc7fe47..84f37978 100644 --- a/Sources/libetk/etk/tool.cpp +++ b/Sources/libetk/etk/tool.cpp @@ -39,20 +39,20 @@ int32_t etk::tool::irand(int32_t a, int32_t b) } -void etk::tool::SortList(etk::VectorType &m_listDirectory) +void etk::tool::SortList(std::vector &m_listDirectory) { - etk::VectorType tmpList = m_listDirectory; - m_listDirectory.Clear(); - for(int32_t iii=0; iii tmpList = m_listDirectory; + m_listDirectory.clear(); + for(int32_t iii=0; iii *m_listDirectory[jjj]) { findPos = jjj+1; } } //EWOL_DEBUG("position="< &m_listDirectory); + void SortList(std::vector &m_listDirectory); }; }; diff --git a/Sources/libetk/etk/unicode.cpp b/Sources/libetk/etk/unicode.cpp index c932e82d..2f4468eb 100644 --- a/Sources/libetk/etk/unicode.cpp +++ b/Sources/libetk/etk/unicode.cpp @@ -24,8 +24,8 @@ // cf : http://unicode.org/fr/charts/symbols.html#CombiningDiacriticalMarks +#include #include -#include #include #include @@ -58,7 +58,7 @@ void unicode::convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniCh #endif break; default : - TK_WARNING("Unknow charset ... " << inputCharset); + TK_WARNING("Unknow charset ... " << (int32_t)inputCharset); output_Unicode = '?'; break; } @@ -99,69 +99,69 @@ void unicode::convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unico } -int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::VectorType& input_ISO, etk::VectorType& output_Unicode) +int32_t unicode::convertIsoToUnicode(charset_te inputCharset, std::vector& input_ISO, std::vector& output_Unicode) { - output_Unicode.Clear(); + output_Unicode.clear(); uniChar_t output; - for(int32_t iii=0; iii& input_ISO, etk::VectorType& output_Unicode) +int32_t unicode::convertIsoToUnicode(charset_te inputCharset, std::vector& input_ISO, std::vector& output_Unicode) { - output_Unicode.Clear(); + output_Unicode.clear(); uniChar_t output; - for(int32_t iii=0; iii& input_Unicode, etk::VectorType& output_ISO) +int32_t unicode::convertUnicodeToIso(charset_te inputCharset, std::vector& input_Unicode, std::vector& output_ISO) { - output_ISO.Clear(); + output_ISO.clear(); char output[10]; - for(int32_t iii=0; iii& input_Unicode, etk::VectorType& output_ISO) +int32_t unicode::convertUnicodeToIso(charset_te inputCharset, std::vector& input_Unicode, std::vector& output_ISO) { - output_ISO.Clear(); + output_ISO.clear(); char output[10]; - for(int32_t iii=0; iii& input_Unicode, etk::VectorType& output_UTF8) +int32_t unicode::convertUnicodeToUtf8(const std::vector& input_Unicode, std::vector& output_UTF8) { char output[10]; - for (int32_t iii=0; iii& input_Unicode, etk::VectorType& output_UTF8) +int32_t unicode::convertUnicodeToUtf8(const std::vector& input_Unicode, std::vector& output_UTF8) { char output[10]; - for (int32_t iii=0; iii& input_UTF8, etk::VectorType& output_Unicode) +int32_t unicode::convertUtf8ToUnicode(std::vector& input_UTF8, std::vector& output_Unicode) { char tmpData[20]; int32_t pos = 0; - while (pos < input_UTF8.Size()) { - int32_t lenMax = input_UTF8.Size() - pos; + while (pos < input_UTF8.size()) { + int32_t lenMax = input_UTF8.size() - pos; //4 case if( 1<=lenMax && 0x00 == (input_UTF8[pos+0] & 0x80) ) @@ -333,17 +333,17 @@ int32_t unicode::convertUtf8ToUnicode(etk::VectorType& input_UTF8, etk::Ve } uniChar_t tmpUnicode; convertUtf8ToUnicode(tmpData, tmpUnicode); - output_Unicode.PushBack(tmpUnicode); + output_Unicode.push_back(tmpUnicode); } return 0; } -int32_t unicode::convertUtf8ToUnicode(etk::VectorType& input_UTF8, etk::VectorType& output_Unicode) +int32_t unicode::convertUtf8ToUnicode(std::vector& input_UTF8, std::vector& output_Unicode) { char tmpData[20]; int32_t pos = 0; - while (pos < input_UTF8.Size()) { - int32_t lenMax = input_UTF8.Size() - pos; + while (pos < input_UTF8.size()) { + int32_t lenMax = input_UTF8.size() - pos; //4 case if( 1<=lenMax && 0x00 == (input_UTF8[pos+0] & 0x80) ) @@ -384,12 +384,12 @@ int32_t unicode::convertUtf8ToUnicode(etk::VectorType& input_UTF8, etk:: } uniChar_t tmpUnicode; convertUtf8ToUnicode(tmpData, tmpUnicode); - output_Unicode.PushBack(tmpUnicode); + output_Unicode.push_back(tmpUnicode); } return 0; } -int32_t unicode::convertUtf8ToUnicode(char * input_UTF8, etk::VectorType& output_Unicode) +int32_t unicode::convertUtf8ToUnicode(char * input_UTF8, std::vector& output_Unicode) { char tmpData[20]; int32_t pos = 0; @@ -439,7 +439,7 @@ int32_t unicode::convertUtf8ToUnicode(char * input_UTF8, etk::VectorType& input_ISO, etk::VectorType& output_UTF8) +int32_t unicode::convertIsoToUtf8(charset_te inputCharset, std::vector& input_ISO, std::vector& output_UTF8) { TK_WARNING("TODO : not coded..."); return 0; } -int32_t unicode::convertUtf8ToIso(charset_te inputCharset, etk::VectorType& input_UTF8, etk::VectorType& output_ISO) +int32_t unicode::convertUtf8ToIso(charset_te inputCharset, std::vector& input_UTF8, std::vector& output_ISO) { TK_WARNING("TODO : not coded..."); return 0; diff --git a/Sources/libetk/etk/unicode.h b/Sources/libetk/etk/unicode.h index c42fa65e..0908ba6b 100644 --- a/Sources/libetk/etk/unicode.h +++ b/Sources/libetk/etk/unicode.h @@ -26,7 +26,7 @@ #define __UNICODE_H__ #include -#include +#include namespace unicode { typedef enum { EDN_CHARSET_UTF8, @@ -47,25 +47,25 @@ namespace unicode { } charset_te; // transform ISO <==> Unicode - void convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniChar_t & output_Unicode); - void convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unicode, char & output_ISO); - int32_t convertIsoToUnicode(charset_te inputCharset, etk::VectorType& input_ISO, etk::VectorType& output_Unicode); - int32_t convertIsoToUnicode(charset_te inputCharset, etk::VectorType& input_ISO, etk::VectorType& output_Unicode); - int32_t convertUnicodeToIso(charset_te inputCharset, etk::VectorType& input_Unicode, etk::VectorType& output_ISO); - int32_t convertUnicodeToIso(charset_te inputCharset, etk::VectorType& input_Unicode, etk::VectorType& output_ISO); + void convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniChar_t & output_Unicode); + void convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unicode, char & output_ISO); + int32_t convertIsoToUnicode(charset_te inputCharset, std::vector& input_ISO, std::vector& output_Unicode); + int32_t convertIsoToUnicode(charset_te inputCharset, std::vector& input_ISO, std::vector& output_Unicode); + int32_t convertUnicodeToIso(charset_te inputCharset, std::vector& input_Unicode, std::vector& output_ISO); + int32_t convertUnicodeToIso(charset_te inputCharset, std::vector& input_Unicode, std::vector& output_ISO); // Transform UTF-8 <==> Unicode - void convertUnicodeToUtf8( uniChar_t input_Unicode, char * output_UTF8); - void convertUtf8ToUnicode( char * input_UTF8, uniChar_t& output_Unicode); - int32_t convertUnicodeToUtf8( const etk::VectorType& input_Unicode, etk::VectorType& output_UTF8); - int32_t convertUnicodeToUtf8( const etk::VectorType& input_Unicode, etk::VectorType& output_UTF8); - int32_t convertUtf8ToUnicode( etk::VectorType& input_UTF8, etk::VectorType& output_Unicode); - int32_t convertUtf8ToUnicode( etk::VectorType& input_UTF8, etk::VectorType& output_Unicode); - int32_t convertUtf8ToUnicode( char * input_UTF8, etk::VectorType& output_Unicode); + void convertUnicodeToUtf8( uniChar_t input_Unicode, char * output_UTF8); + void convertUtf8ToUnicode( char * input_UTF8, uniChar_t& output_Unicode); + int32_t convertUnicodeToUtf8( const std::vector& input_Unicode, std::vector& output_UTF8); + int32_t convertUnicodeToUtf8( const std::vector& input_Unicode, std::vector& output_UTF8); + int32_t convertUtf8ToUnicode( std::vector& input_UTF8, std::vector& output_Unicode); + int32_t convertUtf8ToUnicode( std::vector& input_UTF8, std::vector& output_Unicode); + int32_t convertUtf8ToUnicode( char * input_UTF8, std::vector& output_Unicode); // Transform ISO <==> UTF-8 - void convertIsoToUtf8( charset_te inputCharset, char input_ISO, char * output_UTF8); - void convertUtf8ToIso( charset_te inputCharset, char * input_UTF8, char & output_ISO); - int32_t convertIsoToUtf8( charset_te inputCharset, etk::VectorType& input_ISO, etk::VectorType& output_UTF8); - int32_t convertUtf8ToIso( charset_te inputCharset, etk::VectorType& input_UTF8, etk::VectorType& output_ISO); + void convertIsoToUtf8( charset_te inputCharset, char input_ISO, char * output_UTF8); + void convertUtf8ToIso( charset_te inputCharset, char * input_UTF8, char & output_ISO); + int32_t convertIsoToUtf8( charset_te inputCharset, std::vector& input_ISO, std::vector& output_UTF8); + int32_t convertUtf8ToIso( charset_te inputCharset, std::vector& input_UTF8, std::vector& output_ISO); void Utf8_SizeElement(const char * data, int32_t lenMax , uint8_t &size, bool &baseValid); int32_t strUtf8Len(const char *input_UTF8); diff --git a/Sources/libewol/ewol/Audio/audio.cpp b/Sources/libewol/ewol/Audio/audio.cpp index 1b18e381..43c4ed67 100644 --- a/Sources/libewol/ewol/Audio/audio.cpp +++ b/Sources/libewol/ewol/Audio/audio.cpp @@ -311,14 +311,14 @@ class RequestPlay { } }; -#include -etk::VectorType ListEffects; -etk::VectorType ListEffectsPlaying; +#include +std::vector ListEffects; +std::vector ListEffectsPlaying; int32_t ewol::audio::effects::Add(etk::UString file) { - for (int32_t iii=0; iiim_file == file) { ListEffects[iii]->m_requestedTime++; @@ -332,16 +332,16 @@ int32_t ewol::audio::effects::Add(etk::UString file) EWOL_ERROR("Error to load the effects : \"" << file << "\""); return -1; } - ListEffects.PushBack(tmpEffect); - return ListEffects.Size()-1; + ListEffects.push_back(tmpEffect); + return ListEffects.size()-1; } void ewol::audio::effects::Rm(int32_t effectId) { // find element ... - if (effectId <0 || effectId >= ListEffects.Size()) { - EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.Size()-1 << "] ==> can not remove it ..."); + if (effectId <0 || effectId >= ListEffects.size()) { + EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.size()-1 << "] ==> can not remove it ..."); return; } if (ListEffects[effectId] == NULL) { @@ -361,8 +361,8 @@ void ewol::audio::effects::Rm(int32_t effectId) void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy) { - if (effectId <0 || effectId >= ListEffects.Size()) { - EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.Size()-1 << "] ==> can not play it ..."); + if (effectId <0 || effectId >= ListEffects.size()) { + EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.size()-1 << "] ==> can not play it ..."); return; } if (ListEffects[effectId] == NULL) { @@ -371,7 +371,7 @@ void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy) } EWOL_VERBOSE("effect play : " << effectId ); // try to find an empty slot : - for (int32_t iii=0; iiiIsFree()) { ListEffectsPlaying[iii]->Reset(ListEffects[effectId]); return; @@ -382,7 +382,7 @@ void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy) EWOL_CRITICAL("Allocation error of a playing element : " << effectId); return; } - ListEffectsPlaying.PushBack(newPlay); + ListEffectsPlaying.push_back(newPlay); } @@ -429,7 +429,7 @@ void ewol::audio::effects::MuteSet(bool newMute) void ewol::audio::effects::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels) { - for (int32_t iii=0; iiiPlay(bufferInterlace, nbSample, nbChannels); } diff --git a/Sources/libewol/ewol/EObject.cpp b/Sources/libewol/ewol/EObject.cpp index f518928a..86465f27 100644 --- a/Sources/libewol/ewol/EObject.cpp +++ b/Sources/libewol/ewol/EObject.cpp @@ -38,20 +38,20 @@ extern "C" { }; // internal element of the widget manager : -static etk::VectorType m_messageList; // all widget allocated ==> all time increment ... never removed ... +static std::vector m_messageList; // all widget allocated ==> all time increment ... never removed ... void ewol::EObjectMessageMultiCast::Init(void) { EWOL_INFO("EObject message Multi-Cast"); - m_messageList.Clear(); + m_messageList.clear(); } void ewol::EObjectMessageMultiCast::UnInit(void) { EWOL_INFO("EObject message Multi-Cast"); - m_messageList.Clear(); + m_messageList.clear(); } @@ -68,7 +68,7 @@ static void MultiCastAdd(ewol::EObject* object, const char* const message) messageList_ts tmpMessage; tmpMessage.object = object; tmpMessage.message = message; - m_messageList.PushBack(tmpMessage); + m_messageList.push_back(tmpMessage); EWOL_DEBUG("SendMulticast ADD listener :" << object->GetId() << " on \"" << message << "\"" ); } @@ -80,12 +80,12 @@ static void MultiCastRm(ewol::EObject* object) return; } // send the message at all registered widget ... - for (int32_t iii=m_messageList.Size()-1; iii>=0; iii--) { + for (int32_t iii=m_messageList.size()-1; iii>=0; iii--) { if(m_messageList[iii].object == object) { EWOL_DEBUG("SendMulticast RM listener :" << object->GetId()); m_messageList[iii].message = NULL; m_messageList[iii].object = NULL; - m_messageList.Erase(iii); + m_messageList.erase(m_messageList.begin()+iii); } } } @@ -95,7 +95,7 @@ static void MultiCastSend(ewol::EObject* object, const char* const message, etk: EWOL_VERBOSE("SendMulticast message \"" << message << "\" data=\"" << data << "\" to :"); // send the message at all registered widget ... - for (int32_t iii=0; iiilocalEventId == generateEventId) { @@ -235,7 +235,7 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * destinationObject, const cha } // check if event existed : bool findIt = false; - for(int32_t iii=0; iiidestEventId = eventId; } - m_externEvent.PushBack(tmpEvent); + m_externEvent.push_back(tmpEvent); } @@ -278,11 +278,11 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * destinationObject, const cha */ void ewol::EObject::OnObjectRemove(ewol::EObject * removeObject) { - for(int32_t iii=m_externEvent.Size()-1; iii>=0; iii--) { + for(int32_t iii=m_externEvent.size()-1; iii>=0; iii--) { if (NULL==m_externEvent[iii]) { - m_externEvent.Erase(iii); + m_externEvent.erase(m_externEvent.begin()+iii); } else if (m_externEvent[iii]->destEObject == removeObject) { - m_externEvent.Erase(iii); + m_externEvent.erase(m_externEvent.begin()+iii); } } } diff --git a/Sources/libewol/ewol/EObject.h b/Sources/libewol/ewol/EObject.h index 49e00bac..9484edd3 100644 --- a/Sources/libewol/ewol/EObject.h +++ b/Sources/libewol/ewol/EObject.h @@ -27,7 +27,7 @@ #include #include -#include +#include namespace ewol { namespace EObjectMessageMultiCast { @@ -55,8 +55,8 @@ namespace ewol { class EObject { private: int32_t m_uniqueId; //!< Object UniqueID ==> TODO : Check if it use is needed - etk::VectorType m_externEvent; //!< Generic list of event generation for output link - etk::VectorType m_availlableEventId; //!< List of all event availlable for this widget + std::vector m_externEvent; //!< Generic list of event generation for output link + std::vector m_availlableEventId; //!< List of all event availlable for this widget public: /** * @brief Constructor diff --git a/Sources/libewol/ewol/EObjectManager.cpp b/Sources/libewol/ewol/EObjectManager.cpp index ec7c8b3f..697ee51e 100644 --- a/Sources/libewol/ewol/EObjectManager.cpp +++ b/Sources/libewol/ewol/EObjectManager.cpp @@ -31,8 +31,8 @@ static bool IsInit = false; // internal element of the widget manager : -static etk::VectorType m_eObjectList; // all widget allocated ==> all time increment ... never removed ... -static etk::VectorType m_eObjectDeletedList; // all widget allocated +static std::vector m_eObjectList; // all widget allocated ==> all time increment ... never removed ... +static std::vector m_eObjectDeletedList; // all widget allocated void ewol::EObjectManager::Init(void) @@ -40,8 +40,8 @@ void ewol::EObjectManager::Init(void) EWOL_DEBUG("==> Init EObject-Manager"); // Can create mlemory leak ... ==> but not predictable comportement otherwise ... // TODO : Check if we can do sotthing better - m_eObjectDeletedList.Clear(); - m_eObjectList.Clear(); + m_eObjectDeletedList.clear(); + m_eObjectList.clear(); IsInit = true; } @@ -53,11 +53,11 @@ void ewol::EObjectManager::UnInit(void) ewol::EObjectManager::RemoveAllMark(); } EWOL_INFO(" Remove missing user widget"); - while(0 this control the mutex Lock @@ -70,7 +70,7 @@ void ewol::EObjectManager::Add(ewol::EObject* object) { // TODO : Chek if not existed before ... if (NULL != object) { - m_eObjectList.PushBack(object); + m_eObjectList.push_back(object); } else { EWOL_ERROR("try to add an inexistant EObject in manager"); } @@ -82,18 +82,18 @@ void ewol::EObjectManager::Rm(ewol::EObject* object) EWOL_ERROR("Try to remove (NULL) EObject"); return; } - for (int32_t iii=0; iiiOnObjectRemove(object); } @@ -122,7 +122,7 @@ void ewol::EObjectManager::MarkToRemoved(ewol::EObject* object) } int32_t findId = -1; // check if the widget is not destroy : - for(int32_t iii=0; iii requested for EObject : [" << object->GetId() << "] type=" << object->GetObjectType()); return; } - m_eObjectList.Erase(findId); + m_eObjectList.erase(m_eObjectList.begin()+findId); EWOL_DEBUG("MarkToRemoved EObject : [" << object->GetId() << "] type=" << object->GetObjectType()); - m_eObjectDeletedList.PushBack(object); + m_eObjectDeletedList.push_back(object); // Informe all EObject to remove reference of this one ... informOneObjectIsRemoved(object); } @@ -143,9 +143,9 @@ void ewol::EObjectManager::MarkToRemoved(ewol::EObject* object) void ewol::EObjectManager::RemoveAllMark(void) { - etk::VectorType m_tmpList = m_eObjectDeletedList; + std::vector m_tmpList = m_eObjectDeletedList; // direct delete of the current list ... - for(int32_t iii=0; iii #include #include +#include namespace ewol @@ -57,27 +58,27 @@ namespace ewol clipping_ts & drawClipping, const etk::UString & unicodeString, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex); + std::vector > & coord, + std::vector & coordTex); int32_t DrawText(int32_t fontID, Vector2D textPos, clipping_ts & drawClipping, const uniChar_t unicodeChar, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex); + std::vector > & coord, + std::vector & coordTex); int32_t DrawText(int32_t fontID, Vector2D textPos, const etk::UString & unicodeString, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex); + std::vector > & coord, + std::vector & coordTex); int32_t DrawText(int32_t fontID, Vector2D textPos, const uniChar_t unicodeChar, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex); + std::vector > & coord, + std::vector & coordTex); int32_t LoadFont(etk::File fontFileName); }; diff --git a/Sources/libewol/ewol/FontFreeType.cpp b/Sources/libewol/ewol/FontFreeType.cpp index 422c6d8d..6d5e8d05 100644 --- a/Sources/libewol/ewol/FontFreeType.cpp +++ b/Sources/libewol/ewol/FontFreeType.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include extern "C" { @@ -220,7 +220,7 @@ class FTFontInternal } public: etk::UString GetFontName(void) {return m_fontName;}; - bool GenerateBitmapFont(int32_t size, int32_t &height, int32_t & textureId, etk::VectorType & listElement) + bool GenerateBitmapFont(int32_t size, int32_t &height, int32_t & textureId, std::vector & listElement) { // 300dpi (hight quality) 96 dpi (normal quality) int32_t fontQuality = 96; @@ -253,7 +253,7 @@ class FTFontInternal EWOL_DEBUG("metrics.horiAdvance=" << (slot->metrics.horiAdvance >> 6)); EWOL_DEBUG("metrics.vertAdvance=" << (slot->metrics.vertAdvance >> 6)); - int32_t nbElement = listElement.Size(); + int32_t nbElement = listElement.size(); int32_t coter = simpleSQRT(nbElement); // note : +1 is for the overlapping of the glyph (Part 1) int32_t glyphMaxWidth = /*(m_fftFace->max_advance_width>>6); */(slot->metrics.horiAdvance>>6) +1; @@ -285,7 +285,7 @@ class FTFontInternal int32_t tmpLineStartPos = 0; int32_t CurrentLineHigh = 0; // Generate for All Elements : - for (int32_t iii=0; iii m_listLoadedTTFont; +static std::vector m_listLoadedTTFont; static etk::UString s_currentFolderName = ""; @@ -390,7 +390,7 @@ class FTFont{ FTFont(etk::File fontfileName, etk::UString fontName, int32_t size) { m_trueTypeFontId = -1; - for (int32_t iii=0; iii < m_listLoadedTTFont.Size(); iii++) { + for (int32_t iii=0; iii < m_listLoadedTTFont.size(); iii++) { if (m_listLoadedTTFont[iii]->GetFontName() == fontName) { m_trueTypeFontId = iii; } @@ -398,19 +398,19 @@ class FTFont{ if (-1==m_trueTypeFontId) { // load a new one ... FTFontInternal * tmpElement = new FTFontInternal(fontfileName, fontName); - m_listLoadedTTFont.PushBack(tmpElement); - m_trueTypeFontId = m_listLoadedTTFont.Size() -1; + m_listLoadedTTFont.push_back(tmpElement); + m_trueTypeFontId = m_listLoadedTTFont.size() -1; } // set the bassic charset: - m_elements.Clear(); + m_elements.clear(); freeTypeFontElement_ts tmpchar1; tmpchar1.unicodeCharVal = 0; - m_elements.PushBack(tmpchar1); + m_elements.push_back(tmpchar1); // TODO : dynamic generation of this : expected minimum of 0x20 => 0x7F .... for (int32_t iii=0x20; iii<0xFF; iii++) { freeTypeFontElement_ts tmpchar; tmpchar.unicodeCharVal = iii; - m_elements.PushBack(tmpchar); + m_elements.push_back(tmpchar); if (0x7F == iii) { iii = 0x9F; } @@ -436,7 +436,7 @@ class FTFont{ return false; }; - etk::VectorType & GetRefOnElement(void) + std::vector & GetRefOnElement(void) { return m_elements; }; @@ -462,10 +462,10 @@ class FTFont{ int32_t m_size; // nb pixel height int32_t m_lineHeight; // nb pixel height int32_t m_interline; // nb pixel between 2 lines - etk::VectorType m_elements; // + std::vector m_elements; // }; -static etk::VectorType m_listLoadedFont; +static std::vector m_listLoadedFont; #undef __class__ #define __class__ "ewol::FontFreeType" @@ -490,7 +490,7 @@ void ewol::InitFont(void) // prevent android error ==> can create memory leak but I prefer s_currentFolderName = ""; s_currentDefaultFontName = ""; - m_listLoadedTTFont.Clear(); + m_listLoadedTTFont.clear(); s_currentDefaultFontId = -1; } @@ -508,21 +508,21 @@ void ewol::UnInitFont(void) s_currentDefaultFontId = -1; // unload global font - for(int32_t iii=0; iiiCheck(fontName, size)) { return iii; } } FTFont * tmpFont = new FTFont(fileName, fontName, size); - m_listLoadedFont.PushBack(tmpFont); - return m_listLoadedFont.Size()-1; + m_listLoadedFont.push_back(tmpFont); + return m_listLoadedFont.size()-1; } void ewol::UnloadFont(int32_t id) @@ -574,19 +574,19 @@ void ewol::UnloadFont(int32_t id) EWOL_TODO("I do not think it was a good idea... will be done later"); } -int32_t ewol::DrawText(int32_t fontID, - Vector2D textPos, - clipping_ts & drawClipping, - const etk::UString& unicodeString, - int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex) +int32_t ewol::DrawText(int32_t fontID, + Vector2D textPos, + clipping_ts & drawClipping, + const etk::UString& unicodeString, + int32_t & fontTextureId, + std::vector > & coord, + std::vector & coordTex) { - if(fontID>=m_listLoadedFont.Size() || fontID < 0) { + if(fontID>=m_listLoadedFont.size() || fontID < 0) { EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); return 0; } - etk::VectorType & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); + std::vector & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); fontTextureId = m_listLoadedFont[fontID]->GetOglId(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); @@ -603,7 +603,7 @@ int32_t ewol::DrawText(int32_t fontID, charIndex = tmpChar - 0x1F; } else { charIndex = 0; - for (int32_t iii=0x80-0x20; iii < listOfElement.Size(); iii++) { + for (int32_t iii=0x80-0x20; iii < listOfElement.size(); iii++) { if (listOfElement[iii].unicodeCharVal == tmpChar) { charIndex = iii; break; @@ -724,13 +724,13 @@ int32_t ewol::DrawText(int32_t fontID, * */ // set texture coordonates : - coordTex.PushBack(texturePos[0]); - coordTex.PushBack(texturePos[1]); - coordTex.PushBack(texturePos[2]); + coordTex.push_back(texturePos[0]); + coordTex.push_back(texturePos[1]); + coordTex.push_back(texturePos[2]); // set display positions : - coord.PushBack(bitmapDrawPos[0]); - coord.PushBack(bitmapDrawPos[1]); - coord.PushBack(bitmapDrawPos[2]); + coord.push_back(bitmapDrawPos[0]); + coord.push_back(bitmapDrawPos[1]); + coord.push_back(bitmapDrawPos[2]); /* Step 2 : * @@ -740,13 +740,13 @@ int32_t ewol::DrawText(int32_t fontID, * ******** */ // set texture coordonates : - coordTex.PushBack(texturePos[0]); - coordTex.PushBack(texturePos[2]); - coordTex.PushBack(texturePos[3]); + coordTex.push_back(texturePos[0]); + coordTex.push_back(texturePos[2]); + coordTex.push_back(texturePos[3]); // set display positions : - coord.PushBack(bitmapDrawPos[0]); - coord.PushBack(bitmapDrawPos[2]); - coord.PushBack(bitmapDrawPos[3]); + coord.push_back(bitmapDrawPos[0]); + coord.push_back(bitmapDrawPos[2]); + coord.push_back(bitmapDrawPos[3]); } } } @@ -758,20 +758,20 @@ int32_t ewol::DrawText(int32_t fontID, } // TODO : Simplify this ... -int32_t ewol::DrawText(int32_t fontID, - Vector2D textPos, - clipping_ts & drawClipping, - const uniChar_t unicodeChar, - int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex) +int32_t ewol::DrawText(int32_t fontID, + Vector2D textPos, + clipping_ts & drawClipping, + const uniChar_t unicodeChar, + int32_t & fontTextureId, + std::vector > & coord, + std::vector & coordTex) { #if 0 if(fontID>=m_listLoadedFont.Size() || fontID < 0) { EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); return 0; } - etk::VectorType & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); + std::vector & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); fontTextureId = m_listLoadedFont[fontID]->GetOglId(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); @@ -916,18 +916,18 @@ int32_t ewol::DrawText(int32_t fontID, } -int32_t ewol::DrawText(int32_t fontID, - Vector2D textPos, - const etk::UString& unicodeString, - int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex) +int32_t ewol::DrawText(int32_t fontID, + Vector2D textPos, + const etk::UString& unicodeString, + int32_t & fontTextureId, + std::vector > & coord, + std::vector & coordTex) { - if(fontID>=m_listLoadedFont.Size() || fontID < 0) { + if(fontID>=m_listLoadedFont.size() || fontID < 0) { EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); return 0; } - etk::VectorType & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); + std::vector & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); fontTextureId = m_listLoadedFont[fontID]->GetOglId(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); @@ -944,7 +944,7 @@ int32_t ewol::DrawText(int32_t fontID, charIndex = tmpChar - 0x1F; } else { charIndex = 0; - for (int32_t iii=0x80-0x20; iii < listOfElement.Size(); iii++) { + for (int32_t iii=0x80-0x20; iii < listOfElement.size(); iii++) { if (listOfElement[iii].unicodeCharVal == tmpChar) { charIndex = iii; break; @@ -1018,13 +1018,13 @@ int32_t ewol::DrawText(int32_t fontID, * */ // set texture coordonates : - coordTex.PushBack(texturePos[0]); - coordTex.PushBack(texturePos[1]); - coordTex.PushBack(texturePos[2]); + coordTex.push_back(texturePos[0]); + coordTex.push_back(texturePos[1]); + coordTex.push_back(texturePos[2]); // set display positions : - coord.PushBack(bitmapDrawPos[0]); - coord.PushBack(bitmapDrawPos[1]); - coord.PushBack(bitmapDrawPos[2]); + coord.push_back(bitmapDrawPos[0]); + coord.push_back(bitmapDrawPos[1]); + coord.push_back(bitmapDrawPos[2]); /* Step 2 : * @@ -1034,13 +1034,13 @@ int32_t ewol::DrawText(int32_t fontID, * ******** */ // set texture coordonates : - coordTex.PushBack(texturePos[0]); - coordTex.PushBack(texturePos[2]); - coordTex.PushBack(texturePos[3]); + coordTex.push_back(texturePos[0]); + coordTex.push_back(texturePos[2]); + coordTex.push_back(texturePos[3]); // set display positions : - coord.PushBack(bitmapDrawPos[0]); - coord.PushBack(bitmapDrawPos[2]); - coord.PushBack(bitmapDrawPos[3]); + coord.push_back(bitmapDrawPos[0]); + coord.push_back(bitmapDrawPos[2]); + coord.push_back(bitmapDrawPos[3]); } } @@ -1052,18 +1052,18 @@ int32_t ewol::DrawText(int32_t fontID, } // TODO : Simplify this ... -int32_t ewol::DrawText(int32_t fontID, - Vector2D textPos, - const uniChar_t unicodeChar, - int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex) +int32_t ewol::DrawText(int32_t fontID, + Vector2D textPos, + const uniChar_t unicodeChar, + int32_t & fontTextureId, + std::vector > & coord, + std::vector & coordTex) { - if(fontID>=m_listLoadedFont.Size() || fontID < 0) { + if(fontID>=m_listLoadedFont.size() || fontID < 0) { EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); return 0; } - etk::VectorType & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); + std::vector & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); fontTextureId = m_listLoadedFont[fontID]->GetOglId(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); @@ -1077,7 +1077,7 @@ int32_t ewol::DrawText(int32_t fontID, charIndex = unicodeChar - 0x1F; } else { charIndex = 0; - for (int32_t iii=0x80-0x20; iii < listOfElement.Size(); iii++) { + for (int32_t iii=0x80-0x20; iii < listOfElement.size(); iii++) { if (listOfElement[iii].unicodeCharVal == unicodeChar) { charIndex = iii; break; @@ -1149,13 +1149,13 @@ int32_t ewol::DrawText(int32_t fontID, * */ // set texture coordonates : - coordTex.PushBack(texturePos[0]); - coordTex.PushBack(texturePos[1]); - coordTex.PushBack(texturePos[2]); + coordTex.push_back(texturePos[0]); + coordTex.push_back(texturePos[1]); + coordTex.push_back(texturePos[2]); // set display positions : - coord.PushBack(bitmapDrawPos[0]); - coord.PushBack(bitmapDrawPos[1]); - coord.PushBack(bitmapDrawPos[2]); + coord.push_back(bitmapDrawPos[0]); + coord.push_back(bitmapDrawPos[1]); + coord.push_back(bitmapDrawPos[2]); /* Step 2 : * @@ -1165,13 +1165,13 @@ int32_t ewol::DrawText(int32_t fontID, * ******** */ // set texture coordonates : - coordTex.PushBack(texturePos[0]); - coordTex.PushBack(texturePos[2]); - coordTex.PushBack(texturePos[3]); + coordTex.push_back(texturePos[0]); + coordTex.push_back(texturePos[2]); + coordTex.push_back(texturePos[3]); // set display positions : - coord.PushBack(bitmapDrawPos[0]); - coord.PushBack(bitmapDrawPos[2]); - coord.PushBack(bitmapDrawPos[3]); + coord.push_back(bitmapDrawPos[0]); + coord.push_back(bitmapDrawPos[2]); + coord.push_back(bitmapDrawPos[3]); } } posDrawX += listOfElement[charIndex].advance; @@ -1183,11 +1183,11 @@ int32_t ewol::DrawText(int32_t fontID, int32_t ewol::GetWidth(int32_t fontID, const etk::UString& unicodeString) { - if(fontID>=m_listLoadedFont.Size() || fontID < 0) { + if(fontID>=m_listLoadedFont.size() || fontID < 0) { EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); return 0; } - etk::VectorType & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); + std::vector & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); float posDrawX = 0.0; for(int32_t iii=0; iii=m_listLoadedFont.Size() || fontID < 0) { + if(fontID>=m_listLoadedFont.size() || fontID < 0) { EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); return 10; } diff --git a/Sources/libewol/ewol/Game/GameElementLua.cpp b/Sources/libewol/ewol/Game/GameElementLua.cpp index a779acef..4885c947 100644 --- a/Sources/libewol/ewol/Game/GameElementLua.cpp +++ b/Sources/libewol/ewol/Game/GameElementLua.cpp @@ -33,9 +33,9 @@ //For every acces : -static ewol::GameElementLua * tmpObj = NULL; -static etk::VectorType * tmpSprite = NULL; -static ewol::SceneElement * tmpScene = NULL; +static ewol::GameElementLua * tmpObj = NULL; +static std::vector * tmpSprite = NULL; +static ewol::SceneElement * tmpScene = NULL; template int index(lua_State* L); @@ -398,9 +398,9 @@ LUAMOD_API int lua_ElementAdd(lua_State *L) etk::UString elementName = luaL_checkstring(L, 1); int32_t group = luaL_checkint(L, 2); // TODO : Remove this when find an other way do do it ... - ewol::GameElementLua * ttmpObj = tmpObj; - etk::VectorType * ttmpSprite = tmpSprite; - ewol::SceneElement * ttmpScene = tmpScene; + ewol::GameElementLua * ttmpObj = tmpObj; + std::vector * ttmpSprite = tmpSprite; + ewol::SceneElement * ttmpScene = tmpScene; uint32_t elementId = tmpScene->AddElementNamed(group, elementName); tmpObj = ttmpObj; tmpSprite = ttmpSprite; @@ -541,9 +541,9 @@ LUAMOD_API int lua_HaveImpact(lua_State *L) } // TODO : Remove this when find an other way do do it ... - ewol::GameElementLua * ttmpObj = tmpObj; - etk::VectorType * ttmpSprite = tmpSprite; - ewol::SceneElement * ttmpScene = tmpScene; + ewol::GameElementLua * ttmpObj = tmpObj; + std::vector * ttmpSprite = tmpSprite; + ewol::SceneElement * ttmpScene = tmpScene; bool result = tmpScene->HaveImpact(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), tmpObj->SizeGet()); @@ -565,9 +565,9 @@ LUAMOD_API int lua_Explosion(lua_State *L) } // TODO : Remove this when find an other way do do it ... - ewol::GameElementLua * ttmpObj = tmpObj; - etk::VectorType * ttmpSprite = tmpSprite; - ewol::SceneElement * ttmpScene = tmpScene; + ewol::GameElementLua * ttmpObj = tmpObj; + std::vector * ttmpSprite = tmpSprite; + ewol::SceneElement * ttmpScene = tmpScene; tmpScene->Explosion(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), 0.01, tmpObj->PowerGet()); diff --git a/Sources/libewol/ewol/Game/SceneElement.cpp b/Sources/libewol/ewol/Game/SceneElement.cpp index d2e14979..feed5950 100644 --- a/Sources/libewol/ewol/Game/SceneElement.cpp +++ b/Sources/libewol/ewol/Game/SceneElement.cpp @@ -57,37 +57,37 @@ ewol::SceneElement::~SceneElement(void) { EWOL_DEBUG("Remove sceane, allocated element : " << allocatedElements << " and retreive : " << retreviveElement); // clean all element allocated : - for (int32_t jjj=0; jjjname = name; tmpElement->userString = userString; tmpElement->loadElement = loadElement; - listCreatorElement.PushBack(tmpElement); + listCreatorElement.push_back(tmpElement); } @@ -112,15 +112,15 @@ void ewol::SceneElement::RmElement(int32_t group, int32_t idElement) EWOL_ERROR("group is wrong " << group << "!=[0," << MAX_GROUP_NUMBER << "]==> not rm at the system ..."); return; } - if (idElement < 0 || idElement >= listAnimatedElements[group].Size()) { - EWOL_ERROR("idElement is wrong " << idElement << "!=[0," << listAnimatedElements[group].Size() << "]==> not rm at the system ..."); + if (idElement < 0 || idElement >= listAnimatedElements[group].size()) { + EWOL_ERROR("idElement is wrong " << idElement << "!=[0," << listAnimatedElements[group].size() << "]==> not rm at the system ..."); return; } if (NULL == listAnimatedElements[group][idElement]) { return; } // try to find an empty slot : - for (int32_t iii=0; iiiUnInit(); - listGarbage.PushBack(listAnimatedElements[group][idElement]); + listGarbage.push_back(listAnimatedElements[group][idElement]); listAnimatedElements[group][idElement] = NULL; return; } @@ -147,7 +147,7 @@ uint32_t ewol::SceneElement::AddElement(int32_t group, ewol::GameElement* newEle // for statistic newElement->Init(); newElement->GroupSet(group); - for (int32_t iii=0; iii0) { - return createUniqueId(newElement->GetUniqueId(), listAnimatedElements[group].Size()-1); + listAnimatedElements[group].push_back(newElement); + if (listAnimatedElements[group].size()>0) { + return createUniqueId(newElement->GetUniqueId(), listAnimatedElements[group].size()-1); } else { return 0; } @@ -166,7 +166,7 @@ uint32_t ewol::SceneElement::AddElement(int32_t group, ewol::GameElement* newEle uint32_t ewol::SceneElement::AddElementNamed(int32_t group, etk::UString &elementName) { // try to fined it in the garbase : - for (int32_t iii=0; iiiHasName(elementName)) { @@ -180,7 +180,7 @@ uint32_t ewol::SceneElement::AddElementNamed(int32_t group, etk::UString &elemen } ewol::GameElement* newElement=NULL; // find in registered element - for (int32_t iii=0; iiiname == elementName) { @@ -205,7 +205,7 @@ ewol::GameElement* ewol::SceneElement::GetElement(uint32_t idElement) uint16_t realUniqueId = (uint16_t)((idElement >> 16 ) & 0x0000FFFF); uint16_t posInList = (uint16_t)(idElement & 0x0000FFFF); for (int32_t iii=0; iiiGetUniqueId()) { return listAnimatedElements[iii][posInList]; @@ -229,7 +229,7 @@ uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D position, int32_t g if (gId == groupId) { EWOL_ERROR("groupId=" << gId << " is ennemy of groupId:" << groupId); } - for (int32_t iii=0; iiiCanBeCibledGet()) { Vector2D tmpPos = listAnimatedElements[gId][iii]->PositionGet(); @@ -251,7 +251,7 @@ bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, Vector2D { for (int32_t jjj=0; jjjHaveImpact(group, type, position, size )) { return true; @@ -266,7 +266,7 @@ bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, Vector2D void ewol::SceneElement::Explosion(int32_t group, int32_t type, Vector2D position, float pxAtenuation, float power) { for (int32_t jjj=0; jjjExplosion(group, type, position, pxAtenuation, power) ) { RmElement(jjj, iii); @@ -282,7 +282,7 @@ uint32_t ewol::SceneElement::GetElementAtPos(Vector2D position, int32_t m uint32_t result = 0; float lastQuadDistance = 9999999999999999.0; for (int32_t jjj=0; jjj tmpPos = listAnimatedElements[jjj][iii]->PositionGet(); float distance = quadDist(position, tmpPos); @@ -324,7 +324,7 @@ void ewol::SceneElement::SetEventExternJoystick(uint32_t id, int32_t joyId, floa */ int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize) { - for (int32_t iii=0; iiiHasName(fileName) == true) { // count the number of element registered ... @@ -341,9 +341,9 @@ int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize) return -1; } // add it : - animated[iii].PushBack(tmpSprite); + animated[iii].push_back(tmpSprite); } - return animated[0].Size() -1; + return animated[0].size() -1; } /** @@ -354,7 +354,7 @@ int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize) */ void ewol::SceneElement::UnLoadSprite(int32_t spriteId) { - if (spriteId >= 0 && spriteId < animated[0].Size()) { + if (spriteId >= 0 && spriteId < animated[0].size()) { if (animated[0][spriteId] != NULL) { // count the number of element registered ... if (true == animated[0][spriteId]->DecreaseLoadedTime() ) { diff --git a/Sources/libewol/ewol/Game/SceneElement.h b/Sources/libewol/ewol/Game/SceneElement.h index b7fbe753..f99a9bb4 100644 --- a/Sources/libewol/ewol/Game/SceneElement.h +++ b/Sources/libewol/ewol/Game/SceneElement.h @@ -26,6 +26,7 @@ #define __EWOL_SCENE_ELEMENT_H__ #include +#include #include #include @@ -54,10 +55,10 @@ namespace ewol { int32_t numberOfGroup; //!< curent scene number of group etk::UString groupDescription[MAX_GROUP_NUMBER]; //!< name of all the groups int32_t groupEnemy[MAX_GROUP_NUMBER][MAX_GROUP_NUMBER]; //!< list of the ennemy - etk::VectorType animated[NB_BOUBLE_BUFFER]; //!< element that must be display the second - etk::VectorType listAnimatedElements[MAX_GROUP_NUMBER]; //!< generic element to display order in the diffferent group - etk::VectorType listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free - etk::VectorType listCreatorElement; //!< list of all creatable elements + std::vector animated[NB_BOUBLE_BUFFER]; //!< element that must be display the second + std::vector listAnimatedElements[MAX_GROUP_NUMBER]; //!< generic element to display order in the diffferent group + std::vector listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free + std::vector listCreatorElement; //!< list of all creatable elements int16_t GetUniqueId(void) { int16_t iddd = m_id; m_id++; return iddd; }; void RegisterElementType(etk::UString name, creatorElement_tf * loadElement, etk::UString userString); void RmElement(int32_t group, int32_t idElement); diff --git a/Sources/libewol/ewol/OObject.h b/Sources/libewol/ewol/OObject.h index 823d6934..6a4b9b8a 100644 --- a/Sources/libewol/ewol/OObject.h +++ b/Sources/libewol/ewol/OObject.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include namespace ewol { extern "C" { diff --git a/Sources/libewol/ewol/OObject/2DColored.cpp b/Sources/libewol/ewol/OObject/2DColored.cpp index e8532241..8497bbcb 100644 --- a/Sources/libewol/ewol/OObject/2DColored.cpp +++ b/Sources/libewol/ewol/OObject/2DColored.cpp @@ -40,14 +40,14 @@ ewol::OObject2DColored::OObject2DColored(void) ewol::OObject2DColored::~OObject2DColored(void) { - m_coord.Clear(); - m_coordColor.Clear(); + m_coord.clear(); + m_coordColor.clear(); } void ewol::OObject2DColored::Draw(void) { - if (m_coord.Size()<=0) { + if (m_coord.size()<=0) { return; } glPushMatrix(); @@ -62,7 +62,7 @@ void ewol::OObject2DColored::Draw(void) //glColorPointer(4, oglTypeFloat_t, 0, &m_coordColor[0] ); glColorPointer(4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] ); // Render : draw all of the triangles at once - glDrawArrays( GL_TRIANGLES, 0, m_coord.Size()); + glDrawArrays( GL_TRIANGLES, 0, m_coord.size()); //glDrawElements( GL_TRIANGLES, 0, m_coord.Size()); //EWOL_DEBUG("Draw ..." << m_coord.Size()/3 << " triangle(s)"); @@ -75,41 +75,41 @@ void ewol::OObject2DColored::Draw(void) void ewol::OObject2DColored::Clear(void) { - m_coord.Clear(); - m_coordColor.Clear(); + m_coord.clear(); + m_coordColor.clear(); } -void generatePolyGone(etk::VectorType > & input, etk::VectorType > & output ) +void generatePolyGone(std::vector > & input, std::vector > & output ) { - if (input.Size()<3) { + if (input.size()<3) { return; } // TODO : Regenerate a linear poligone generation - for (int32_t iii=1; iii " << output.Size() ); } -void SutherlandHodgman(etk::VectorType > & input, etk::VectorType > & output, float sx, float sy, float ex, float ey) +void SutherlandHodgman(std::vector > & input, std::vector > & output, float sx, float sy, float ex, float ey) { // with Sutherland-Hodgman-Algorithm - if (input.Size() <0) { + if (input.size() <=0) { return; } //int32_t sizeInit=input.Size(); // last element : Vector2D destPoint; - Vector2D lastElement = input[input.Size()-1]; + Vector2D lastElement = input[input.size()-1]; bool inside = true; if (lastElement.x < sx) { inside = false; } //EWOL_DEBUG("generate an crop : "); - for(int32_t iii=0; iii OUT "); @@ -119,7 +119,7 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp float bbb = lastElement.y - (aaa*lastElement.x); destPoint.y = aaa*sx + bbb; destPoint.x = sx; - output.PushBack(destPoint); + output.push_back(destPoint); } else { //EWOL_DEBUG("element OUT ==> OUT "); } @@ -127,7 +127,7 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp } else { if(true == inside) { //EWOL_DEBUG("element IN ==> IN "); - output.PushBack(input[iii]); + output.push_back(input[iii]); } else { //EWOL_DEBUG("element OUT ==> IN "); //new point intersection ... @@ -136,8 +136,8 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp float bbb = lastElement.y - (aaa*lastElement.x); destPoint.y = aaa*sx + bbb; destPoint.x = sx; - output.PushBack(destPoint); - output.PushBack(input[iii]); + output.push_back(destPoint); + output.push_back(input[iii]); } inside = true; } @@ -148,13 +148,13 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp //EWOL_DEBUG("generate an crop on element : " << sizeInit << " ==> " << output.Size() << "intermediate (1)"); input = output; - output.Clear(); - lastElement = input[input.Size()-1]; + output.clear(); + lastElement = input[input.size()-1]; inside = true; if (lastElement.y < sy) { inside = false; } - for(int32_t iii=0; iii OUT "); @@ -164,7 +164,7 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp float bbb = lastElement.x - (aaa*lastElement.y); destPoint.y = sy; destPoint.x = sy*aaa + bbb; - output.PushBack(destPoint); + output.push_back(destPoint); } else { //EWOL_DEBUG("element OUT ==> OUT "); } @@ -172,7 +172,7 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp } else { if(true == inside) { //EWOL_DEBUG("element IN ==> IN "); - output.PushBack(input[iii]); + output.push_back(input[iii]); } else { //EWOL_DEBUG("element OUT ==> IN "); //new point intersection ... @@ -181,8 +181,8 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp float bbb = lastElement.x - (aaa*lastElement.y); destPoint.y = sy; destPoint.x = sy*aaa + bbb; - output.PushBack(destPoint); - output.PushBack(input[iii]); + output.push_back(destPoint); + output.push_back(input[iii]); } inside = true; } @@ -192,14 +192,14 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp } input = output; - output.Clear(); - lastElement = input[input.Size()-1]; + output.clear(); + lastElement = input[input.size()-1]; inside = true; if (lastElement.x > ex) { inside = false; } //EWOL_DEBUG("generate an crop : "); - for(int32_t iii=0; iii ex) { if(true == inside) { //EWOL_DEBUG("element IN ==> OUT "); @@ -209,7 +209,7 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp float bbb = lastElement.y - (aaa*lastElement.x); destPoint.y = aaa*ex + bbb; destPoint.x = ex; - output.PushBack(destPoint); + output.push_back(destPoint); } else { //EWOL_DEBUG("element OUT ==> OUT "); } @@ -217,7 +217,7 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp } else { if(true == inside) { //EWOL_DEBUG("element IN ==> IN "); - output.PushBack(input[iii]); + output.push_back(input[iii]); } else { //EWOL_DEBUG("element OUT ==> IN "); //new point intersection ... @@ -226,8 +226,8 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp float bbb = lastElement.y - (aaa*lastElement.x); destPoint.y = aaa*ex + bbb; destPoint.x = ex; - output.PushBack(destPoint); - output.PushBack(input[iii]); + output.push_back(destPoint); + output.push_back(input[iii]); } inside = true; } @@ -237,13 +237,13 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp } input = output; - output.Clear(); - lastElement = input[input.Size()-1]; + output.clear(); + lastElement = input[input.size()-1]; inside = true; if (lastElement.y > ey) { inside = false; } - for(int32_t iii=0; iii ey) { if(true == inside) { //EWOL_DEBUG("element IN ==> OUT "); @@ -253,7 +253,7 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp float bbb = lastElement.x - (aaa*lastElement.y); destPoint.y = ey; destPoint.x = ey*aaa + bbb; - output.PushBack(destPoint); + output.push_back(destPoint); } else { //EWOL_DEBUG("element OUT ==> OUT "); } @@ -261,7 +261,7 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp } else { if(true == inside) { //EWOL_DEBUG("element IN ==> IN "); - output.PushBack(input[iii]); + output.push_back(input[iii]); } else { //EWOL_DEBUG("element OUT ==> IN "); //new point intersection ... @@ -270,8 +270,8 @@ void SutherlandHodgman(etk::VectorType > & input, etk::VectorTyp float bbb = lastElement.x - (aaa*lastElement.y); destPoint.y = ey; destPoint.x = ey*aaa + bbb; - output.PushBack(destPoint); - output.PushBack(input[iii]); + output.push_back(destPoint); + output.push_back(input[iii]); } inside = true; } @@ -289,12 +289,12 @@ void ewol::OObject2DColored::GenerateTriangle(void) { m_triElement = 0; - m_coord.PushBack(m_triangle[0]); - m_coordColor.PushBack(m_color[0]); - m_coord.PushBack(m_triangle[1]); - m_coordColor.PushBack(m_color[1]); - m_coord.PushBack(m_triangle[2]); - m_coordColor.PushBack(m_color[2]); + m_coord.push_back(m_triangle[0]); + m_coordColor.push_back(m_color[0]); + m_coord.push_back(m_triangle[1]); + m_coordColor.push_back(m_color[1]); + m_coord.push_back(m_triangle[2]); + m_coordColor.push_back(m_color[2]); } diff --git a/Sources/libewol/ewol/OObject/2DColored.h b/Sources/libewol/ewol/OObject/2DColored.h index ccebea7f..3da6a71c 100644 --- a/Sources/libewol/ewol/OObject/2DColored.h +++ b/Sources/libewol/ewol/OObject/2DColored.h @@ -36,9 +36,9 @@ namespace ewol { public: virtual void Draw(void); protected: - etk::VectorType > m_coord; //!< internal coord of the object - etk::VectorType m_coordColor; //!< internal color of the different point - //etk::VectorType m_linkCoord; //!< internal link between point to generate triangle + std::vector > m_coord; //!< internal coord of the object + std::vector m_coordColor; //!< internal color of the different point + //std::vector m_linkCoord; //!< internal link between point to generate triangle int32_t m_triElement; color_ts m_color[3]; Vector2D m_triangle[3]; diff --git a/Sources/libewol/ewol/OObject/2DText.cpp b/Sources/libewol/ewol/OObject/2DText.cpp index 72a45ed9..c1f275ee 100644 --- a/Sources/libewol/ewol/OObject/2DText.cpp +++ b/Sources/libewol/ewol/OObject/2DText.cpp @@ -58,7 +58,7 @@ ewol::OObject2DText::~OObject2DText(void) void ewol::OObject2DText::Draw(void) { - if (m_coord.Size()<=0) { + if (m_coord.size()<=0) { // TODO : a remètre ... //EWOL_WARNING("Nothink to draw..."); return; @@ -70,7 +70,7 @@ void ewol::OObject2DText::Draw(void) glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] ); glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] ); - glDrawArrays( GL_TRIANGLES, 0, m_coord.Size()); + glDrawArrays( GL_TRIANGLES, 0, m_coord.size()); //EWOL_DEBUG("request draw of " << m_coord.Size() << " elements"); glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays @@ -79,8 +79,8 @@ void ewol::OObject2DText::Draw(void) void ewol::OObject2DText::Clear(void) { - m_coord.Clear(); - m_coordTex.Clear(); + m_coord.clear(); + m_coordTex.clear(); } int32_t ewol::OObject2DText::Text(Vector2D textPos, clipping_ts drawClipping, const etk::UString& unicodeString) diff --git a/Sources/libewol/ewol/OObject/2DText.h b/Sources/libewol/ewol/OObject/2DText.h index 6a5f7c80..f47ec80d 100644 --- a/Sources/libewol/ewol/OObject/2DText.h +++ b/Sources/libewol/ewol/OObject/2DText.h @@ -45,8 +45,8 @@ namespace ewol { int32_t m_FontId; //!< font internal ID color_ts m_textColorFg; //!< text color ... int32_t m_FontTextureId; //!< font internal Texture ID - etk::VectorType > m_coord; //!< internal coord of the object - etk::VectorType m_coordTex; //!< internal texture coordinate for every point + std::vector > m_coord; //!< internal coord of the object + std::vector m_coordTex; //!< internal texture coordinate for every point }; }; diff --git a/Sources/libewol/ewol/OObject/2DTextColored.cpp b/Sources/libewol/ewol/OObject/2DTextColored.cpp index 19328f8a..8fb4dafb 100644 --- a/Sources/libewol/ewol/OObject/2DTextColored.cpp +++ b/Sources/libewol/ewol/OObject/2DTextColored.cpp @@ -71,7 +71,7 @@ ewol::OObject2DTextColored::~OObject2DTextColored(void) void ewol::OObject2DTextColored::Draw(void) { - if (m_coord.Size()<=0) { + if (m_coord.size()<=0) { // TODO : a remètre ... //EWOL_WARNING("Nothink to draw..."); return; @@ -84,7 +84,7 @@ void ewol::OObject2DTextColored::Draw(void) glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] ); glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] ); glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] ); - glDrawArrays( GL_TRIANGLES, 0, m_coord.Size()); + glDrawArrays( GL_TRIANGLES, 0, m_coord.size()); //EWOL_DEBUG("request draw of " << m_coord.Size() << " elements"); glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays @@ -94,9 +94,9 @@ void ewol::OObject2DTextColored::Draw(void) void ewol::OObject2DTextColored::Clear(void) { - m_coord.Clear(); - m_coordTex.Clear(); - m_coordColor.Clear(); + m_coord.clear(); + m_coordTex.clear(); + m_coordColor.clear(); } int32_t ewol::OObject2DTextColored::Text(Vector2D textPos, const etk::UString& unicodeString) @@ -106,15 +106,15 @@ int32_t ewol::OObject2DTextColored::Text(Vector2D textPos, const etk::USt EWOL_ERROR("Font Id is not corectly defined"); return 0; } - int32_t nbElementInTheArray = m_coord.Size(); + int32_t nbElementInTheArray = m_coord.size(); int32_t size = 0; if (true==m_hasClipping) { size = ewol::DrawText(m_FontId, textPos, m_clipping, unicodeString, m_FontTextureId, m_coord, m_coordTex); } else { size = ewol::DrawText(m_FontId, textPos, unicodeString, m_FontTextureId, m_coord, m_coordTex); } - for (int32_t iii=nbElementInTheArray; iii textPos, const uniChar_ EWOL_ERROR("Font Id is not corectly defined"); return 0; } - int32_t nbElementInTheArray = m_coord.Size(); + int32_t nbElementInTheArray = m_coord.size(); int32_t size = 0; if (true==m_hasClipping) { size = ewol::DrawText(m_FontId, textPos, m_clipping, unicodeChar, m_FontTextureId, m_coord, m_coordTex); } else { size = ewol::DrawText(m_FontId, textPos, unicodeChar, m_FontTextureId, m_coord, m_coordTex); } - for (int32_t iii=nbElementInTheArray; iii > m_coord; //!< internal coord of the object - etk::VectorType m_coordTex; //!< internal texture coordinate for every point - etk::VectorType m_coordColor; //!< internal color of the different point + std::vector > m_coord; //!< internal coord of the object + std::vector m_coordTex; //!< internal texture coordinate for every point + std::vector m_coordColor; //!< internal color of the different point public: void SetFontID(int32_t fontID) { m_FontId = fontID; }; int32_t GetFontID(void) { return m_FontId; }; diff --git a/Sources/libewol/ewol/OObject/2DTextured.cpp b/Sources/libewol/ewol/OObject/2DTextured.cpp index d965f12c..e75168ac 100644 --- a/Sources/libewol/ewol/OObject/2DTextured.cpp +++ b/Sources/libewol/ewol/OObject/2DTextured.cpp @@ -52,7 +52,7 @@ ewol::OObject2DTextured::~OObject2DTextured(void) void ewol::OObject2DTextured::Draw(void) { - if (m_coord.Size()<=0) { + if (m_coord.size()<=0) { return; } if (m_textureId == -1) { @@ -69,7 +69,7 @@ void ewol::OObject2DTextured::Draw(void) glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] ); glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] ); glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] ); - glDrawArrays( GL_TRIANGLES, 0, m_coord.Size()); + glDrawArrays( GL_TRIANGLES, 0, m_coord.size()); //EWOL_DEBUG("request draw of " << m_coord.Size() << " elements"); glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays @@ -79,9 +79,9 @@ void ewol::OObject2DTextured::Draw(void) void ewol::OObject2DTextured::Clear(void) { - m_coord.Clear(); - m_coordTex.Clear(); - m_coordColor.Clear(); + m_coord.clear(); + m_coordTex.clear(); + m_coordColor.clear(); } void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, color_ts tmpColor) @@ -99,45 +99,45 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa tex.v = texSY; point.x = x; point.y = y; - m_coord.PushBack(point); - m_coordTex.PushBack(tex); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(tex); + m_coordColor.push_back(tmpColor); tex.u = texSX; tex.v = texSY; point.x = x + w; point.y = y; - m_coord.PushBack(point); - m_coordTex.PushBack(tex); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(tex); + m_coordColor.push_back(tmpColor); tex.u = texSX; tex.v = texY; point.x = x + w; point.y = y + h; - m_coord.PushBack(point); - m_coordTex.PushBack(tex); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(tex); + m_coordColor.push_back(tmpColor); - m_coord.PushBack(point); - m_coordTex.PushBack(tex); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(tex); + m_coordColor.push_back(tmpColor); tex.u = texX; tex.v = texY; point.x = x; point.y = y + h; - m_coord.PushBack(point); - m_coordTex.PushBack(tex); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(tex); + m_coordColor.push_back(tmpColor); tex.u = texX; tex.v = texSY; point.x = x; point.y = y; - m_coord.PushBack(point); - m_coordTex.PushBack(tex); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(tex); + m_coordColor.push_back(tmpColor); } diff --git a/Sources/libewol/ewol/OObject/2DTextured.h b/Sources/libewol/ewol/OObject/2DTextured.h index 7c428b25..5c87f9b2 100644 --- a/Sources/libewol/ewol/OObject/2DTextured.h +++ b/Sources/libewol/ewol/OObject/2DTextured.h @@ -40,10 +40,10 @@ namespace ewol { void Rectangle(float x, float y, float w, float h, float texX=0.0, float texY=0.0, float texSX=1.0, float texSY=1.0, color_ts tmpColor=0xFFFFFFFF); void Rectangle(float x, float y, float w, float h, color_ts tmpColor); protected: - int32_t m_textureId; //!< texture internal ID - etk::VectorType > m_coord; //!< internal coord of the object - etk::VectorType m_coordTex; //!< internal texture coordinate for every point - etk::VectorType m_coordColor; //!< internal color of the different point + int32_t m_textureId; //!< texture internal ID + std::vector > m_coord; //!< internal coord of the object + std::vector m_coordTex; //!< internal texture coordinate for every point + std::vector m_coordColor; //!< internal color of the different point }; }; diff --git a/Sources/libewol/ewol/OObject/Sprite.cpp b/Sources/libewol/ewol/OObject/Sprite.cpp index f61fbf27..e62fbfc0 100644 --- a/Sources/libewol/ewol/OObject/Sprite.cpp +++ b/Sources/libewol/ewol/OObject/Sprite.cpp @@ -56,7 +56,7 @@ ewol::Sprite::~Sprite(void) void ewol::Sprite::Draw(void) { - if (m_coord.Size()<=0) { + if (m_coord.size()<=0) { //EWOL_WARNING("Nothink to draw..."); return; } @@ -73,7 +73,7 @@ void ewol::Sprite::Draw(void) glVertexPointer( 3, GL_FLOAT, 0, &m_coord[0] ); glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] ); glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] ); - glDrawArrays( GL_TRIANGLES, 0, m_coord.Size()); + glDrawArrays( GL_TRIANGLES, 0, m_coord.size()); //EWOL_DEBUG("request draw of " << m_coord.Size() << " elements"); glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays @@ -83,9 +83,9 @@ void ewol::Sprite::Draw(void) void ewol::Sprite::Clear(void) { - m_coord.Clear(); - m_coordTex.Clear(); - m_coordColor.Clear(); + m_coord.clear(); + m_coordTex.clear(); + m_coordColor.clear(); } void ewol::Sprite::Element(Vector2D pos, float size, float angle) @@ -134,36 +134,36 @@ void ewol::Sprite::Element(Vector3D pos, float size, float angle, color_t point.x = xxxCos + pos.x; point.y = yyySin + pos.y; - m_coord.PushBack(point); - m_coordTex.PushBack(texB); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(texB); + m_coordColor.push_back(tmpColor); point.x = yyySin + pos.x; point.y = -xxxCos + pos.y; - m_coord.PushBack(point); - m_coordTex.PushBack(texC); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(texC); + m_coordColor.push_back(tmpColor); point.x = -xxxCos + pos.x; point.y = -yyySin + pos.y; - m_coord.PushBack(point); - m_coordTex.PushBack(texD); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(texD); + m_coordColor.push_back(tmpColor); - m_coord.PushBack(point); - m_coordTex.PushBack(texD); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(texD); + m_coordColor.push_back(tmpColor); point.x = -yyySin + pos.x; point.y = xxxCos + pos.y; - m_coord.PushBack(point); - m_coordTex.PushBack(texA); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(texA); + m_coordColor.push_back(tmpColor); point.x = xxxCos + pos.x; point.y = yyySin + pos.y; - m_coord.PushBack(point); - m_coordTex.PushBack(texB); - m_coordColor.PushBack(tmpColor); + m_coord.push_back(point); + m_coordTex.push_back(texB); + m_coordColor.push_back(tmpColor); } diff --git a/Sources/libewol/ewol/OObject/Sprite.h b/Sources/libewol/ewol/OObject/Sprite.h index 283fa550..2bbbaf4f 100644 --- a/Sources/libewol/ewol/OObject/Sprite.h +++ b/Sources/libewol/ewol/OObject/Sprite.h @@ -44,10 +44,10 @@ namespace ewol { void Element(Vector3D pos, float size, float angle, color_ts tmpColor); bool HasName(etk::UString& name) { return name == m_name; }; protected: - int32_t m_textureId; //!< texture internal ID - etk::VectorType > m_coord; //!< internal coord of the object - etk::VectorType m_coordTex; //!< internal texture coordinate for every point - etk::VectorType m_coordColor; //!< internal color of the different point + int32_t m_textureId; //!< texture internal ID + std::vector > m_coord; //!< internal coord of the object + std::vector m_coordTex; //!< internal texture coordinate for every point + std::vector m_coordColor; //!< internal color of the different point }; }; diff --git a/Sources/libewol/ewol/ShortCutManager.cpp b/Sources/libewol/ewol/ShortCutManager.cpp index a0ec7753..4bb4f76f 100644 --- a/Sources/libewol/ewol/ShortCutManager.cpp +++ b/Sources/libewol/ewol/ShortCutManager.cpp @@ -39,7 +39,7 @@ class EventShortCut { uniChar_t UnicodeValue; }; -static etk::VectorType l_inputShortCutEvent; //!< generic short-cut event +static std::vector l_inputShortCutEvent; //!< generic short-cut event void ewol::shortCut::Add(bool shift, bool control, bool alt, bool meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString data) @@ -56,7 +56,7 @@ void ewol::shortCut::Add(bool shift, bool control, bool alt, bool meta, uniChar_ newEvent->meta = meta; newEvent->UnicodeValue = unicodeValue; newEvent->eventData = data; - l_inputShortCutEvent.PushBack(newEvent); + l_inputShortCutEvent.push_back(newEvent); return; } @@ -100,25 +100,25 @@ void ewol::shortCut::Add(const char * descriptiveString, const char * generateEv void ewol::shortCut::Init(void) { - if (l_inputShortCutEvent.Size()>0) { + if (l_inputShortCutEvent.size()>0) { EWOL_WARNING("Old element error in the shortCut system"); - for(int32_t iii=0; iii< l_inputShortCutEvent.Size(); iii++) { + for(int32_t iii=0; iii< l_inputShortCutEvent.size(); iii++) { delete(l_inputShortCutEvent[iii]); l_inputShortCutEvent[iii] = NULL; } } - l_inputShortCutEvent.Clear(); + l_inputShortCutEvent.clear(); } void ewol::shortCut::UnInit(void) { - if (l_inputShortCutEvent.Size()>0) { - for(int32_t iii=0; iii< l_inputShortCutEvent.Size(); iii++) { + if (l_inputShortCutEvent.size()>0) { + for(int32_t iii=0; iii< l_inputShortCutEvent.size(); iii++) { delete(l_inputShortCutEvent[iii]); l_inputShortCutEvent[iii] = NULL; } } - l_inputShortCutEvent.Clear(); + l_inputShortCutEvent.clear(); } @@ -129,7 +129,7 @@ bool ewol::shortCut::Process(bool shift, bool control, bool alt, bool meta, uniC unicodeValue += 'a' - 'A'; } //EWOL_INFO("Try to find generic shortcut ..."); - for(int32_t iii=l_inputShortCutEvent.Size()-1; iii>=0; iii--) { + for(int32_t iii=l_inputShortCutEvent.size()-1; iii>=0; iii--) { if( l_inputShortCutEvent[iii]->shift == shift && l_inputShortCutEvent[iii]->control == control && l_inputShortCutEvent[iii]->alt == alt diff --git a/Sources/libewol/ewol/Texture.cpp b/Sources/libewol/ewol/Texture.cpp index 5fe29b11..629266d4 100644 --- a/Sources/libewol/ewol/Texture.cpp +++ b/Sources/libewol/ewol/Texture.cpp @@ -53,7 +53,7 @@ class LoadedTexture bool m_destroy; }; //! List of all Texture loaded ... -etk::VectorType l_listLoadedTexture; +std::vector l_listLoadedTexture; #undef __class__ #define __class__ "texture" @@ -82,13 +82,13 @@ void ewol::texture::UnInit(void) { pthread_mutex_lock(&localMutex); EWOL_DEBUG("==> Un-Init Texture-Manager"); - for (int32_t iii=0; iiim_data) { @@ -131,7 +131,7 @@ void ewol::texture::UpdateContext(void) { bool needRedraw = false; pthread_mutex_lock(&localMutex); - for (int32_t iii=0; iii < l_listLoadedTexture.Size(); iii++) { + for (int32_t iii=0; iii < l_listLoadedTexture.size(); iii++) { if( NULL != l_listLoadedTexture[iii] && NULL != l_listLoadedTexture[iii]->m_data) { @@ -241,8 +241,8 @@ int32_t ewol::texture::Load(int32_t target, int32_t level, int32_t internalForma memcpy(tmpTex->m_data, data, sizeof(char) * tmpTex->m_nbBytes); pthread_mutex_lock(&localMutex); - l_listLoadedTexture.PushBack(tmpTex); - outTextureID = l_listLoadedTexture.Size()-1; + l_listLoadedTexture.push_back(tmpTex); + outTextureID = l_listLoadedTexture.size()-1; pthread_mutex_unlock(&localMutex); return outTextureID; } @@ -279,8 +279,8 @@ static int32_t nextP2(int32_t value) int32_t ewol::texture::Load(etk::UString tmpfileName, int32_t requestedWidth) { int32_t outTextureID = -1; - if (l_listLoadedTexture.Size()!=0) { - for (int32_t iii=0; iiim_filename == tmpfileName) { l_listLoadedTexture[iii]->m_nbTimeLoaded++; @@ -352,7 +352,7 @@ int32_t ewol::texture::Load(etk::UString tmpfileName, int32_t requestedWidth) void ewol::texture::UnLoad(uint32_t textureID) { //EWOL_INFO("Unload a specific tecture ID=" << textureID); - if ((int32_t)textureIDm_openGlTextureID; } return 0; @@ -389,7 +389,7 @@ uint32_t ewol::texture::GetGLID(uint32_t textureID) */ int32_t ewol::texture::GetSize(uint32_t textureID) { - for (int32_t iii=0; iiim_openGlTextureID == textureID) { return l_listLoadedTexture[iii]->m_width; } diff --git a/Sources/libewol/ewol/Widget.h b/Sources/libewol/ewol/Widget.h index 7d891e90..5414b179 100644 --- a/Sources/libewol/ewol/Widget.h +++ b/Sources/libewol/ewol/Widget.h @@ -33,7 +33,6 @@ namespace ewol { class Widget; }; #include -#include #include #include #include diff --git a/Sources/libewol/ewol/WidgetManager.cpp b/Sources/libewol/ewol/WidgetManager.cpp index b29528b8..6c0dc844 100644 --- a/Sources/libewol/ewol/WidgetManager.cpp +++ b/Sources/libewol/ewol/WidgetManager.cpp @@ -27,7 +27,7 @@ #include #include //#include -#include +#include #undef __class__ #define __class__ "WidgetManager" @@ -38,8 +38,8 @@ static bool IsInit = false; // For the focus Management static ewol::Widget * m_focusWidgetDefault = NULL; static ewol::Widget * m_focusWidgetCurrent = NULL; -static etk::VectorType l_listOfPeriodicWidget; -static bool l_havePeriodic = false; +static std::vector l_listOfPeriodicWidget; +static bool l_havePeriodic = false; void ewol::widgetManager::Init(void) { @@ -50,7 +50,7 @@ void ewol::widgetManager::Init(void) // prevent android error ==> can create memory leak but I prefer m_focusWidgetDefault = NULL; m_focusWidgetCurrent = NULL; - l_listOfPeriodicWidget.Clear(); + l_listOfPeriodicWidget.clear(); l_havePeriodic = false; // init all the widget global parameters : ewol::WIDGET_JoystickInit(); @@ -69,7 +69,7 @@ void ewol::widgetManager::UnInit(void) IsInit = false; - l_listOfPeriodicWidget.Clear(); + l_listOfPeriodicWidget.clear(); int ret = pthread_mutex_destroy(&localMutex); EWOL_ASSERT(ret == 0, "Error destroying Mutex ..."); } @@ -170,25 +170,25 @@ void ewol::widgetManager::FocusRemoveIfRemove(ewol::Widget * newWidget) void ewol::widgetManager::PeriodicCallAdd(ewol::Widget * pWidget) { - for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) { + for (int32_t iii=0; iii < l_listOfPeriodicWidget.size(); iii++) { if (l_listOfPeriodicWidget[iii] == pWidget) { return; } } - for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) { + for (int32_t iii=0; iii < l_listOfPeriodicWidget.size(); iii++) { if (NULL == l_listOfPeriodicWidget[iii]) { l_listOfPeriodicWidget[iii] = pWidget; return; } } - l_listOfPeriodicWidget.PushBack(pWidget); + l_listOfPeriodicWidget.push_back(pWidget); l_havePeriodic = true; } void ewol::widgetManager::PeriodicCallRm(ewol::Widget * pWidget) { int32_t nbElement = 0; - for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) { + for (int32_t iii=0; iii < l_listOfPeriodicWidget.size(); iii++) { if (l_listOfPeriodicWidget[iii] == pWidget) { l_listOfPeriodicWidget[iii] = NULL; } else { @@ -202,7 +202,7 @@ void ewol::widgetManager::PeriodicCallRm(ewol::Widget * pWidget) void ewol::widgetManager::PeriodicCall(int64_t localTime) { - for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) { + for (int32_t iii=0; iii < l_listOfPeriodicWidget.size(); iii++) { if (NULL != l_listOfPeriodicWidget[iii]) { l_listOfPeriodicWidget[iii]->PeriodicCall(localTime); } diff --git a/Sources/libewol/ewol/WidgetManager.h b/Sources/libewol/ewol/WidgetManager.h index 0e48616f..81d16283 100644 --- a/Sources/libewol/ewol/WidgetManager.h +++ b/Sources/libewol/ewol/WidgetManager.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include namespace ewol { diff --git a/Sources/libewol/ewol/Windows.cpp b/Sources/libewol/ewol/Windows.cpp index bf2e2d26..c0a53c51 100644 --- a/Sources/libewol/ewol/Windows.cpp +++ b/Sources/libewol/ewol/Windows.cpp @@ -61,13 +61,13 @@ ewol::Windows::~Windows(void) m_subWidget[m_currentCreateId]=NULL; } - for(int32_t iii=0; iiiMarkToRemove(); m_popUpWidgetList[m_currentCreateId][iii]=NULL; } } - m_popUpWidgetList[m_currentCreateId].Clear(); + m_popUpWidgetList[m_currentCreateId].clear(); } @@ -82,7 +82,7 @@ bool ewol::Windows::CalculateSize(float availlableX, float availlableY) // TODO : Herited from MinSize .. and expand ??? m_subWidget[m_currentCreateId]->CalculateSize(m_size.x, m_size.y); } - for(int32_t iii=0; iiiCalculateMinSize(); m_popUpWidgetList[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y); @@ -102,11 +102,11 @@ ewol::Widget * ewol::Windows::GetWidgetAtPos(Vector2D pos) // calculate relative position Vector2D relativePos = RelativePosition(pos); // event go directly on the pop-up - if (0 < m_popUpWidgetList[m_currentCreateId].Size()) { - if (NULL == m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].Size()-1]) { - m_popUpWidgetList[m_currentCreateId].PopBack(); + if (0 < m_popUpWidgetList[m_currentCreateId].size()) { + if (NULL == m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].size()-1]) { + m_popUpWidgetList[m_currentCreateId].pop_back(); } else { - return m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].Size()-1]->GetWidgetAtPos(pos); + return m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].size()-1]->GetWidgetAtPos(pos); } // otherwise in the normal windows } else if (NULL != m_subWidget[m_currentCreateId]) { @@ -143,7 +143,7 @@ void ewol::Windows::OnRegenerateDisplay(void) if (NULL != m_subWidget[m_currentCreateId]) { m_subWidget[m_currentCreateId]->OnRegenerateDisplay(); } - for(int32_t iii=0; iiiOnRegenerateDisplay(); } @@ -165,7 +165,7 @@ void ewol::Windows::OnDraw(ewol::DrawProperty& displayProp) //EWOL_DEBUG("Draw Windows"); } // second display the pop-up - for(int32_t iii=0; iiiGenDraw(displayProp); //EWOL_DEBUG("Draw Pop-up"); @@ -191,7 +191,7 @@ void ewol::Windows::SetSubWidget(ewol::Widget * widget) void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget) { - m_popUpWidgetList[m_currentCreateId].PushBack(widget); + m_popUpWidgetList[m_currentCreateId].push_back(widget); // Regenerate the size calculation : CalculateSize(m_size.x, m_size.y); m_needFlipFlop = true; @@ -218,7 +218,7 @@ void ewol::Windows::OnFlipFlopEvent(void) if (NULL != m_subWidget[m_currentDrawId]) { m_subWidget[m_currentDrawId]->OnFlipFlopEvent(); } - for(int32_t iii=0; iiiOnFlipFlopEvent(); } @@ -242,11 +242,11 @@ void ewol::Windows::OnObjectRemove(ewol::EObject * removeObject) m_subWidget[m_currentCreateId] = NULL; m_needFlipFlop = true; } - for(int32_t iii=m_popUpWidgetList[m_currentCreateId].Size()-1; iii>=0; iii--) { + for(int32_t iii=m_popUpWidgetList[m_currentCreateId].size()-1; iii>=0; iii--) { if(m_popUpWidgetList[m_currentCreateId][iii] == removeObject) { EWOL_DEBUG("Remove Pop-up [" << iii << "] element of the windows ==> destroyed object"); m_popUpWidgetList[m_currentCreateId][iii] = NULL; - m_popUpWidgetList[m_currentCreateId].Erase(iii); + m_popUpWidgetList[m_currentCreateId].erase(m_popUpWidgetList[m_currentCreateId].begin()+iii ); m_needFlipFlop = true; } } diff --git a/Sources/libewol/ewol/Windows.h b/Sources/libewol/ewol/Windows.h index 6dd72466..dfb84ed1 100644 --- a/Sources/libewol/ewol/Windows.h +++ b/Sources/libewol/ewol/Windows.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include namespace ewol { @@ -79,7 +79,7 @@ namespace ewol { } private: ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER]; - etk::VectorType m_popUpWidgetList[NB_BOUBLE_BUFFER]; + std::vector m_popUpWidgetList[NB_BOUBLE_BUFFER]; public: void SetSubWidget(ewol::Widget * widget); void PopUpWidgetPush(ewol::Widget * widget); diff --git a/Sources/libewol/ewol/base/guiX11.cpp b/Sources/libewol/ewol/base/guiX11.cpp index 7548652a..bb44f0dc 100644 --- a/Sources/libewol/ewol/base/guiX11.cpp +++ b/Sources/libewol/ewol/base/guiX11.cpp @@ -1270,16 +1270,16 @@ bool guiAbstraction::IsPressedInput(int32_t inputID) #include -static etk::VectorType listArgs; +static std::vector listArgs; int32_t ewol::CmdLineNb(void) { - return listArgs.Size(); + return listArgs.size(); } etk::UString ewol::CmdLineGet(int32_t id) { - if (id<0 && id>=listArgs.Size()) { + if (id<0 && id>=listArgs.size()) { return ""; } if (NULL == listArgs[id]) { @@ -1317,7 +1317,7 @@ int main(int argc, char *argv[]) } else { etk::UString* tmpString = new etk::UString(argv[i]); if (NULL != tmpString) { - listArgs.PushBack(tmpString); + listArgs.push_back(tmpString); } } } @@ -1336,13 +1336,13 @@ int main(int argc, char *argv[]) guiAbstraction::Stop(); // uninit ALL : EWOL_SystemStop(); - for (int32_t iii=0; iii= m_listOObject[m_currentCreateId].Size() ) { - m_listOObject[m_currentCreateId].PushBack(newObject); + if (pos < 0 || pos >= m_listOObject[m_currentCreateId].size() ) { + m_listOObject[m_currentCreateId].push_back(newObject); } else { - m_listOObject[m_currentCreateId].Insert(pos, newObject); + m_listOObject[m_currentCreateId].insert(m_listOObject[m_currentCreateId].begin()+pos, newObject); } m_needFlipFlop = true; } @@ -61,16 +61,16 @@ void ewol::Drawable::AddOObject(ewol::OObject* newObject, int32_t pos) void ewol::Drawable::ClearOObjectList(void) { - for (int32_t iii=0; iiiDraw(); } diff --git a/Sources/libewol/ewol/widget/Drawable.h b/Sources/libewol/ewol/widget/Drawable.h index ddab6ddc..0e27e5fa 100644 --- a/Sources/libewol/ewol/widget/Drawable.h +++ b/Sources/libewol/ewol/widget/Drawable.h @@ -26,6 +26,7 @@ #define __EWOL_WIDGET_DRAWABLE_H__ #include +#include namespace ewol { @@ -44,7 +45,7 @@ namespace ewol { virtual const char * const GetObjectType(void) { return "EwolDrawable"; }; private: - etk::VectorType m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... + std::vector m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... public: void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void ClearOObjectList(void); diff --git a/Sources/libewol/ewol/widget/Layer.cpp b/Sources/libewol/ewol/widget/Layer.cpp index cd5021fd..e4b7c35c 100644 --- a/Sources/libewol/ewol/widget/Layer.cpp +++ b/Sources/libewol/ewol/widget/Layer.cpp @@ -48,7 +48,7 @@ bool ewol::Layer::CalculateSize(float availlableX, float availlableY) //EWOL_DEBUG("Update Size"); m_size.x = availlableX; m_size.y = availlableY; - for (int32_t iii=0; iiiSetOrigin(m_origin.x, m_origin.y); m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y); @@ -65,7 +65,7 @@ bool ewol::Layer::CalculateMinSize(void) m_userExpendY=false; m_minSize.x = 0.0; m_minSize.y = 0.0; - for (int32_t iii=0; iiiCalculateMinSize(); if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { @@ -118,15 +118,14 @@ void ewol::Layer::LockExpendContamination(bool lockExpend) m_lockExpendContamination = lockExpend; } -//etk::VectorType m_SubWidget; void ewol::Layer::SubWidgetRemoveAll(void) { - for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; } - m_subWidget[m_currentCreateId].Clear(); + m_subWidget[m_currentCreateId].clear(); } @@ -135,7 +134,7 @@ void ewol::Layer::SubWidgetAdd(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - m_subWidget[m_currentCreateId].PushBack(newWidget); + m_subWidget[m_currentCreateId].push_back(newWidget); } @@ -144,11 +143,11 @@ void ewol::Layer::SubWidgetRemove(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; - m_subWidget[m_currentCreateId].Erase(iii); + m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii); return; } } @@ -159,10 +158,10 @@ void ewol::Layer::SubWidgetUnLink(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - for (int32_t iii=0; iii=0; iii--) { + for (int32_t iii=m_subWidget[m_currentDrawId].size()-1; iii>=0; iii--) { if (NULL != m_subWidget[m_currentDrawId][iii]) { m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp); } @@ -183,7 +182,7 @@ void ewol::Layer::OnDraw(DrawProperty& displayProp) void ewol::Layer::OnRegenerateDisplay(void) { - for (int32_t iii=0; iiiOnRegenerateDisplay(); } @@ -200,7 +199,7 @@ void ewol::Layer::OnRegenerateDisplay(void) ewol::Widget * ewol::Layer::GetWidgetAtPos(Vector2D pos) { // for all element in the sizer ... - for (int32_t iii=0; iii tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); Vector2D tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); @@ -234,7 +233,7 @@ void ewol::Layer::OnFlipFlopEvent(void) m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; } // in every case, we propagate the flip-flop EVENT - for(int32_t iii=0; iiiOnFlipFlopEvent(); } @@ -253,11 +252,11 @@ void ewol::Layer::OnObjectRemove(ewol::EObject * removeObject) // First step call parrent : ewol::Widget::OnObjectRemove(removeObject); // second step find if in all the elements ... - for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) { + for(int32_t iii=m_subWidget[m_currentCreateId].size()-1; iii>=0; iii--) { if(m_subWidget[m_currentCreateId][iii] == removeObject) { EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object"); m_subWidget[m_currentCreateId][iii] = NULL; - m_subWidget[m_currentCreateId].Erase(iii); + m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii); m_needFlipFlop = true; } } diff --git a/Sources/libewol/ewol/widget/Layer.h b/Sources/libewol/ewol/widget/Layer.h index c7b9a756..07d5b3a3 100644 --- a/Sources/libewol/ewol/widget/Layer.h +++ b/Sources/libewol/ewol/widget/Layer.h @@ -26,6 +26,7 @@ #define __EWOL_LAYER_H__ #include +#include #include #include @@ -52,8 +53,8 @@ namespace ewol { virtual bool CanExpentY(void); void LockExpendContamination(bool lockExpend=false); private: - bool m_lockExpendContamination; - etk::VectorType m_subWidget[NB_BOUBLE_BUFFER]; + bool m_lockExpendContamination; + std::vector m_subWidget[NB_BOUBLE_BUFFER]; public: virtual void SubWidgetRemoveAll(void); virtual void SubWidgetAdd(ewol::Widget* newWidget); diff --git a/Sources/libewol/ewol/widget/List.cpp b/Sources/libewol/ewol/widget/List.cpp index 20d13408..3cdaf385 100644 --- a/Sources/libewol/ewol/widget/List.cpp +++ b/Sources/libewol/ewol/widget/List.cpp @@ -52,11 +52,11 @@ ewol::List::~List(void) { //clean all the object for (int32_t jjj=0; jjj= m_listOObject[m_currentCreateId].Size() ) { - m_listOObject[m_currentCreateId].PushBack(newObject); + if (pos < 0 || pos >= m_listOObject[m_currentCreateId].size() ) { + m_listOObject[m_currentCreateId].push_back(newObject); } else { - m_listOObject[m_currentCreateId].Insert(pos, newObject); + m_listOObject[m_currentCreateId].insert(m_listOObject[m_currentCreateId].begin()+pos, newObject); } m_needFlipFlop = true; } @@ -92,16 +92,16 @@ void ewol::List::AddOObject(ewol::OObject* newObject, int32_t pos) void ewol::List::ClearOObjectList(void) { - for (int32_t iii=0; iiiDraw(); } @@ -144,7 +144,7 @@ void ewol::List::OnRegenerateDisplay(void) m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw; - etk::VectorType listSizeColomn; + std::vector listSizeColomn; ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); color_ts basicBG = GetBasicBG(); diff --git a/Sources/libewol/ewol/widget/List.h b/Sources/libewol/ewol/widget/List.h index 3d021e0d..da8b518a 100644 --- a/Sources/libewol/ewol/widget/List.h +++ b/Sources/libewol/ewol/widget/List.h @@ -29,6 +29,7 @@ #include #include #include +#include namespace ewol { class List :public ewol::WidgetScrooled @@ -48,7 +49,7 @@ namespace ewol { void SetLabel(etk::UString newLabel); // Drawing capabilities .... private: - etk::VectorType m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... + std::vector m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... public: void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void ClearOObjectList(void); diff --git a/Sources/libewol/ewol/widget/ListFileSystem.cpp b/Sources/libewol/ewol/widget/ListFileSystem.cpp index 87e463ff..cec3023f 100644 --- a/Sources/libewol/ewol/widget/ListFileSystem.cpp +++ b/Sources/libewol/ewol/widget/ListFileSystem.cpp @@ -38,14 +38,14 @@ extern const char * const ewolEventFSFileValidate = "ewol-event-file-system-fi extern const char * const ewolEventFSFolderSelect = "ewol-event-file-system-folder-select"; extern const char * const ewolEventFSFolderValidate = "ewol-event-file-system-folder-validate"; -static void SortElementList(etk::VectorType &list) +static void SortElementList(std::vector &list) { - etk::VectorType tmpList = list; - list.Clear(); - for(int32_t iii=0; iii tmpList = list; + list.clear(); + for(int32_t iii=0; iiim_name > list[jjj]->m_name) { @@ -54,7 +54,7 @@ static void SortElementList(etk::VectorType &list) } } //EWOL_DEBUG("position="<m_name == data) { // we find the line : @@ -238,18 +239,25 @@ void ewol::ListFileSystem::SetSelect( etk::UString data) { MarkToReedraw(); } -uint32_t ewol::ListFileSystem::GetNuberOfColomn(void) { +uint32_t ewol::ListFileSystem::GetNuberOfColomn(void) +{ return 1; -}; -bool ewol::ListFileSystem::GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg) { +} + +bool ewol::ListFileSystem::GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg) +{ myTitle = "title"; return true; -}; -uint32_t ewol::ListFileSystem::GetNuberOfRaw(void) { - return m_list.Size(); -}; -bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg) { - if (raw >= 0 && raw < m_list.Size() && NULL != m_list[raw]) { +} + +uint32_t ewol::ListFileSystem::GetNuberOfRaw(void) +{ + return m_list.size(); +} + +bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg) +{ + if (raw >= 0 && raw < m_list.size() && NULL != m_list[raw]) { myTextToWrite = m_list[raw]->m_name; } else { myTextToWrite = "ERROR"; @@ -264,13 +272,14 @@ bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString bg = 0x8F8FFFFF; } return true; -}; +} -bool ewol::ListFileSystem::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y) { +bool ewol::ListFileSystem::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y) +{ if (typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) { EWOL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw ); if (1 == IdInput) { - if (raw > m_list.Size() ) { + if (raw > m_list.size() ) { m_selectedLine = -1; } else { m_selectedLine = raw; diff --git a/Sources/libewol/ewol/widget/ListFileSystem.h b/Sources/libewol/ewol/widget/ListFileSystem.h index 6f86c028..388a84e0 100644 --- a/Sources/libewol/ewol/widget/ListFileSystem.h +++ b/Sources/libewol/ewol/widget/ListFileSystem.h @@ -26,6 +26,7 @@ #define __EWOL_LIST_FILE_H__ #include +#include extern const char * const ewolEventFSFileSelect; extern const char * const ewolEventFSFileValidate; @@ -55,7 +56,7 @@ namespace ewol { class ListFileSystem : public ewol::List { private: - etk::VectorType m_list; + std::vector m_list; etk::UString m_folder; int32_t m_selectedLine; bool m_showFile; diff --git a/Sources/libewol/ewol/widget/Menu.cpp b/Sources/libewol/ewol/widget/Menu.cpp index 97be15bb..84d00b7f 100644 --- a/Sources/libewol/ewol/widget/Menu.cpp +++ b/Sources/libewol/ewol/widget/Menu.cpp @@ -70,13 +70,13 @@ void ewol::Menu::SubWidgetUnLink(ewol::Widget* newWidget) void ewol::Menu::Clear(void) { - for( int32_t iii=0; iii < m_listElement.Size(); iii++) { + for( int32_t iii=0; iii < m_listElement.size(); iii++) { if (m_listElement[iii] != NULL) { delete(m_listElement[iii]); m_listElement[iii] = NULL; } } - m_listElement.Clear(); + m_listElement.clear(); } int32_t ewol::Menu::AddTitle(etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message) @@ -98,7 +98,7 @@ int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image, tmpObject->m_image = image; tmpObject->m_generateEvent = generateEvent; tmpObject->m_message = message; - m_listElement.PushBack(tmpObject); + m_listElement.push_back(tmpObject); if (-1 == tmpObject->m_parentId) { ewol::Button * myButton = NULL; myButton = new ewol::Button(label); @@ -138,7 +138,7 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve } */ if (eventId == ewolEventButtonPressed) { - for(int32_t iii=0; iiim_widgetPointer) { // 2 posible case (have a message or have a child ... if (m_listElement[iii]->m_generateEvent != NULL) { @@ -154,7 +154,7 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve } else{ EWOL_DEBUG("Menu ==> Load Sub Menu"); bool findChild = false; - for(int32_t jjj=0; jjjm_localId == m_listElement[jjj]->m_parentId) { findChild = true; break; @@ -191,7 +191,7 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve // set it in the pop-up-system : m_widgetContextMenu->SubWidgetSet(mySizerVert); - for(int32_t jjj=m_listElement.Size()-1; jjj>=0; jjj--) { + for(int32_t jjj=m_listElement.size()-1; jjj>=0; jjj--) { if (m_listElement[iii]!=NULL) { if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) { myButton = new ewol::Button(m_listElement[jjj]->m_label); @@ -231,7 +231,7 @@ void ewol::Menu::OnObjectRemove(ewol::EObject * removeObject) if (m_widgetContextMenu == removeObject) { m_widgetContextMenu = NULL; } - for(int32_t jjj=0; jjjm_widgetPointer == removeObject) { m_listElement[jjj]->m_widgetPointer = NULL; diff --git a/Sources/libewol/ewol/widget/Menu.h b/Sources/libewol/ewol/widget/Menu.h index b8d40cbc..ee738731 100644 --- a/Sources/libewol/ewol/widget/Menu.h +++ b/Sources/libewol/ewol/widget/Menu.h @@ -26,6 +26,7 @@ #define __EWOL_MENU_H__ #include +#include #include #include #include @@ -64,9 +65,9 @@ namespace ewol { virtual void SubWidgetRemove(ewol::Widget* newWidget); virtual void SubWidgetUnLink(ewol::Widget* newWidget); private: - etk::VectorType m_listElement; - int32_t m_staticId; // unique ID for every element of the menu ... - ewol::ContextMenu* m_widgetContextMenu; + std::vector m_listElement; + int32_t m_staticId; // unique ID for every element of the menu ... + ewol::ContextMenu* m_widgetContextMenu; public: void Clear(void); int32_t AddTitle(etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = ""); diff --git a/Sources/libewol/ewol/widget/Scene.cpp b/Sources/libewol/ewol/widget/Scene.cpp index 5e412193..2ea249e3 100644 --- a/Sources/libewol/ewol/widget/Scene.cpp +++ b/Sources/libewol/ewol/widget/Scene.cpp @@ -63,13 +63,13 @@ void ewol::Scene::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { // clean elements - for (int32_t iii=0; iiiClear(); } } for (int32_t jjj=0; jjjDraw(m_currentCreateId); @@ -90,7 +90,7 @@ void ewol::Scene::OnDraw(DrawProperty& displayProp) { //EWOL_ERROR(" On draw : " << m_currentDrawId); // draw elements - for (int32_t iii=0; iiiDraw(); } @@ -126,7 +126,7 @@ void ewol::Scene::PeriodicCall(int64_t localTime) ScenePeriodicCall(m_lastCallTime, CYCLIC_CALL_PERIODE_US); //EWOL_ERROR("Periodic Call ... " << localTime); for (int32_t jjj=0; jjjProcess(m_lastCallTime, CYCLIC_CALL_PERIODE_US) ) { diff --git a/Sources/libewol/ewol/widget/SizerHori.cpp b/Sources/libewol/ewol/widget/SizerHori.cpp index 12924b72..893d14f0 100644 --- a/Sources/libewol/ewol/widget/SizerHori.cpp +++ b/Sources/libewol/ewol/widget/SizerHori.cpp @@ -51,7 +51,7 @@ bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY) float unexpendableSize=0.0; int32_t nbWidgetFixedSize=0; int32_t nbWidgetNotFixedSize=0; - for (int32_t iii=0; iii tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); unexpendableSize += tmpSize.x; @@ -73,7 +73,7 @@ bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY) Vector2D tmpOrigin; tmpOrigin.x = m_origin.x; tmpOrigin.y = m_origin.y; - for (int32_t iii=0; iii tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); // Set the origin : @@ -101,7 +101,7 @@ bool ewol::SizerHori::CalculateMinSize(void) m_userExpendY=false; m_minSize.x = 0.0; m_minSize.y = 0.0; - for (int32_t iii=0; iiiCalculateMinSize(); if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { @@ -158,17 +158,16 @@ void ewol::SizerHori::LockExpendContamination(bool lockExpend) m_lockExpendContamination = lockExpend; } -//etk::VectorType m_subWidget[m_currentCreateId]; void ewol::SizerHori::SubWidgetRemoveAll(void) { - for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; } } - m_subWidget[m_currentCreateId].Clear(); + m_subWidget[m_currentCreateId].clear(); } @@ -177,7 +176,7 @@ void ewol::SizerHori::SubWidgetAdd(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - m_subWidget[m_currentCreateId].PushBack(newWidget); + m_subWidget[m_currentCreateId].push_back(newWidget); } @@ -186,13 +185,13 @@ void ewol::SizerHori::SubWidgetRemove(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; } - m_subWidget[m_currentCreateId].Erase(iii); + m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii); return; } } @@ -203,10 +202,10 @@ void ewol::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - for (int32_t iii=0; iiiGenDraw(displayProp); } @@ -225,7 +224,7 @@ void ewol::SizerHori::OnDraw(DrawProperty& displayProp) void ewol::SizerHori::OnRegenerateDisplay(void) { - for (int32_t iii=0; iiiOnRegenerateDisplay(); } @@ -246,7 +245,7 @@ ewol::Widget * ewol::SizerHori::GetWidgetAtPos(Vector2D pos) return NULL; } // for all element in the sizer ... - for (int32_t iii=0; iii tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); Vector2D tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); @@ -283,7 +282,7 @@ void ewol::SizerHori::OnFlipFlopEvent(void) m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; } // in every case, we propagate the flip-flop EVENT - for(int32_t iii=0; iiiOnFlipFlopEvent(); } @@ -302,11 +301,11 @@ void ewol::SizerHori::OnObjectRemove(ewol::EObject * removeObject) // First step call parrent : ewol::Widget::OnObjectRemove(removeObject); // second step find if in all the elements ... - for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) { + for(int32_t iii=m_subWidget[m_currentCreateId].size()-1; iii>=0; iii--) { if(m_subWidget[m_currentCreateId][iii] == removeObject) { EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object"); m_subWidget[m_currentCreateId][iii] = NULL; - m_subWidget[m_currentCreateId].Erase(iii); + m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii); m_needFlipFlop = true; } } diff --git a/Sources/libewol/ewol/widget/SizerHori.h b/Sources/libewol/ewol/widget/SizerHori.h index d2de7857..6caa27e1 100644 --- a/Sources/libewol/ewol/widget/SizerHori.h +++ b/Sources/libewol/ewol/widget/SizerHori.h @@ -26,6 +26,7 @@ #define __EWOL_SIZER_HORI_H__ #include +#include #include #include @@ -53,8 +54,8 @@ namespace ewol { virtual bool CanExpentY(void); void LockExpendContamination(bool lockExpend=false); private: - bool m_lockExpendContamination; - etk::VectorType m_subWidget[NB_BOUBLE_BUFFER]; + bool m_lockExpendContamination; + std::vector m_subWidget[NB_BOUBLE_BUFFER]; public: virtual void SubWidgetRemoveAll(void); virtual void SubWidgetAdd(ewol::Widget* newWidget); diff --git a/Sources/libewol/ewol/widget/SizerVert.cpp b/Sources/libewol/ewol/widget/SizerVert.cpp index 719cf06b..5571fa99 100644 --- a/Sources/libewol/ewol/widget/SizerVert.cpp +++ b/Sources/libewol/ewol/widget/SizerVert.cpp @@ -52,7 +52,7 @@ bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY) float unexpendableSize=0.0; int32_t nbWidgetFixedSize=0; int32_t nbWidgetNotFixedSize=0; - for (int32_t iii=0; iii tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); unexpendableSize += tmpSize.y; @@ -75,7 +75,7 @@ bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY) Vector2D tmpOrigin; tmpOrigin.x = m_origin.x; tmpOrigin.y = m_origin.y; - for (int32_t iii=0; iii tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); // Set the origin : @@ -103,7 +103,7 @@ bool ewol::SizerVert::CalculateMinSize(void) m_userExpendY=false; m_minSize.x = 0.0; m_minSize.y = 0.0; - for (int32_t iii=0; iiiCalculateMinSize(); if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { @@ -165,11 +165,11 @@ void ewol::SizerVert::LockExpendContamination(bool lockExpend) void ewol::SizerVert::SubWidgetRemoveAll(void) { - for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; } - m_subWidget[m_currentCreateId].Clear(); + m_subWidget[m_currentCreateId].clear(); } @@ -178,7 +178,7 @@ void ewol::SizerVert::SubWidgetAdd(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - m_subWidget[m_currentCreateId].PushBack(newWidget); + m_subWidget[m_currentCreateId].push_back(newWidget); } @@ -187,11 +187,11 @@ void ewol::SizerVert::SubWidgetRemove(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; - m_subWidget[m_currentCreateId].Erase(iii); + m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii); return; } } @@ -202,10 +202,10 @@ void ewol::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - for (int32_t iii=0; iiiGenDraw(displayProp); } @@ -225,7 +225,7 @@ void ewol::SizerVert::OnDraw(DrawProperty& displayProp) void ewol::SizerVert::OnRegenerateDisplay(void) { - for (int32_t iii=0; iiiOnRegenerateDisplay(); } @@ -246,7 +246,7 @@ ewol::Widget * ewol::SizerVert::GetWidgetAtPos(Vector2D pos) return NULL; } // for all element in the sizer ... - for (int32_t iii=0; iii tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize(); Vector2D tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); @@ -283,7 +283,7 @@ void ewol::SizerVert::OnFlipFlopEvent(void) m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; } // in every case, we propagate the flip-flop EVENT - for(int32_t iii=0; iiiOnFlipFlopEvent(); } @@ -302,11 +302,11 @@ void ewol::SizerVert::OnObjectRemove(ewol::EObject * removeObject) // First step call parrent : ewol::Widget::OnObjectRemove(removeObject); // second step find if in all the elements ... - for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) { + for(int32_t iii=m_subWidget[m_currentCreateId].size()-1; iii>=0; iii--) { if(m_subWidget[m_currentCreateId][iii] == removeObject) { EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object"); m_subWidget[m_currentCreateId][iii] = NULL; - m_subWidget[m_currentCreateId].Erase(iii); + m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii); m_needFlipFlop = true; } } diff --git a/Sources/libewol/ewol/widget/SizerVert.h b/Sources/libewol/ewol/widget/SizerVert.h index 187eb1a9..f699b43b 100644 --- a/Sources/libewol/ewol/widget/SizerVert.h +++ b/Sources/libewol/ewol/widget/SizerVert.h @@ -52,8 +52,8 @@ namespace ewol { virtual bool CanExpentY(void); void LockExpendContamination(bool lockExpend=false); private: - bool m_lockExpendContamination; - etk::VectorType m_subWidget[NB_BOUBLE_BUFFER]; + bool m_lockExpendContamination; + std::vector m_subWidget[NB_BOUBLE_BUFFER]; public: virtual void SubWidgetRemoveAll(void); virtual void SubWidgetAdd(ewol::Widget* newWidget); diff --git a/Sources/libewol/ewol/widget/WSlider.cpp b/Sources/libewol/ewol/widget/WSlider.cpp index 1d8a1d68..a5ba01c6 100644 --- a/Sources/libewol/ewol/widget/WSlider.cpp +++ b/Sources/libewol/ewol/widget/WSlider.cpp @@ -57,7 +57,7 @@ bool ewol::WSlider::CalculateSize(float availlableX, float availlableY) if (m_windowsDestination == m_windowsSources) { int32_t iii = m_windowsDestination; - if (iii < m_subWidget[m_currentCreateId].Size()) { + if (iii < m_subWidget[m_currentCreateId].size()) { if (NULL != m_subWidget[m_currentCreateId][iii]) { m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x, m_origin.y); m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y); @@ -65,14 +65,14 @@ bool ewol::WSlider::CalculateSize(float availlableX, float availlableY) } } else { int32_t iii = m_windowsSources; - if (iii < m_subWidget[m_currentCreateId].Size()) { + if (iii < m_subWidget[m_currentCreateId].size()) { if (NULL != m_subWidget[m_currentCreateId][iii]) { m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x - (m_size.x*(float)m_slidingProgress/1000.0), m_origin.y); m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y); } } iii = m_windowsDestination; - if (iii < m_subWidget[m_currentCreateId].Size()) { + if (iii < m_subWidget[m_currentCreateId].size()) { if (NULL != m_subWidget[m_currentCreateId][iii]) { m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x - (m_size.x*((float)m_slidingProgress/1000.0) - m_size.x), m_origin.y); m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y); @@ -91,7 +91,7 @@ bool ewol::WSlider::CalculateMinSize(void) m_underExpend.y=false; m_minSize.x = 0.0; m_minSize.y = 0.0; - for (int32_t iii=0; iiiCalculateMinSize(); if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { @@ -144,11 +144,11 @@ void ewol::WSlider::LockExpendContamination(bool lockExpend) void ewol::WSlider::SubWidgetRemoveAll(void) { - for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; } - m_subWidget[m_currentCreateId].Clear(); + m_subWidget[m_currentCreateId].clear(); } @@ -157,7 +157,7 @@ void ewol::WSlider::SubWidgetAdd(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - m_subWidget[m_currentCreateId].PushBack(newWidget); + m_subWidget[m_currentCreateId].push_back(newWidget); MarkToReedraw(); ewol::RequestUpdateSize(); } @@ -168,11 +168,11 @@ void ewol::WSlider::SubWidgetRemove(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - for (int32_t iii=0; iiiMarkToRemove(); m_subWidget[m_currentCreateId][iii] = NULL; - m_subWidget[m_currentCreateId].Erase(iii); + m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii); MarkToReedraw(); ewol::RequestUpdateSize(); return; @@ -185,10 +185,10 @@ void ewol::WSlider::SubWidgetUnLink(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - for (int32_t iii=0; iii m_subWidget[m_currentCreateId].Size()) { + if (id<0 || id > m_subWidget[m_currentCreateId].size()) { EWOL_ERROR("Can not change to a widget not present"); } m_windowsDestination = id; @@ -232,7 +232,7 @@ void ewol::WSlider::OnDraw(DrawProperty& displayProp) if (m_windowsDestination == m_windowsSources) { //EWOL_DEBUG("Draw : " << m_windowsDestination); int32_t iii = m_windowsDestination; - if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) { + if (iii<0 || iii > m_subWidget[m_currentDrawId].size()) { return; } if (NULL != m_subWidget[m_currentDrawId][iii]) { @@ -242,7 +242,7 @@ void ewol::WSlider::OnDraw(DrawProperty& displayProp) //EWOL_DEBUG("Draw : " << m_windowsSources << "=>" << m_windowsDestination << "progress=" << ((float)m_slidingProgress/1000.) ); // draw Sources : int32_t iii = m_windowsSources; - if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) { + if (iii<0 || iii > m_subWidget[m_currentDrawId].size()) { return; } if (NULL != m_subWidget[m_currentDrawId][iii]) { @@ -250,7 +250,7 @@ void ewol::WSlider::OnDraw(DrawProperty& displayProp) } // Draw Destination : iii = m_windowsDestination; - if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) { + if (iii<0 || iii > m_subWidget[m_currentDrawId].size()) { return; } if (NULL != m_subWidget[m_currentDrawId][iii]) { @@ -265,7 +265,7 @@ void ewol::WSlider::OnRegenerateDisplay(void) { if (m_windowsDestination == m_windowsSources) { int32_t iii = m_windowsDestination; - if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) { + if (iii<0 || iii > m_subWidget[m_currentCreateId].size()) { return; } if (NULL != m_subWidget[m_currentCreateId][iii]) { @@ -273,14 +273,14 @@ void ewol::WSlider::OnRegenerateDisplay(void) } } else { int32_t iii = m_windowsSources; - if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) { + if (iii<0 || iii > m_subWidget[m_currentCreateId].size()) { return; } if (NULL != m_subWidget[m_currentCreateId][iii]) { m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay(); } iii = m_windowsDestination; - if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) { + if (iii<0 || iii > m_subWidget[m_currentCreateId].size()) { return; } if (NULL != m_subWidget[m_currentCreateId][iii]) { @@ -299,7 +299,7 @@ void ewol::WSlider::OnRegenerateDisplay(void) ewol::Widget * ewol::WSlider::GetWidgetAtPos(Vector2D pos) { // TODO : Review this ... - if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentCreateId].Size()) { + if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentCreateId].size()) { // error ... return NULL; } @@ -336,7 +336,7 @@ void ewol::WSlider::OnFlipFlopEvent(void) if (true == needFlipFlop) { m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; } - if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentDrawId].Size()) { + if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentDrawId].size()) { // error ... return; } @@ -357,11 +357,11 @@ void ewol::WSlider::OnObjectRemove(ewol::EObject * removeObject) // First step call parrent : ewol::Widget::OnObjectRemove(removeObject); // second step find if in all the elements ... - for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) { + for(int32_t iii=m_subWidget[m_currentCreateId].size()-1; iii>=0; iii--) { if(m_subWidget[m_currentCreateId][iii] == removeObject) { EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object"); m_subWidget[m_currentCreateId][iii] = NULL; - m_subWidget[m_currentCreateId].Erase(iii); + m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii); m_needFlipFlop = true; } } diff --git a/Sources/libewol/ewol/widget/WSlider.h b/Sources/libewol/ewol/widget/WSlider.h index 9480c50c..c4d08a33 100644 --- a/Sources/libewol/ewol/widget/WSlider.h +++ b/Sources/libewol/ewol/widget/WSlider.h @@ -26,6 +26,7 @@ #define __EWOL_W_SLIDER_H__ #include +#include #include #include @@ -52,11 +53,11 @@ namespace ewol { virtual bool CanExpentY(void); void LockExpendContamination(bool lockExpend=false); private: - bool m_lockExpendContamination; - etk::VectorType m_subWidget[NB_BOUBLE_BUFFER]; - int32_t m_windowsSources; // widget source viewed - int32_t m_windowsDestination; // widget destinated viewed - int32_t m_slidingProgress; // ratio progression of a sliding + bool m_lockExpendContamination; + std::vector m_subWidget[NB_BOUBLE_BUFFER]; + int32_t m_windowsSources; // widget source viewed + int32_t m_windowsDestination; // widget destinated viewed + int32_t m_slidingProgress; // ratio progression of a sliding public: virtual void SubWidgetRemoveAll(void); virtual void SubWidgetAdd(ewol::Widget* newWidget); @@ -64,7 +65,7 @@ namespace ewol { virtual void SubWidgetUnLink(ewol::Widget* newWidget); void SubWidgetSelectSet(int32_t id); int32_t SubWidgetSelectGet(void) { return (int32_t)m_slidingProgress; }; - int32_t SubWidgetNumber(void) { return m_subWidget[m_currentCreateId].Size(); }; + int32_t SubWidgetNumber(void) { return m_subWidget[m_currentCreateId].size(); }; protected: virtual void OnDraw(DrawProperty& displayProp); public: diff --git a/Sources/libewol/ewol/widget/WidgetScrolled.cpp b/Sources/libewol/ewol/widget/WidgetScrolled.cpp index a802bacd..2fb276b9 100644 --- a/Sources/libewol/ewol/widget/WidgetScrolled.cpp +++ b/Sources/libewol/ewol/widget/WidgetScrolled.cpp @@ -311,10 +311,10 @@ void ewol::WidgetScrooled::AddOObject(ewol::OObject* newObject, int32_t pos) EWOL_ERROR("Try to add an empty object in the Widget generic display system"); return; } - if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) { - m_listOObject[m_currentCreateId].PushBack(newObject); + if (pos < 0 || pos >= m_listOObject[m_currentCreateId].size() ) { + m_listOObject[m_currentCreateId].push_back(newObject); } else { - m_listOObject[m_currentCreateId].Insert(pos, newObject); + m_listOObject[m_currentCreateId].insert(m_listOObject[m_currentCreateId].begin()+pos, newObject); } m_needFlipFlop = true; } @@ -322,16 +322,16 @@ void ewol::WidgetScrooled::AddOObject(ewol::OObject* newObject, int32_t pos) void ewol::WidgetScrooled::ClearOObjectList(void) { - for (int32_t iii=0; iiiDraw(); } diff --git a/Sources/libewol/ewol/widget/WidgetScrolled.h b/Sources/libewol/ewol/widget/WidgetScrolled.h index eb33c92b..fb7a00e1 100644 --- a/Sources/libewol/ewol/widget/WidgetScrolled.h +++ b/Sources/libewol/ewol/widget/WidgetScrolled.h @@ -26,6 +26,7 @@ #define __EWOL_SCROLLED_WIDGET_H__ #include +#include #include #include @@ -47,7 +48,7 @@ namespace ewol { class WidgetScrooled : public ewol::Widget { private: - etk::VectorType m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... + std::vector m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void ClearOObjectList(void); protected: diff --git a/Sources/libewol/ewol/widgetMeta/ColorChooser.cpp b/Sources/libewol/ewol/widgetMeta/ColorChooser.cpp index 214208d4..aa76f2cf 100644 --- a/Sources/libewol/ewol/widgetMeta/ColorChooser.cpp +++ b/Sources/libewol/ewol/widgetMeta/ColorChooser.cpp @@ -28,8 +28,6 @@ #include #include #include -//#include -#include extern "C" { // file browsing ... diff --git a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp index 7fa29787..c5ef2c0b 100644 --- a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp +++ b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp @@ -29,8 +29,6 @@ #include #include #include -//#include -#include extern "C" { // file browsing ... diff --git a/Sources/libewol/ewol/widgetMeta/Parameter.cpp b/Sources/libewol/ewol/widgetMeta/Parameter.cpp index 431a0da0..78c09ac6 100644 --- a/Sources/libewol/ewol/widgetMeta/Parameter.cpp +++ b/Sources/libewol/ewol/widgetMeta/Parameter.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include diff --git a/Sources/libewol/ewol/widgetMeta/ParameterList.cpp b/Sources/libewol/ewol/widgetMeta/ParameterList.cpp index 203e47d8..23528a2d 100644 --- a/Sources/libewol/ewol/widgetMeta/ParameterList.cpp +++ b/Sources/libewol/ewol/widgetMeta/ParameterList.cpp @@ -58,11 +58,11 @@ ewol::ParameterList::~ParameterList(void) { //clean all the object for (int32_t jjj=0; jjj= m_listOObject[m_currentCreateId].Size() ) { - m_listOObject[m_currentCreateId].PushBack(newObject); + if (pos < 0 || pos >= m_listOObject[m_currentCreateId].size() ) { + m_listOObject[m_currentCreateId].push_back(newObject); } else { - m_listOObject[m_currentCreateId].Insert(pos, newObject); + m_listOObject[m_currentCreateId].insert(m_listOObject[m_currentCreateId].begin()+pos, newObject); } m_needFlipFlop = true; } @@ -99,16 +99,16 @@ void ewol::ParameterList::AddOObject(ewol::OObject* newObject, int32_t pos) void ewol::ParameterList::ClearOObjectList(void) { - for (int32_t iii=0; iiiDraw(); } @@ -145,13 +145,13 @@ void ewol::ParameterList::OnRegenerateDisplay(void) //uint32_t nbColomn = GetNuberOfColomn(); - int32_t nbRaw = m_list.Size(); + int32_t nbRaw = m_list.size(); // For the scrooling windows m_maxSize.x = m_size.x; m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw; - etk::VectorType listSizeColomn; + std::vector listSizeColomn; // set background color : ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); @@ -231,7 +231,7 @@ bool ewol::ParameterList::OnEventInput(ewol::inputType_te type, int32_t IdInput, int32_t rawID = (relativePos.y+m_originScrooled.y) / (minHeight + 2*m_paddingSizeY); // generate an event on a rawId if the element request change and Select it ... - if (rawID >=0 && rawID=0 && rawIDm_refId>=0) { GenerateEventId(ewolEventParameterListSelect, m_list[rawID]->m_refId); @@ -261,9 +261,9 @@ void ewol::ParameterList::MenuAdd(etk::UString& label, int32_t refId, etk::UStri { ewol::elementPL* tmpEmement = new ewol::elementPL(label, refId, image, false); if (NULL != tmpEmement) { - m_list.PushBack(tmpEmement); + m_list.push_back(tmpEmement); if (m_idSelected == -1 && label != "---" && refId>0) { - m_idSelected = m_list.Size()-1; + m_idSelected = m_list.size()-1; } MarkToReedraw(); } @@ -273,7 +273,7 @@ void ewol::ParameterList::MenuAddGroup(etk::UString& label) etk::UString image = ""; ewol::elementPL* tmpEmement = new ewol::elementPL(label, -1, image, true); if (NULL != tmpEmement) { - m_list.PushBack(tmpEmement); + m_list.push_back(tmpEmement); MarkToReedraw(); } } @@ -282,18 +282,18 @@ void ewol::ParameterList::MenuAddGroup(etk::UString& label) void ewol::ParameterList::MenuClear(void) { m_idSelected = -1; - for (int32_t iii=0; iii0) { + if (m_list.size()>0) { etk::UString label = ""; etk::UString image = ""; MenuAdd(label, -1, image); diff --git a/Sources/libewol/ewol/widgetMeta/ParameterList.h b/Sources/libewol/ewol/widgetMeta/ParameterList.h index 1bdfcd39..66d7c232 100644 --- a/Sources/libewol/ewol/widgetMeta/ParameterList.h +++ b/Sources/libewol/ewol/widgetMeta/ParameterList.h @@ -54,8 +54,8 @@ namespace ewol { class ParameterList :public ewol::WidgetScrooled { private: - int32_t m_idSelected; - etk::VectorType m_list; + int32_t m_idSelected; + std::vector m_list; public: ParameterList(void); /** @@ -70,7 +70,7 @@ namespace ewol { void SetLabel(etk::UString newLabel); // Drawing capabilities .... private: - etk::VectorType m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... + std::vector m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display... public: void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void ClearOObjectList(void); diff --git a/Sources/libparsersvg b/Sources/libparsersvg index efe22dc9..f15fc7bb 160000 --- a/Sources/libparsersvg +++ b/Sources/libparsersvg @@ -1 +1 @@ -Subproject commit efe22dc9a440905565ab653d942bba5aaca040f8 +Subproject commit f15fc7bbad327fb793ba7ad6973a2aa091f71e5f