STANDARD ==> remove vector type and replace with std::vector (done but sone assertion)

This commit is contained in:
2012-08-07 18:05:02 +02:00
parent d58bda6896
commit 4012d75279
20 changed files with 292 additions and 383 deletions

View File

@@ -80,7 +80,7 @@ class classBufferManager: public ewol::EObject
private:
etk::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
std::vector<Buffer*> listBuffer; //!< element List of the char Elements
void RemoveAll(void); //!< remove all buffer
int32_t m_idSelected;
@@ -125,7 +125,7 @@ classBufferManager::~classBufferManager(void)
RemoveAll();
// clear The list of Buffer
APPL_INFO("~classBufferManager::listBuffer.Clear();");
listBuffer.Clear();
listBuffer.clear();
APPL_INFO("~classBufferManager::delete(BufferNotExiste);");
delete(BufferNotExiste);
}
@@ -235,7 +235,7 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch
}
// try next buffer
if (-1 == destBuffer) {
for(int32_t ii=closeID+1; ii < listBuffer.Size(); ii++) {
for(int32_t ii=closeID+1; ii < listBuffer.size(); ii++) {
if (true == Exist(ii) ) {
destBuffer = ii;
break;
@@ -305,7 +305,7 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch
void classBufferManager::RemoveAll(void)
{
int32_t i;
for (i=0; i<listBuffer.Size(); i++) {
for (i=0; i<listBuffer.size(); i++) {
Remove(i);
}
SendMultiCast(ednMsgGuiClose, "All");
@@ -326,8 +326,8 @@ int32_t classBufferManager::Create(void)
// allocate a new Buffer
Buffer *myBuffer = new BufferText();
// Add at the list of element
listBuffer.PushBack(myBuffer);
int32_t basicID = listBuffer.Size() - 1;
listBuffer.push_back(myBuffer);
int32_t basicID = listBuffer.size() - 1;
return basicID;
}
@@ -348,8 +348,8 @@ int32_t classBufferManager::Open(etk::File &myFile)
// allocate a new Buffer
Buffer *myBuffer = new BufferText(myFile);
// Add at the list of element
listBuffer.PushBack(myBuffer);
return listBuffer.Size() - 1;
listBuffer.push_back(myBuffer);
return listBuffer.size() - 1;
} else {
// the buffer already existed ==> we open it ...
return GetId(myFile);
@@ -365,7 +365,7 @@ Buffer * classBufferManager::Get(int32_t BufferID)
return BufferNotExiste;
}
// check if the Buffer existed
if (BufferID < listBuffer.Size()) {
if (BufferID < listBuffer.size()) {
// check if the buffer already existed
if (NULL != listBuffer[BufferID]) {
return listBuffer[BufferID];
@@ -373,7 +373,7 @@ Buffer * classBufferManager::Get(int32_t BufferID)
APPL_ERROR("non existing Buffer " << BufferID);
}
} else {
APPL_ERROR("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.Size());
APPL_ERROR("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.size());
}
return BufferNotExiste;
}
@@ -385,7 +385,7 @@ bool classBufferManager::Exist(int32_t BufferID)
return false;
}
// check if the Buffer existed
if (BufferID < listBuffer.Size()) {
if (BufferID < listBuffer.size()) {
// check if the buffer already existed
if (NULL != listBuffer[BufferID]) {
return true;
@@ -408,7 +408,7 @@ int32_t classBufferManager::GetId(etk::File &myFile)
{
int32_t iii;
// check if the Buffer existed
for (iii=0; iii < listBuffer.Size(); iii++) {
for (iii=0; iii < listBuffer.size(); iii++) {
// check if the buffer already existed
if (NULL != listBuffer[iii]) {
if ( listBuffer[iii]->GetFileName() == myFile) {
@@ -423,7 +423,7 @@ int32_t classBufferManager::GetId(etk::File &myFile)
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t classBufferManager::Size(void)
{
return listBuffer.Size();
return listBuffer.size();
}
// nb of opens file Now ...
@@ -431,7 +431,7 @@ uint32_t classBufferManager::SizeOpen(void)
{
uint32_t jjj = 0;
// check if the Buffer existed
for (int32_t iii=0; iii<listBuffer.Size(); iii++) {
for (int32_t iii=0; iii<listBuffer.size(); iii++) {
// check if the buffer already existed
if (NULL != listBuffer[iii]) {
jjj++;
@@ -454,7 +454,7 @@ bool classBufferManager::Remove(int32_t BufferID)
return false;
}
// check if the Buffer existed
if (BufferID < listBuffer.Size()) {
if (BufferID < listBuffer.size()) {
// check if the buffer already existed
if (NULL != listBuffer[BufferID]) {
// TODO : Check if it saved...
@@ -475,7 +475,7 @@ bool classBufferManager::Remove(int32_t BufferID)
return false;
}
} else {
APPL_INFO("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.Size());
APPL_INFO("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.size());
return false;
}
}
@@ -491,7 +491,7 @@ bool classBufferManager::Remove(int32_t BufferID)
int32_t classBufferManager::WitchBuffer(int32_t iEmeElement)
{
int32_t i;
for (i=0; i<listBuffer.Size(); i++) {
for (i=0; i<listBuffer.size(); i++) {
if (NULL != listBuffer[i]) {
iEmeElement--;
// find the element :

View File

@@ -913,8 +913,8 @@ void BufferText::AddChar(uniChar_t unicodeData)
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
if (unicodeData == 0x09) {
if (false == haveSelectionActive) {
etk::VectorType<int8_t> tmpVect;
tmpVect.PushBack(0x09);
std::vector<int8_t> tmpVect;
tmpVect.push_back(0x09);
m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+1, true);
} else {
@@ -922,10 +922,10 @@ void BufferText::AddChar(uniChar_t unicodeData)
// count the number of line :
int32_t nbSelectedLines = m_EdnBuf.CountLines(SelectionStart, SelectionEnd);
if (0 == nbSelectedLines) {
etk::VectorType<int8_t> tmpVect;
tmpVect.PushBack(0x09);
std::vector<int8_t> tmpVect;
tmpVect.push_back(0x09);
m_EdnBuf.ReplaceSelected(tmpVect);
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
SetInsertPosition(SelectionStart+tmpVect.size(), true);
} else {
if (true == ewol::IsSetShift() ) {
m_cursorPos = m_EdnBuf.UnIndent();
@@ -935,11 +935,11 @@ void BufferText::AddChar(uniChar_t unicodeData)
}
}
} else if (unicodeData == '\n') {
etk::VectorType<int8_t> tmpVect;
std::vector<int8_t> tmpVect;
if (true == ewol::IsSetShift()) {
tmpVect.PushBack('\r');
tmpVect.push_back('\r');
} else {
tmpVect.PushBack('\n');
tmpVect.push_back('\n');
// if Auto indent Enable ==> we get the start of the previous line and add it to tne new one
if (true == globals::IsSetAutoIndent() ) {
int32_t l_lineStart;
@@ -952,9 +952,9 @@ void BufferText::AddChar(uniChar_t unicodeData)
// add same characters in the temporar buffer
for (int32_t kk=l_lineStart; kk<m_cursorPos; kk++) {
if (' ' == m_EdnBuf[kk]) {
tmpVect.PushBack(' ');
tmpVect.push_back(' ');
} else if('\t' == m_EdnBuf[kk]) {
tmpVect.PushBack('\t');
tmpVect.push_back('\t');
} else {
break;
}
@@ -964,10 +964,10 @@ void BufferText::AddChar(uniChar_t unicodeData)
// Set temporary buffer in the real buffer
if (false == haveSelectionActive) {
m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+tmpVect.Size(), true);
SetInsertPosition(m_cursorPos+tmpVect.size(), true);
} else {
m_EdnBuf.ReplaceSelected(tmpVect);
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
SetInsertPosition(SelectionStart+tmpVect.size(), true);
}
} else if (unicodeData == 0x7F ) {
//APPL_INFO("keyEvent : <Suppr> pos=" << m_cursorPos);
@@ -991,9 +991,11 @@ void BufferText::AddChar(uniChar_t unicodeData)
if (true == m_EdnBuf.GetUTF8Mode()) {
char tmpUTF8[16];
unicode::convertUnicodeToUtf8(unicodeData, tmpUTF8);
etk::VectorType<int8_t> tmpVect;
std::vector<int8_t> tmpVect;
int32_t localOfset = strlen(tmpUTF8);
tmpVect.PushBack((int8_t*)tmpUTF8, localOfset);
for (int32_t iii=0; iii<localOfset ; iii++) {
tmpVect.push_back(tmpUTF8[iii]);
}
if (false == haveSelectionActive) {
m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+localOfset, true);
@@ -1006,8 +1008,8 @@ void BufferText::AddChar(uniChar_t unicodeData)
char output_ISO;
unicode::convertUnicodeToIso(m_EdnBuf.GetCharsetType(), unicodeData, output_ISO);
//printf(" insert : \"%s\"==> 0x%08x=%d ", UTF8data, (unsigned int)output_ISO, (int)output_ISO);
etk::VectorType<int8_t> tmpVect;
tmpVect.PushBack(output_ISO);
std::vector<int8_t> tmpVect;
tmpVect.push_back(output_ISO);
if (false == haveSelectionActive) {
m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+1, true);
@@ -1030,7 +1032,7 @@ int32_t BufferText::FindLine(etk::UString &data)
return 0;
}
APPL_INFO("Search data line : \"" << data << "\"");
etk::VectorType<uniChar_t> mVectSearch;
std::vector<uniChar_t> mVectSearch;
mVectSearch = data.GetVector();
//APPL_INFO("search data Forward : startSearchPos=" << startSearchPos );
/*

View File

@@ -119,18 +119,18 @@ bool EdnBuf::DumpFrom(FILE *myFile)
}
void EdnBuf::GetAll(etk::VectorType<int8_t> &text)
void EdnBuf::GetAll(std::vector<int8_t> &text)
{
// Clean output vector
text.Clear();
text.clear();
// Set data on the vector
m_data.Get(0, m_data.Size(), text);
}
void EdnBuf::SetAll(etk::VectorType<int8_t> &text)
void EdnBuf::SetAll(std::vector<int8_t> &text)
{
etk::VectorType<int8_t> deletedText;
std::vector<int8_t> deletedText;
// extract all data of the buffer :
GetAll(deletedText);
@@ -142,16 +142,16 @@ void EdnBuf::SetAll(etk::VectorType<int8_t> &text)
m_data.Insert(0, text);
// Zero all of the existing selections
UpdateSelection(0, deletedText.Size(), 0);
UpdateSelection(0, deletedText.size(), 0);
// Call the modification Event Manager
eventModification(0, m_data.Size(), deletedText);
}
void EdnBuf::GetRange(int32_t start, int32_t end, etk::VectorType<int8_t> &output)
void EdnBuf::GetRange(int32_t start, int32_t end, std::vector<int8_t> &output)
{
// Remove all data ...
output.Clear();
output.clear();
// import data :
m_data.Get(start, end-start, output);
//APPL_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.Size() );
@@ -162,14 +162,14 @@ void EdnBuf::GetRange(int32_t start, int32_t end, etk::UString &output)
// Remove all data ...
output = "";
// import data :
etk::VectorType<int8_t> localOutput;
std::vector<int8_t> localOutput;
m_data.Get(start, end-start, localOutput);
// transcript in UNICODE ...
if (true == m_isUtf8) {
localOutput.PushBack('\0');
localOutput.push_back('\0');
output = (char*)&localOutput[0];
} else {
etk::VectorType<uniChar_t> tmpUnicodeData;
std::vector<uniChar_t> tmpUnicodeData;
// transform in unicode :
convertIsoToUnicode(m_charsetType, localOutput, tmpUnicodeData);
output = tmpUnicodeData;
@@ -202,7 +202,7 @@ int8_t EdnBuf::operator[] (int32_t pos)
* @return ---
*
*/
int32_t EdnBuf::Insert(int32_t pos, etk::VectorType<int8_t> &insertText)
int32_t EdnBuf::Insert(int32_t pos, std::vector<int8_t> &insertText)
{
// if pos is not contiguous to existing text, make it
pos = etk_avg(0, pos, m_data.Size() );
@@ -210,8 +210,8 @@ int32_t EdnBuf::Insert(int32_t pos, etk::VectorType<int8_t> &insertText)
int32_t sizeInsert=LocalInsert(pos, insertText);
// Call the redisplay ...
etk::VectorType<int8_t> deletedText;
eventModification(pos, insertText.Size(), deletedText);
std::vector<int8_t> deletedText;
eventModification(pos, insertText.size(), deletedText);
return sizeInsert;
}
int32_t EdnBuf::Insert(int32_t pos, etk::UString &insertText)
@@ -222,7 +222,7 @@ int32_t EdnBuf::Insert(int32_t pos, etk::UString &insertText)
int32_t sizeInsert=LocalInsert(pos, insertText);
// Call the redisplay ...
etk::VectorType<int8_t> deletedText;
std::vector<int8_t> deletedText;
eventModification(pos, insertText.Size(), deletedText);
return sizeInsert;
}
@@ -237,17 +237,17 @@ int32_t EdnBuf::Insert(int32_t pos, etk::UString &insertText)
* @return nb Octet inserted
*
*/
int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::VectorType<int8_t> &insertText)
int32_t EdnBuf::Replace(int32_t start, int32_t end, std::vector<int8_t> &insertText)
{
if (end-start == 0) {
return 0;
}
etk::VectorType<int8_t> deletedText;
std::vector<int8_t> deletedText;
GetRange(start, end, deletedText);
m_data.Replace(start, end-start, insertText);
// update internal elements
eventModification(start, insertText.Size(), deletedText);
return insertText.Size();
eventModification(start, insertText.size(), deletedText);
return insertText.size();
}
int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::UString &insertText)
@@ -255,32 +255,32 @@ int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::UString &insertText)
if (end-start == 0) {
return 0;
}
etk::VectorType<int8_t> deletedText;
std::vector<int8_t> deletedText;
GetRange(start, end, deletedText);
etk::VectorType<int8_t> tmpInsertText;
std::vector<int8_t> tmpInsertText;
if (true == m_isUtf8) {
char * tmpPointer = insertText.Utf8Data();
while (*tmpPointer != '\0') {
tmpInsertText.PushBack(*tmpPointer++);
tmpInsertText.push_back(*tmpPointer++);
}
} else {
etk::VectorType<unsigned int> tmppp = insertText.GetVector();
std::vector<unsigned int> tmppp = insertText.GetVector();
convertUnicodeToIso(m_charsetType, tmppp, tmpInsertText);
}
if (tmpInsertText.Size()>0) {
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
tmpInsertText.PopBack();
if (tmpInsertText.size()>0) {
if (tmpInsertText[tmpInsertText.size()-1] == '\0') {
tmpInsertText.pop_back();
}
}
if (tmpInsertText.Size()>0) {
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
tmpInsertText.PopBack();
if (tmpInsertText.size()>0) {
if (tmpInsertText[tmpInsertText.size()-1] == '\0') {
tmpInsertText.pop_back();
}
}
m_data.Replace(start, end-start, tmpInsertText);
// update internal elements
eventModification(start, tmpInsertText.Size(), deletedText);
return tmpInsertText.Size();
eventModification(start, tmpInsertText.size(), deletedText);
return tmpInsertText.size();
}
@@ -296,7 +296,7 @@ int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::UString &insertText)
void EdnBuf::Remove(int32_t start, int32_t end)
{
etk::VectorType<int8_t> deletedText;
std::vector<int8_t> deletedText;
// Make sure the arguments make sense
if (start > end) {
int32_t temp = start;
@@ -327,26 +327,26 @@ int32_t EdnBuf::Indent(void)
// Get Range :
int32_t l_start = StartOfLine(SelectionStart);
int32_t l_end = EndOfLine(SelectionEnd);
etk::VectorType<int8_t> l_tmpData;
std::vector<int8_t> l_tmpData;
GetRange(l_start, l_end, l_tmpData);
l_tmpData.Insert(0, '\n');
for (int32_t i=1; i<l_tmpData.Size(); i++) {
l_tmpData.insert(l_tmpData.begin(), '\n');
for (int32_t i=1; i<l_tmpData.size(); i++) {
if ('\n' == l_tmpData[i-1]) {
if (true == m_useTabs) {
l_tmpData.Insert(i, '\t');
l_tmpData.insert(l_tmpData.begin()+i, '\t');
} else {
for (int32_t j=0; j<m_tabDist; j++) {
l_tmpData.Insert(i, ' ');
l_tmpData.insert(l_tmpData.begin()+i, ' ');
}
}
}
}
l_tmpData.Erase(0);
l_tmpData.erase(l_tmpData.begin());
// Real replace of DATA :
Replace(l_start, l_end, l_tmpData);
// Set the new selection :
l_end = l_start + l_tmpData.Size();
l_end = l_start + l_tmpData.size();
Select(l_start, l_end);
// Return the position of the cursor
return l_end;
@@ -366,20 +366,20 @@ int32_t EdnBuf::UnIndent(void)
// Get Range :
int32_t l_start = StartOfLine(SelectionStart);
int32_t l_end = EndOfLine(SelectionEnd);
etk::VectorType<int8_t> l_tmpData;
std::vector<int8_t> l_tmpData;
GetRange(l_start, l_end, l_tmpData);
l_tmpData.Insert(0, '\n');
for (int32_t i=1; i<l_tmpData.Size(); i++) {
l_tmpData.insert(l_tmpData.begin(), '\n');
for (int32_t i=1; i<l_tmpData.size(); i++) {
if ('\n' == l_tmpData[i-1]) {
if('\t' == l_tmpData[i]) {
l_tmpData.Erase(i);
l_tmpData.erase(l_tmpData.begin()+i);
} else if(' ' == l_tmpData[i]) {
for (int32_t j=0; j<m_tabDist && j+i<l_tmpData.Size() ; j++) {
for (int32_t j=0; j<m_tabDist && j+i<l_tmpData.size() ; j++) {
if(' ' == l_tmpData[i]) {
l_tmpData.Erase(i);
l_tmpData.erase(l_tmpData.begin()+i);
} else if('\t' == l_tmpData[i]) {
l_tmpData.Erase(i);
l_tmpData.erase(l_tmpData.begin()+i);
break;
} else {
break;
@@ -388,11 +388,11 @@ int32_t EdnBuf::UnIndent(void)
}
}
}
l_tmpData.Erase(0);
l_tmpData.erase(l_tmpData.begin());
// Real replace of DATA :
Replace(l_start, l_end, l_tmpData);
// Set the new selection :
l_end = l_start + l_tmpData.Size();
l_end = l_start + l_tmpData.size();
Select(l_start, l_end);
// Return the position of the cursor
return l_end;
@@ -408,7 +408,7 @@ int32_t EdnBuf::UnIndent(void)
* @return ---
*
*/
void EdnBuf::GetLineText(int32_t pos, etk::VectorType<int8_t> &text)
void EdnBuf::GetLineText(int32_t pos, std::vector<int8_t> &text)
{
GetRange( StartOfLine(pos), EndOfLine(pos), text);
}
@@ -841,12 +841,12 @@ int32_t EdnBuf::CountLines(int32_t startPos, int32_t endPos)
* @return number of line found
*
*/
int32_t EdnBuf::CountLines(etk::VectorType<int8_t> &data)
int32_t EdnBuf::CountLines(std::vector<int8_t> &data)
{
etk::VectorType<int8_t>::Iterator myPosIt = data.Begin();
std::vector<int8_t>::iterator myPosIt = data.begin();
int32_t lineCount = 0;
while(myPosIt) {
while(myPosIt < data.end()) {
if ('\n' == *myPosIt) {
lineCount++;
}
@@ -987,20 +987,20 @@ bool EdnBuf::charMatch(char first, char second, bool caseSensitive)
*/
bool EdnBuf::SearchForward(int32_t startPos, etk::UString &search, int32_t *foundPos, int32_t *foundPosEnd, bool caseSensitive)
{
etk::VectorType<int8_t> searchVect;
std::vector<int8_t> searchVect;
if (true == m_isUtf8) {
char * tmpPointer = search.Utf8Data();
while (*tmpPointer != '\0') {
searchVect.PushBack(*tmpPointer++);
searchVect.push_back(*tmpPointer++);
}
} else {
etk::VectorType<unsigned int> tmppp = search.GetVector();
std::vector<unsigned int> tmppp = search.GetVector();
convertUnicodeToIso(m_charsetType, tmppp, searchVect);
}
// remove the '\0' at the end of the string ...
searchVect.PopBack();
searchVect.pop_back();
int32_t position;
int32_t searchLen = searchVect.Size();
int32_t searchLen = searchVect.size();
int32_t dataLen = m_data.Size();
char currentChar = '\0';
APPL_INFO(" startPos=" << startPos << " searchLen=" << searchLen);
@@ -1018,7 +1018,7 @@ bool EdnBuf::SearchForward(int32_t startPos, etk::UString &search, int32_t *foun
}
if (true == found) {
*foundPos = position;
*foundPosEnd = position + searchVect.Size();
*foundPosEnd = position + searchVect.size();
return true;
}
}
@@ -1042,21 +1042,21 @@ bool EdnBuf::SearchForward(int32_t startPos, etk::UString &search, int32_t *foun
*/
bool EdnBuf::SearchBackward(int32_t startPos, etk::UString &search, int32_t *foundPos, int32_t *foundPosEnd, bool caseSensitive)
{
etk::VectorType<int8_t> searchVect;
std::vector<int8_t> searchVect;
if (true == m_isUtf8) {
char * tmpPointer = search.Utf8Data();
while (*tmpPointer != '\0') {
searchVect.PushBack(*tmpPointer++);
searchVect.push_back(*tmpPointer++);
}
} else {
etk::VectorType<unsigned int> tmppp = search.GetVector();
std::vector<unsigned int> tmppp = search.GetVector();
convertUnicodeToIso(m_charsetType, tmppp, searchVect);
}
// remove the '\0' at the end of the string ...
searchVect.PopBack();
searchVect.pop_back();
int32_t position;
int32_t searchLen = searchVect.Size();
int32_t searchLen = searchVect.size();
char currentChar = '\0';
//APPL_INFO(" startPos=" << startPos << " searchLen=" << searchLen);
for (position=startPos; position>=searchLen-1; position--) {
@@ -1073,7 +1073,7 @@ bool EdnBuf::SearchBackward(int32_t startPos, etk::UString &search, int32_t *fou
}
if (true == found) {
*foundPos = position - (searchLen-1);
*foundPosEnd = position + searchVect.Size();
*foundPosEnd = position + searchVect.size();
return true;
}
}
@@ -1181,30 +1181,30 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
* @return number of element inserted.
*
*/
int32_t EdnBuf::LocalInsert(int32_t pos, etk::VectorType<int8_t> &insertText)
int32_t EdnBuf::LocalInsert(int32_t pos, std::vector<int8_t> &insertText)
{
// Insert data in buffer
m_data.Insert(pos, insertText);
// update the current selected area
UpdateSelection(pos, 0, insertText.Size() );
UpdateSelection(pos, 0, insertText.size() );
// return the number of element inserted ...
return insertText.Size();
return insertText.size();
}
int32_t EdnBuf::LocalInsert(int32_t pos, etk::UString &insertText)
{
etk::VectorType<int8_t> tmpInsertText;
std::vector<int8_t> tmpInsertText;
if (true == m_isUtf8) {
char * tmpPointer = insertText.Utf8Data();
while (*tmpPointer != '\0') {
tmpInsertText.PushBack(*tmpPointer++);
tmpInsertText.push_back(*tmpPointer++);
}
} else {
etk::VectorType<unsigned int> tmppp = insertText.GetVector();
std::vector<unsigned int> tmppp = insertText.GetVector();
convertUnicodeToIso(m_charsetType, tmppp, tmpInsertText);
}
if (tmpInsertText.Size()>0) {
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
tmpInsertText.PopBack();
if (tmpInsertText.size()>0) {
if (tmpInsertText[tmpInsertText.size()-1] == '\0') {
tmpInsertText.pop_back();
}
}
return LocalInsert(pos, tmpInsertText);
@@ -1221,15 +1221,15 @@ int32_t EdnBuf::LocalInsert(int32_t pos, etk::UString &insertText)
* @return ---
*
*/
void EdnBuf::eventModification(int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText)
void EdnBuf::eventModification(int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText)
{
if( 0 == deletedText.Size()
if( 0 == deletedText.size()
&& 0 == nInserted)
{
// we do nothing ...
//APPL_INFO("EdnBuf::eventModification(pos="<<pos<<", ... , nRestyled=" << nRestyled << ", deletedText=\"" << textDisplay << "\");");
} else {
APPL_INFO("(pos="<<pos<<", nDeleted="<<deletedText.Size()<<", nInserted=" << nInserted << ", deletedText=\"xx???xx\");");
APPL_INFO("(pos="<<pos<<", nDeleted="<<deletedText.size()<<", nInserted=" << nInserted << ", deletedText=\"xx???xx\");");
// update the number of lines :
//CountNumberOfLines(); //==> not efficent methode ...
// ==> better methode : just update the number of line added and removed ...
@@ -1239,24 +1239,24 @@ void EdnBuf::eventModification(int32_t pos, int32_t nInserted, etk::VectorType<i
if (false == m_isUndoProcessing) {
// normal or Redo processing
EdnBufHistory *exempleHistory = new EdnBufHistory(pos, nInserted, deletedText);
m_historyUndo.PushBack(exempleHistory);
m_historyUndo.push_back(exempleHistory);
if (false == m_isRedoProcessing) {
// remove all element in the redo system ...
int32_t i;
for (i=m_historyRedo.Size()-1; i>=0; i--) {
for (i=m_historyRedo.size()-1; i>=0; i--) {
if (NULL != m_historyRedo[i]) {
delete(m_historyRedo[i]);
}
m_historyRedo.PopBack();
m_historyRedo.pop_back();
}
}
} else {
// undo processing ==> add element in Redo vector ...
EdnBufHistory *exempleHistory = new EdnBufHistory(pos, nInserted, deletedText);
m_historyRedo.PushBack(exempleHistory);
m_historyRedo.push_back(exempleHistory);
}
// Regenerate the Highlight :
RegenerateHighLightAt(pos, deletedText.Size(), nInserted);
RegenerateHighLightAt(pos, deletedText.size(), nInserted);
}
}

View File

@@ -59,9 +59,9 @@ typedef struct {
} selection;
typedef struct {
etk::VectorType<colorInformation_ts> HLData;
int32_t posHLPass1;
int32_t posHLPass2;
std::vector<colorInformation_ts> HLData;
int32_t posHLPass1;
int32_t posHLPass2;
}displayHLData_ts;
@@ -74,24 +74,24 @@ class EdnBuf {
// destructer
~EdnBuf(void);
// public function :
void GetAll( etk::VectorType<int8_t> &text);
void SetAll( etk::VectorType<int8_t> &text);
void GetRange( int32_t start, int32_t end, etk::VectorType<int8_t> &output);
void GetAll( std::vector<int8_t> &text);
void SetAll( std::vector<int8_t> &text);
void GetRange( int32_t start, int32_t end, std::vector<int8_t> &output);
void GetRange( int32_t start, int32_t end, etk::UString &output);
bool DumpIn( FILE *myFile);
bool DumpFrom( FILE *myFile);
// replace with operator [] ...
int8_t operator[] (int32_t);
int32_t Insert( int32_t pos, etk::VectorType<int8_t> &insertText);
int32_t Insert( int32_t pos, std::vector<int8_t> &insertText);
int32_t Insert( int32_t pos, etk::UString &insertText);
int32_t Replace( int32_t start, int32_t end, etk::VectorType<int8_t> &insertText);
int32_t Replace( int32_t start, int32_t end, std::vector<int8_t> &insertText);
int32_t Replace( int32_t start, int32_t end, etk::UString &insertText);
void Remove( int32_t start, int32_t end);
int32_t Indent( void);
int32_t UnIndent( void);
void GetLineText( int32_t pos, etk::VectorType<int8_t> &text);
void GetLineText( int32_t pos, std::vector<int8_t> &text);
int32_t StartOfLine( int32_t pos);
int32_t EndOfLine( int32_t pos);
@@ -103,7 +103,7 @@ class EdnBuf {
int32_t CountForwardDispChars( int32_t lineStartPos, int32_t nChars);
int32_t CountLines( int32_t startPos, int32_t endPos);
int32_t CountLines( void);
int32_t CountLines( etk::VectorType<int8_t> &data);
int32_t CountLines( std::vector<int8_t> &data);
int32_t CountForwardNLines( int32_t startPos, int32_t nLines);
int32_t CountBackwardNLines( int32_t startPos, int32_t nLines);
@@ -126,10 +126,10 @@ class EdnBuf {
void Unselect( void);
void RectSelect( int32_t start, int32_t end, int32_t rectStart, int32_t rectEnd);
bool GetSelectionPos( int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd);
void GetSelectionText( etk::VectorType<int8_t> &text);
void GetSelectionText( std::vector<int8_t> &text);
void GetSelectionText( etk::UString &text);
void RemoveSelected( void);
int32_t ReplaceSelected( etk::VectorType<int8_t> &text);
int32_t ReplaceSelected( std::vector<int8_t> &text);
int32_t ReplaceSelected( etk::UString &text);
private:
// current selection of the buffer
@@ -140,20 +140,20 @@ class EdnBuf {
// History section :
// -----------------------------------------
public:
int32_t Undo(void);
int32_t Redo(void);
int32_t Undo(void);
int32_t Redo(void);
private:
bool m_isUndoProcessing;
bool m_isRedoProcessing;
etk::VectorType<EdnBufHistory*> m_historyUndo;
etk::VectorType<EdnBufHistory*> m_historyRedo;
bool m_isUndoProcessing;
bool m_isRedoProcessing;
std::vector<EdnBufHistory*> m_historyUndo;
std::vector<EdnBufHistory*> m_historyRedo;
// -----------------------------------------
// hightlight section :
// -----------------------------------------
private:
Highlight * m_Highlight; //!< internal link with the Highlight system
etk::VectorType<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
std::vector<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
void RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded);
void GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos=0);
void CleanHighLight(void);
@@ -197,10 +197,10 @@ class EdnBuf {
void removeSelected( selection &sel);
void replaceSelected( selection &sel, const char *text);
void eventModification( int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText);
void eventModification( int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText);
int32_t LocalInsert( int32_t pos, etk::VectorType<int8_t> &insertText);
int32_t LocalInsert( int32_t pos, std::vector<int8_t> &insertText);
int32_t LocalInsert( int32_t pos, etk::UString &insertText);
bool charMatch( char first, char second, bool caseSensitive = true);

View File

@@ -39,7 +39,7 @@ EdnBufHistory::EdnBufHistory(void)
m_nInserted = 0;
}
EdnBufHistory::EdnBufHistory(int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText)
EdnBufHistory::EdnBufHistory(int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText)
{
//APPL_INFO("EdnBufHistory new + data");
m_pos = pos;
@@ -47,7 +47,7 @@ EdnBufHistory::EdnBufHistory(int32_t pos, int32_t nInserted, etk::VectorType<int
m_deletedText = deletedText;
}
void EdnBufHistory::Set(int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText)
void EdnBufHistory::Set(int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText)
{
//APPL_INFO("EdnBufHistory new + data");
m_pos = pos;
@@ -67,7 +67,7 @@ int32_t EdnBufHistory::getPos(void)
int32_t EdnBufHistory::getnbDeleted(void)
{
return m_deletedText.Size();
return m_deletedText.size();
}
int32_t EdnBufHistory::getnbInserted(void)
@@ -75,7 +75,7 @@ int32_t EdnBufHistory::getnbInserted(void)
return m_nInserted;
}
void EdnBufHistory::getData(etk::VectorType<int8_t> &deletedText)
void EdnBufHistory::getData(std::vector<int8_t> &deletedText)
{
deletedText = m_deletedText;
}

View File

@@ -27,22 +27,22 @@
#define __EDN_BUFFER_HISTORY_H__
#include <etk/VectorType.h>
#include <vector>
class EdnBufHistory{
public:
EdnBufHistory(void);
EdnBufHistory(int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText);
EdnBufHistory(int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText);
~EdnBufHistory(void);
void Set(int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText);
void Set(int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText);
int32_t getPos(void);
int32_t getnbDeleted(void);
int32_t getnbInserted(void);
void getData(etk::VectorType<int8_t> &deletedText);
void getData(std::vector<int8_t> &deletedText);
private:
int32_t m_pos;
int32_t m_nInserted;
etk::VectorType<int8_t> m_deletedText;
std::vector<int8_t> m_deletedText;
};
#endif

View File

@@ -35,7 +35,7 @@ void EdnBuf::SetHLSystem(Highlight * newHLSystem)
{
if (m_Highlight != newHLSystem) {
m_Highlight = newHLSystem;
m_HLDataPass1.Clear();
m_HLDataPass1.clear();
RegenerateHighLightAt(0, 0, m_data.Size());
}
}
@@ -73,7 +73,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
int32_t startId;
int32_t stopId;
// clean data if needed
if (0 != m_HLDataPass1.Size()) {
if (0 != m_HLDataPass1.size()) {
// find element previous
FindMainHighLightPosition(pos, posEnd, startId, stopId, true);
@@ -81,23 +81,23 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
if( -1 == startId
&& -1 == stopId)
{
m_HLDataPass1.Clear();
m_HLDataPass1.clear();
} else if(-1 == startId) {
if (0 == stopId){
m_HLDataPass1.Erase(0);
m_HLDataPass1.erase(m_HLDataPass1.begin());
//APPL_DEBUG("1 * Erase 0");
} else {
m_HLDataPass1.EraseLen(0,stopId);
m_HLDataPass1.erase(m_HLDataPass1.begin(), m_HLDataPass1.begin()+stopId);
//APPL_DEBUG("2 * Erase 0->" << stopId);
}
} else if(-1 == stopId) {
//APPL_DEBUG("3 * Erase " << startId+1 << "-> end");
m_HLDataPass1.EraseLen(startId+1, m_HLDataPass1.Size() - startId);
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.end());
stopId = -1;
} else {
int32_t currentSize = m_HLDataPass1.Size();
int32_t currentSize = m_HLDataPass1.size();
//APPL_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
m_HLDataPass1.EraseLen(startId+1, stopId - startId);
m_HLDataPass1.erase(m_HLDataPass1.begin() + startId+1, m_HLDataPass1.begin() + stopId );
if (stopId == currentSize-1) {
stopId = -1;
}
@@ -119,7 +119,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
} else {
elemStart = startId+1;
}
for (i=elemStart; i< (int32_t)m_HLDataPass1.Size(); i++) {
for (i=elemStart; i< (int32_t)m_HLDataPass1.size(); i++) {
//APPL_DEBUG("move element=" << i);
m_HLDataPass1[i].beginStart += nbAdded - nbDeleted;
m_HLDataPass1[i].beginStop += nbAdded - nbDeleted;
@@ -137,7 +137,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
GenerateHighLightAt(0, m_HLDataPass1[0].beginStart, 0);
} else if(-1 == stopId) {
//APPL_DEBUG("******* Regenerate STOP");
GenerateHighLightAt(m_HLDataPass1[m_HLDataPass1.Size() -1].endStop, m_data.Size(), m_HLDataPass1.Size());
GenerateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].endStop, m_data.Size(), m_HLDataPass1.size());
} else {
//APPL_DEBUG("******* Regenerate RANGE");
GenerateHighLightAt(m_HLDataPass1[startId].endStop, m_HLDataPass1[startId+1].beginStart, startId+1);
@@ -202,7 +202,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
S=-1 *************** E
*/
int32_t i;
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
for (i=0; i< (int32_t)m_HLDataPass1.size(); i++) {
if (m_HLDataPass1[i].endStop > startPos) {
break;
}
@@ -223,7 +223,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
} else {
elemStart = startId+1;
}
for (i=elemStart; i< (int32_t)m_HLDataPass1.Size(); i++) {
for (i=elemStart; i< (int32_t)m_HLDataPass1.size(); i++) {
if (m_HLDataPass1[i].beginStart > endPos)
{
stopId = i;
@@ -261,7 +261,7 @@ void EdnBuf::GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos)
void EdnBuf::CleanHighLight(void)
{
// Remove all element in the list...
m_HLDataPass1.Clear();
m_HLDataPass1.clear();
}
@@ -269,7 +269,7 @@ colorInformation_ts *EdnBuf::GetElementColorAtPosition(int32_t pos, int32_t &sta
{
int32_t i;
int32_t start = etk_max(0, starPos-1);
for (i=start; i<(int32_t)m_HLDataPass1.Size(); i++) {
for (i=start; i<(int32_t)m_HLDataPass1.size(); i++) {
starPos = i;
if( m_HLDataPass1[i].beginStart <= pos
&& m_HLDataPass1[i].endStop > pos)
@@ -294,7 +294,7 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
//GTimeVal timeStart;
//g_get_current_time(&timeStart);
HLStart = StartOfLine(HLStart);
MData.HLData.Clear();
MData.HLData.clear();
int32_t HLStop = CountForwardNLines(HLStart, nbLines);
int32_t startId, stopId;
// find element previous
@@ -304,7 +304,7 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
//APPL_DEBUG("List of section between : "<< startId << " & " << stopId);
int32_t endSearch = stopId+1;
if (-1 == stopId) {
endSearch = m_HLDataPass1.Size();
endSearch = m_HLDataPass1.size();
}
for (k=etk_max(startId, 0); k<endSearch; k++) {
// empty section :
@@ -327,9 +327,9 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
//APPL_DEBUG(" ==> (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
// TODO : ...
}
if (endSearch == (int32_t)m_HLDataPass1.Size() ){
if (endSearch == (int32_t)m_HLDataPass1.size() ){
//if( k < (int32_t)m_HLDataPass1.Size()) {
if (m_HLDataPass1.Size() != 0) {
if (m_HLDataPass1.size() != 0) {
//APPL_DEBUG(" ==> (empty section 3 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<HLStop );
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
HLStop,
@@ -355,7 +355,7 @@ colorInformation_ts * EdnBuf::GetElementColorAtPosition(displayHLData_ts & MData
{
int32_t i;
int32_t start = etk_max(0, MData.posHLPass2-1);
for (i=start; i<(int32_t)MData.HLData.Size(); i++) {
for (i=start; i<(int32_t)MData.HLData.size(); i++) {
MData.posHLPass2 = i;
if( MData.HLData[i].beginStart <= pos
&& MData.HLData[i].endStop > pos)

View File

@@ -36,7 +36,7 @@
int32_t EdnBuf::Undo(void)
{
int32_t nbElement = m_historyUndo.Size();
int32_t nbElement = m_historyUndo.size();
//APPL_DEBUG("EdnBuf::Undo Request id="<<nbElement);
int32_t posDest = -1;
if (0 == nbElement) {
@@ -47,13 +47,13 @@ int32_t EdnBuf::Undo(void)
nbElement--;
if (m_historyUndo[nbElement] == NULL) {
APPL_ERROR("EdnBuf::Undo Find empty history ==> remove it");
m_historyUndo.PopBack();
m_historyUndo.pop_back();
return -1;
}
int32_t pos = m_historyUndo[nbElement]->getPos();
int32_t nbDeleted = m_historyUndo[nbElement]->getnbDeleted();
int32_t nbInserted = m_historyUndo[nbElement]->getnbInserted();
etk::VectorType<int8_t> deletedText;
std::vector<int8_t> deletedText;
m_historyUndo[nbElement]->getData(deletedText);
m_isUndoProcessing = true;
if (0 == nbInserted) {
@@ -77,14 +77,14 @@ int32_t EdnBuf::Undo(void)
}
// remove element in the list :
delete(m_historyUndo[nbElement]);
m_historyUndo.PopBack();
m_historyUndo.pop_back();
m_isUndoProcessing = false;
return posDest;
}
int32_t EdnBuf::Redo(void)
{
int32_t nbElement = m_historyRedo.Size();
int32_t nbElement = m_historyRedo.size();
//APPL_DEBUG("EdnBuf::Redo Request id="<<nbElement);
int32_t posDest = -1;
if (0 == nbElement) {
@@ -95,13 +95,13 @@ int32_t EdnBuf::Redo(void)
nbElement--;
if (m_historyRedo[nbElement] == NULL) {
APPL_ERROR("EdnBuf::Redo Find empty history ==> remove it");
m_historyRedo.PopBack();
m_historyRedo.pop_back();
return -1;
}
int32_t pos = m_historyRedo[nbElement]->getPos();
int32_t nbDeleted = m_historyRedo[nbElement]->getnbDeleted();
int32_t nbInserted = m_historyRedo[nbElement]->getnbInserted();
etk::VectorType<int8_t> deletedText;
std::vector<int8_t> deletedText;
m_historyRedo[nbElement]->getData(deletedText);
m_isRedoProcessing = true;
if (0 == nbInserted) {
@@ -125,7 +125,7 @@ int32_t EdnBuf::Redo(void)
}
// remove element in the list :
delete(m_historyRedo[nbElement]);
m_historyRedo.PopBack();
m_historyRedo.pop_back();
m_isRedoProcessing = false;
return posDest;
}

View File

@@ -136,12 +136,12 @@ bool EdnBuf::GetSelectionPos(int32_t &start, int32_t &end, bool &isRect, int32_t
* @return ---
*
*/
void EdnBuf::GetSelectionText(etk::VectorType<int8_t> &text)
void EdnBuf::GetSelectionText(std::vector<int8_t> &text)
{
int32_t start, end, rectStart, rectEnd;
bool isRect;
// remove output data
text.Clear();
text.clear();
bool isSelected = GetSelectionPos(start, end, isRect, rectStart, rectEnd);
@@ -220,7 +220,7 @@ void EdnBuf::RemoveSelected(void)
* @return ---
*
*/
int32_t EdnBuf::ReplaceSelected(etk::VectorType<int8_t> &text)
int32_t EdnBuf::ReplaceSelected(std::vector<int8_t> &text)
{
int32_t start, end, rectStart, rectEnd;
bool isRect;

View File

@@ -225,18 +225,26 @@ int8_t& EdnVectorBuf::Get(int32_t pos)
* @return ---
*
*/
void EdnVectorBuf::Get(int32_t pos, int32_t nbElement, etk::VectorType<int8_t> &tmpBuffer)
void EdnVectorBuf::Get(int32_t pos, int32_t nbElement, std::vector<int8_t> &tmpBuffer)
{
tmpBuffer.Clear();
tmpBuffer.clear();
if (pos < m_gapStart) {
if (pos + nbElement < m_gapStart) {
tmpBuffer.PushBack(&m_data[pos], nbElement);
for (int32_t iii = 0 ; iii < nbElement; iii++) {
tmpBuffer.push_back(m_data[pos + iii]);
}
} else {
tmpBuffer.PushBack(&m_data[pos], m_gapStart - pos);
tmpBuffer.PushBack(&m_data[m_gapEnd], nbElement - (m_gapStart - pos) );
for (int32_t iii = 0 ; iii < m_gapStart-pos; iii++) {
tmpBuffer.push_back(m_data[pos + iii]);
}
for (int32_t iii = 0 ; iii < nbElement - (m_gapStart - pos); iii++) {
tmpBuffer.push_back(m_data[m_gapEnd + iii]);
}
}
} else {
tmpBuffer.PushBack(&m_data[pos+(m_gapEnd-m_gapStart)], nbElement);
for (int32_t iii = 0 ; iii < nbElement; iii++) {
tmpBuffer.push_back(m_data[pos+(m_gapEnd-m_gapStart)+iii]);
}
}
}
@@ -397,15 +405,15 @@ void EdnVectorBuf::Insert(int32_t pos, const int8_t& item)
* @return ---
*
*/
void EdnVectorBuf::Insert(int32_t pos, etk::VectorType<int8_t>& items)
void EdnVectorBuf::Insert(int32_t pos, std::vector<int8_t>& items)
{
if( pos > Size()
|| pos < 0 ) {
APPL_ERROR("Request higher than buffer size : pos="<<pos<< " bufferSize="<<Size());
return;
}
if( items.Size() > GapSize() ) {
if (false == GapResize(pos, GAP_SIZE_MIN + items.Size()) ) {
if( items.size() > GapSize() ) {
if (false == GapResize(pos, GAP_SIZE_MIN + items.size()) ) {
return;
}
} else {
@@ -414,10 +422,10 @@ void EdnVectorBuf::Insert(int32_t pos, etk::VectorType<int8_t>& items)
}
}
int32_t i;
for(i=0; i<items.Size(); i++) {
for(i=0; i<items.size(); i++) {
m_data[m_gapStart+i] = items[i];
}
m_gapStart += items.Size();
m_gapStart += items.size();
}
@@ -453,7 +461,7 @@ void EdnVectorBuf::Replace(int32_t pos, const int8_t& item)
* @return ---
*
*/
void EdnVectorBuf::Replace(int32_t pos, int32_t nbRemoveElement, etk::VectorType<int8_t>& items)
void EdnVectorBuf::Replace(int32_t pos, int32_t nbRemoveElement, std::vector<int8_t>& items)
{
if( pos > Size()
|| pos < 0 ) {
@@ -600,105 +608,3 @@ void EdnVectorBuf::Display(void)
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void TestEdnVectorBuf(void)
{
EdnVectorBuf myBufferTmp;
int32_t i;
//invert data
for (i=0; i<50; i++) {
myBufferTmp.Insert(0, 'a' + i%26);
}
myBufferTmp.Display();
myBufferTmp.Clear();
myBufferTmp.Display();
myBufferTmp.Remove(2, 300);
/*
char plop='a';
myBufferTmp.Insert(0, plop);
myBufferTmp.Display();
plop='b';
myBufferTmp.Insert(0, plop);
myBufferTmp.Display();
plop='c';
myBufferTmp.Insert(0, plop);
myBufferTmp.Display();
plop='d';
myBufferTmp.Insert(0, plop);
myBufferTmp.Display();
plop='e';
myBufferTmp.Insert(0, plop);
myBufferTmp.Display();
plop='f';
myBufferTmp.Insert(0, plop);
myBufferTmp.Display();
plop='g';
myBufferTmp.Insert(0, plop);
myBufferTmp.Display();
plop='h';
myBufferTmp.Insert(0, plop);
myBufferTmp.Display();
plop='m';
etk::VectorType<int8_t> items;
items.PushBack('i');
items.PushBack('j');
items.PushBack('k');
items.PushBack('l');
items.PushBack('m');
items.PushBack('n');
items.PushBack('o');
items.PushBack('p');
myBufferTmp.Insert(3, items);
myBufferTmp.Display();
plop='7';
myBufferTmp.Insert(7, plop);
myBufferTmp.Display();
myBufferTmp.Replace(8, 'z');
myBufferTmp.Display();
items.Clear();
items.PushBack('1');
items.PushBack('2');
items.PushBack('3');
myBufferTmp.Replace(10, 4, items);
myBufferTmp.Display();
myBufferTmp.PushBack('a');
myBufferTmp.PushBack('a');
myBufferTmp.PushBack('a');
myBufferTmp.PushBack('a');
myBufferTmp.Display();
myBufferTmp.PopBack();
myBufferTmp.PopBack();
myBufferTmp.PopBack();
myBufferTmp.PopBack();
myBufferTmp.Display();
myBufferTmp.Remove(2, 3);
myBufferTmp.Display();
*/
}

View File

@@ -26,7 +26,7 @@
#ifndef __EDN_VECTOR_BUF_H__
#define __EDN_VECTOR_BUF_H__
#include <etk/VectorType.h>
#include <vector>
#undef __class__
#define __class__ "EdnVectorBuf"
@@ -271,14 +271,14 @@ class EdnVectorBuf
EdnVectorBuf & operator=( const EdnVectorBuf & Evb);
int8_t operator[] (int32_t pos);
int8_t & Get( int32_t pos);
void Get( int32_t pos, int32_t nbElement, etk::VectorType<int8_t> &tmpBuffer);
void Get( int32_t pos, int32_t nbElement, std::vector<int8_t> &tmpBuffer);
// insert functions
void PushBack( const int8_t& item);
void Insert( int32_t pos, const int8_t& item);
void Insert( int32_t pos, etk::VectorType<int8_t>& items);
void Insert( int32_t pos, std::vector<int8_t>& items);
// Remove and insert functions
void Replace( int32_t pos, const int8_t& item);
void Replace( int32_t pos, int32_t nbRemoveElement, etk::VectorType<int8_t>& items);
void Replace( int32_t pos, int32_t nbRemoveElement, std::vector<int8_t>& items);
// Revove fonctions
void Remove( int32_t pos, int32_t nbRemoveElement = 1);
void PopBack( void);
@@ -300,6 +300,7 @@ class EdnVectorBuf
* @return The number requested
*/
int32_t Size(void) { return m_allocated - GapSize(); };
int32_t size(void) { return m_allocated - GapSize(); };
Iterator Position(int32_t pos)
{
@@ -336,6 +337,5 @@ class EdnVectorBuf
#undef __class__
#define __class__ NULL
void TestEdnVectorBuf(void);
#endif