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

This reverts commit 4012d75279df3f5226373a9d33a1df1372db71d5.
This commit is contained in:
Edouard Dupin 2012-08-09 14:26:30 +02:00
parent 7ee4747cc2
commit a20f3e4063
20 changed files with 383 additions and 292 deletions

View File

@ -1 +0,0 @@
APP_STL := stlport_static

View File

@ -80,7 +80,7 @@ class classBufferManager: public ewol::EObject
private: private:
std::vector<Buffer*> listBuffer; //!< element List of the char Elements etk::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
void RemoveAll(void); //!< remove all buffer void RemoveAll(void); //!< remove all buffer
int32_t m_idSelected; int32_t m_idSelected;
@ -125,7 +125,7 @@ classBufferManager::~classBufferManager(void)
RemoveAll(); RemoveAll();
// clear The list of Buffer // clear The list of Buffer
APPL_INFO("~classBufferManager::listBuffer.Clear();"); APPL_INFO("~classBufferManager::listBuffer.Clear();");
listBuffer.clear(); listBuffer.Clear();
APPL_INFO("~classBufferManager::delete(BufferNotExiste);"); APPL_INFO("~classBufferManager::delete(BufferNotExiste);");
delete(BufferNotExiste); delete(BufferNotExiste);
} }
@ -235,7 +235,7 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch
} }
// try next buffer // try next buffer
if (-1 == destBuffer) { 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) ) { if (true == Exist(ii) ) {
destBuffer = ii; destBuffer = ii;
break; break;
@ -305,7 +305,7 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch
void classBufferManager::RemoveAll(void) void classBufferManager::RemoveAll(void)
{ {
int32_t i; int32_t i;
for (i=0; i<listBuffer.size(); i++) { for (i=0; i<listBuffer.Size(); i++) {
Remove(i); Remove(i);
} }
SendMultiCast(ednMsgGuiClose, "All"); SendMultiCast(ednMsgGuiClose, "All");
@ -326,8 +326,8 @@ int32_t classBufferManager::Create(void)
// allocate a new Buffer // allocate a new Buffer
Buffer *myBuffer = new BufferText(); Buffer *myBuffer = new BufferText();
// Add at the list of element // Add at the list of element
listBuffer.push_back(myBuffer); listBuffer.PushBack(myBuffer);
int32_t basicID = listBuffer.size() - 1; int32_t basicID = listBuffer.Size() - 1;
return basicID; return basicID;
} }
@ -348,8 +348,8 @@ int32_t classBufferManager::Open(etk::File &myFile)
// allocate a new Buffer // allocate a new Buffer
Buffer *myBuffer = new BufferText(myFile); Buffer *myBuffer = new BufferText(myFile);
// Add at the list of element // Add at the list of element
listBuffer.push_back(myBuffer); listBuffer.PushBack(myBuffer);
return listBuffer.size() - 1; return listBuffer.Size() - 1;
} else { } else {
// the buffer already existed ==> we open it ... // the buffer already existed ==> we open it ...
return GetId(myFile); return GetId(myFile);
@ -365,7 +365,7 @@ Buffer * classBufferManager::Get(int32_t BufferID)
return BufferNotExiste; return BufferNotExiste;
} }
// check if the Buffer existed // check if the Buffer existed
if (BufferID < listBuffer.size()) { if (BufferID < listBuffer.Size()) {
// check if the buffer already existed // check if the buffer already existed
if (NULL != listBuffer[BufferID]) { if (NULL != listBuffer[BufferID]) {
return listBuffer[BufferID]; return listBuffer[BufferID];
@ -373,7 +373,7 @@ Buffer * classBufferManager::Get(int32_t BufferID)
APPL_ERROR("non existing Buffer " << BufferID); APPL_ERROR("non existing Buffer " << BufferID);
} }
} else { } 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; return BufferNotExiste;
} }
@ -385,7 +385,7 @@ bool classBufferManager::Exist(int32_t BufferID)
return false; return false;
} }
// check if the Buffer existed // check if the Buffer existed
if (BufferID < listBuffer.size()) { if (BufferID < listBuffer.Size()) {
// check if the buffer already existed // check if the buffer already existed
if (NULL != listBuffer[BufferID]) { if (NULL != listBuffer[BufferID]) {
return true; return true;
@ -408,7 +408,7 @@ int32_t classBufferManager::GetId(etk::File &myFile)
{ {
int32_t iii; int32_t iii;
// check if the Buffer existed // 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 // check if the buffer already existed
if (NULL != listBuffer[iii]) { if (NULL != listBuffer[iii]) {
if ( listBuffer[iii]->GetFileName() == myFile) { 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 // return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t classBufferManager::Size(void) uint32_t classBufferManager::Size(void)
{ {
return listBuffer.size(); return listBuffer.Size();
} }
// nb of opens file Now ... // nb of opens file Now ...
@ -431,7 +431,7 @@ uint32_t classBufferManager::SizeOpen(void)
{ {
uint32_t jjj = 0; uint32_t jjj = 0;
// check if the Buffer existed // 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 // check if the buffer already existed
if (NULL != listBuffer[iii]) { if (NULL != listBuffer[iii]) {
jjj++; jjj++;
@ -454,7 +454,7 @@ bool classBufferManager::Remove(int32_t BufferID)
return false; return false;
} }
// check if the Buffer existed // check if the Buffer existed
if (BufferID < listBuffer.size()) { if (BufferID < listBuffer.Size()) {
// check if the buffer already existed // check if the buffer already existed
if (NULL != listBuffer[BufferID]) { if (NULL != listBuffer[BufferID]) {
// TODO : Check if it saved... // TODO : Check if it saved...
@ -475,7 +475,7 @@ bool classBufferManager::Remove(int32_t BufferID)
return false; return false;
} }
} else { } 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; return false;
} }
} }
@ -491,7 +491,7 @@ bool classBufferManager::Remove(int32_t BufferID)
int32_t classBufferManager::WitchBuffer(int32_t iEmeElement) int32_t classBufferManager::WitchBuffer(int32_t iEmeElement)
{ {
int32_t i; int32_t i;
for (i=0; i<listBuffer.size(); i++) { for (i=0; i<listBuffer.Size(); i++) {
if (NULL != listBuffer[i]) { if (NULL != listBuffer[i]) {
iEmeElement--; iEmeElement--;
// find the element : // 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); bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
if (unicodeData == 0x09) { if (unicodeData == 0x09) {
if (false == haveSelectionActive) { if (false == haveSelectionActive) {
std::vector<int8_t> tmpVect; etk::VectorType<int8_t> tmpVect;
tmpVect.push_back(0x09); tmpVect.PushBack(0x09);
m_EdnBuf.Insert(m_cursorPos, tmpVect); m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+1, true); SetInsertPosition(m_cursorPos+1, true);
} else { } else {
@ -922,10 +922,10 @@ void BufferText::AddChar(uniChar_t unicodeData)
// count the number of line : // count the number of line :
int32_t nbSelectedLines = m_EdnBuf.CountLines(SelectionStart, SelectionEnd); int32_t nbSelectedLines = m_EdnBuf.CountLines(SelectionStart, SelectionEnd);
if (0 == nbSelectedLines) { if (0 == nbSelectedLines) {
std::vector<int8_t> tmpVect; etk::VectorType<int8_t> tmpVect;
tmpVect.push_back(0x09); tmpVect.PushBack(0x09);
m_EdnBuf.ReplaceSelected(tmpVect); m_EdnBuf.ReplaceSelected(tmpVect);
SetInsertPosition(SelectionStart+tmpVect.size(), true); SetInsertPosition(SelectionStart+tmpVect.Size(), true);
} else { } else {
if (true == ewol::IsSetShift() ) { if (true == ewol::IsSetShift() ) {
m_cursorPos = m_EdnBuf.UnIndent(); m_cursorPos = m_EdnBuf.UnIndent();
@ -935,11 +935,11 @@ void BufferText::AddChar(uniChar_t unicodeData)
} }
} }
} else if (unicodeData == '\n') { } else if (unicodeData == '\n') {
std::vector<int8_t> tmpVect; etk::VectorType<int8_t> tmpVect;
if (true == ewol::IsSetShift()) { if (true == ewol::IsSetShift()) {
tmpVect.push_back('\r'); tmpVect.PushBack('\r');
} else { } else {
tmpVect.push_back('\n'); tmpVect.PushBack('\n');
// if Auto indent Enable ==> we get the start of the previous line and add it to tne new one // if Auto indent Enable ==> we get the start of the previous line and add it to tne new one
if (true == globals::IsSetAutoIndent() ) { if (true == globals::IsSetAutoIndent() ) {
int32_t l_lineStart; int32_t l_lineStart;
@ -952,9 +952,9 @@ void BufferText::AddChar(uniChar_t unicodeData)
// add same characters in the temporar buffer // add same characters in the temporar buffer
for (int32_t kk=l_lineStart; kk<m_cursorPos; kk++) { for (int32_t kk=l_lineStart; kk<m_cursorPos; kk++) {
if (' ' == m_EdnBuf[kk]) { if (' ' == m_EdnBuf[kk]) {
tmpVect.push_back(' '); tmpVect.PushBack(' ');
} else if('\t' == m_EdnBuf[kk]) { } else if('\t' == m_EdnBuf[kk]) {
tmpVect.push_back('\t'); tmpVect.PushBack('\t');
} else { } else {
break; break;
} }
@ -964,10 +964,10 @@ void BufferText::AddChar(uniChar_t unicodeData)
// Set temporary buffer in the real buffer // Set temporary buffer in the real buffer
if (false == haveSelectionActive) { if (false == haveSelectionActive) {
m_EdnBuf.Insert(m_cursorPos, tmpVect); m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+tmpVect.size(), true); SetInsertPosition(m_cursorPos+tmpVect.Size(), true);
} else { } else {
m_EdnBuf.ReplaceSelected(tmpVect); m_EdnBuf.ReplaceSelected(tmpVect);
SetInsertPosition(SelectionStart+tmpVect.size(), true); SetInsertPosition(SelectionStart+tmpVect.Size(), true);
} }
} else if (unicodeData == 0x7F ) { } else if (unicodeData == 0x7F ) {
//APPL_INFO("keyEvent : <Suppr> pos=" << m_cursorPos); //APPL_INFO("keyEvent : <Suppr> pos=" << m_cursorPos);
@ -991,11 +991,9 @@ void BufferText::AddChar(uniChar_t unicodeData)
if (true == m_EdnBuf.GetUTF8Mode()) { if (true == m_EdnBuf.GetUTF8Mode()) {
char tmpUTF8[16]; char tmpUTF8[16];
unicode::convertUnicodeToUtf8(unicodeData, tmpUTF8); unicode::convertUnicodeToUtf8(unicodeData, tmpUTF8);
std::vector<int8_t> tmpVect; etk::VectorType<int8_t> tmpVect;
int32_t localOfset = strlen(tmpUTF8); int32_t localOfset = strlen(tmpUTF8);
for (int32_t iii=0; iii<localOfset ; iii++) { tmpVect.PushBack((int8_t*)tmpUTF8, localOfset);
tmpVect.push_back(tmpUTF8[iii]);
}
if (false == haveSelectionActive) { if (false == haveSelectionActive) {
m_EdnBuf.Insert(m_cursorPos, tmpVect); m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+localOfset, true); SetInsertPosition(m_cursorPos+localOfset, true);
@ -1008,8 +1006,8 @@ void BufferText::AddChar(uniChar_t unicodeData)
char output_ISO; char output_ISO;
unicode::convertUnicodeToIso(m_EdnBuf.GetCharsetType(), unicodeData, output_ISO); unicode::convertUnicodeToIso(m_EdnBuf.GetCharsetType(), unicodeData, output_ISO);
//printf(" insert : \"%s\"==> 0x%08x=%d ", UTF8data, (unsigned int)output_ISO, (int)output_ISO); //printf(" insert : \"%s\"==> 0x%08x=%d ", UTF8data, (unsigned int)output_ISO, (int)output_ISO);
std::vector<int8_t> tmpVect; etk::VectorType<int8_t> tmpVect;
tmpVect.push_back(output_ISO); tmpVect.PushBack(output_ISO);
if (false == haveSelectionActive) { if (false == haveSelectionActive) {
m_EdnBuf.Insert(m_cursorPos, tmpVect); m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+1, true); SetInsertPosition(m_cursorPos+1, true);
@ -1032,7 +1030,7 @@ int32_t BufferText::FindLine(etk::UString &data)
return 0; return 0;
} }
APPL_INFO("Search data line : \"" << data << "\""); APPL_INFO("Search data line : \"" << data << "\"");
std::vector<uniChar_t> mVectSearch; etk::VectorType<uniChar_t> mVectSearch;
mVectSearch = data.GetVector(); mVectSearch = data.GetVector();
//APPL_INFO("search data Forward : startSearchPos=" << startSearchPos ); //APPL_INFO("search data Forward : startSearchPos=" << startSearchPos );
/* /*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -225,26 +225,18 @@ int8_t& EdnVectorBuf::Get(int32_t pos)
* @return --- * @return ---
* *
*/ */
void EdnVectorBuf::Get(int32_t pos, int32_t nbElement, std::vector<int8_t> &tmpBuffer) void EdnVectorBuf::Get(int32_t pos, int32_t nbElement, etk::VectorType<int8_t> &tmpBuffer)
{ {
tmpBuffer.clear(); tmpBuffer.Clear();
if (pos < m_gapStart) { if (pos < m_gapStart) {
if (pos + nbElement < m_gapStart) { if (pos + nbElement < m_gapStart) {
for (int32_t iii = 0 ; iii < nbElement; iii++) { tmpBuffer.PushBack(&m_data[pos], nbElement);
tmpBuffer.push_back(m_data[pos + iii]);
}
} else { } else {
for (int32_t iii = 0 ; iii < m_gapStart-pos; iii++) { tmpBuffer.PushBack(&m_data[pos], m_gapStart - pos);
tmpBuffer.push_back(m_data[pos + iii]); tmpBuffer.PushBack(&m_data[m_gapEnd], nbElement - (m_gapStart - pos) );
}
for (int32_t iii = 0 ; iii < nbElement - (m_gapStart - pos); iii++) {
tmpBuffer.push_back(m_data[m_gapEnd + iii]);
}
} }
} else { } else {
for (int32_t iii = 0 ; iii < nbElement; iii++) { tmpBuffer.PushBack(&m_data[pos+(m_gapEnd-m_gapStart)], nbElement);
tmpBuffer.push_back(m_data[pos+(m_gapEnd-m_gapStart)+iii]);
}
} }
} }
@ -405,15 +397,15 @@ void EdnVectorBuf::Insert(int32_t pos, const int8_t& item)
* @return --- * @return ---
* *
*/ */
void EdnVectorBuf::Insert(int32_t pos, std::vector<int8_t>& items) void EdnVectorBuf::Insert(int32_t pos, etk::VectorType<int8_t>& items)
{ {
if( pos > Size() if( pos > Size()
|| pos < 0 ) { || pos < 0 ) {
APPL_ERROR("Request higher than buffer size : pos="<<pos<< " bufferSize="<<Size()); APPL_ERROR("Request higher than buffer size : pos="<<pos<< " bufferSize="<<Size());
return; return;
} }
if( items.size() > GapSize() ) { if( items.Size() > GapSize() ) {
if (false == GapResize(pos, GAP_SIZE_MIN + items.size()) ) { if (false == GapResize(pos, GAP_SIZE_MIN + items.Size()) ) {
return; return;
} }
} else { } else {
@ -422,10 +414,10 @@ void EdnVectorBuf::Insert(int32_t pos, std::vector<int8_t>& items)
} }
} }
int32_t i; 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_data[m_gapStart+i] = items[i];
} }
m_gapStart += items.size(); m_gapStart += items.Size();
} }
@ -461,7 +453,7 @@ void EdnVectorBuf::Replace(int32_t pos, const int8_t& item)
* @return --- * @return ---
* *
*/ */
void EdnVectorBuf::Replace(int32_t pos, int32_t nbRemoveElement, std::vector<int8_t>& items) void EdnVectorBuf::Replace(int32_t pos, int32_t nbRemoveElement, etk::VectorType<int8_t>& items)
{ {
if( pos > Size() if( pos > Size()
|| pos < 0 ) { || pos < 0 ) {
@ -608,3 +600,105 @@ 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__ #ifndef __EDN_VECTOR_BUF_H__
#define __EDN_VECTOR_BUF_H__ #define __EDN_VECTOR_BUF_H__
#include <vector> #include <etk/VectorType.h>
#undef __class__ #undef __class__
#define __class__ "EdnVectorBuf" #define __class__ "EdnVectorBuf"
@ -271,14 +271,14 @@ class EdnVectorBuf
EdnVectorBuf & operator=( const EdnVectorBuf & Evb); EdnVectorBuf & operator=( const EdnVectorBuf & Evb);
int8_t operator[] (int32_t pos); int8_t operator[] (int32_t pos);
int8_t & Get( int32_t pos); int8_t & Get( int32_t pos);
void Get( int32_t pos, int32_t nbElement, std::vector<int8_t> &tmpBuffer); void Get( int32_t pos, int32_t nbElement, etk::VectorType<int8_t> &tmpBuffer);
// insert functions // insert functions
void PushBack( const int8_t& item); void PushBack( const int8_t& item);
void Insert( int32_t pos, const int8_t& item); void Insert( int32_t pos, const int8_t& item);
void Insert( int32_t pos, std::vector<int8_t>& items); void Insert( int32_t pos, etk::VectorType<int8_t>& items);
// Remove and insert functions // Remove and insert functions
void Replace( int32_t pos, const int8_t& item); void Replace( int32_t pos, const int8_t& item);
void Replace( int32_t pos, int32_t nbRemoveElement, std::vector<int8_t>& items); void Replace( int32_t pos, int32_t nbRemoveElement, etk::VectorType<int8_t>& items);
// Revove fonctions // Revove fonctions
void Remove( int32_t pos, int32_t nbRemoveElement = 1); void Remove( int32_t pos, int32_t nbRemoveElement = 1);
void PopBack( void); void PopBack( void);
@ -300,7 +300,6 @@ class EdnVectorBuf
* @return The number requested * @return The number requested
*/ */
int32_t Size(void) { return m_allocated - GapSize(); }; int32_t Size(void) { return m_allocated - GapSize(); };
int32_t size(void) { return m_allocated - GapSize(); };
Iterator Position(int32_t pos) Iterator Position(int32_t pos)
{ {
@ -337,5 +336,6 @@ class EdnVectorBuf
#undef __class__ #undef __class__
#define __class__ NULL #define __class__ NULL
void TestEdnVectorBuf(void);
#endif #endif

View File

@ -67,10 +67,10 @@ class classColorManager: public ewol::EObject
void DisplayListOfColor(void); void DisplayListOfColor(void);
private: private:
etk::UString m_fileColor; etk::UString m_fileColor;
std::vector<Colorize*> listMyColor; //!< List of ALL Color etk::VectorType<Colorize*> listMyColor; //!< List of ALL Color
Colorize * errorColor; Colorize * errorColor;
color_ts basicColors[COLOR_NUMBER_MAX]; color_ts basicColors[COLOR_NUMBER_MAX];
}; };
@ -85,14 +85,14 @@ classColorManager::~classColorManager(void)
int32_t i; int32_t i;
// clean all Element // clean all Element
for (i=0; i< listMyColor.size(); i++) { for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) { if (NULL != listMyColor[i]) {
delete(listMyColor[i]); delete(listMyColor[i]);
listMyColor[i] = NULL; listMyColor[i] = NULL;
} }
} }
// clear the compleate list // clear the compleate list
listMyColor.clear(); listMyColor.Clear();
} }
void classColorManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) void classColorManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
@ -125,14 +125,14 @@ void classColorManager::LoadFile(const char * xmlFilename)
// Remove all old color : // Remove all old color :
int32_t i; int32_t i;
// clean all Element // clean all Element
for (i=0; i< listMyColor.size(); i++) { for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) { if (NULL != listMyColor[i]) {
delete(listMyColor[i]); delete(listMyColor[i]);
listMyColor[i] = NULL; listMyColor[i] = NULL;
} }
} }
// clear the compleate list // clear the compleate list
listMyColor.clear(); listMyColor.Clear();
m_fileColor = xmlFilename; m_fileColor = xmlFilename;
APPL_DEBUG("open file (COLOR) \"" << xmlFilename << "\" ? = \"" << m_fileColor << "\""); APPL_DEBUG("open file (COLOR) \"" << xmlFilename << "\" ? = \"" << m_fileColor << "\"");
@ -275,7 +275,7 @@ void classColorManager::LoadFile(const char * xmlFilename)
myNewColor->SetItalic(true); myNewColor->SetItalic(true);
} }
} }
listMyColor.push_back(myNewColor); listMyColor.PushBack(myNewColor);
} else { } else {
APPL_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [color]"); APPL_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [color]");
} }
@ -299,7 +299,7 @@ void classColorManager::LoadFile(const char * xmlFilename)
Colorize *classColorManager::Get(const char *colorName) Colorize *classColorManager::Get(const char *colorName)
{ {
int32_t i; int32_t i;
for (i=0; i<listMyColor.size(); i++) { for (i=0; i<listMyColor.Size(); i++) {
etk::UString elementName = listMyColor[i]->GetName(); etk::UString elementName = listMyColor[i]->GetName();
if (elementName == colorName) { if (elementName == colorName) {
return listMyColor[i]; return listMyColor[i];
@ -330,7 +330,7 @@ color_ts & classColorManager::Get(basicColor_te myColor)
bool classColorManager::Exist(const char *colorName) bool classColorManager::Exist(const char *colorName)
{ {
int32_t i; int32_t i;
for (i=0; i<listMyColor.size(); i++) { for (i=0; i<listMyColor.Size(); i++) {
etk::UString elementName = listMyColor[i]->GetName(); etk::UString elementName = listMyColor[i]->GetName();
if (elementName == colorName) { if (elementName == colorName) {
return true; return true;
@ -349,7 +349,7 @@ void classColorManager::DisplayListOfColor(void)
{ {
int32_t i; int32_t i;
APPL_INFO(PFX"List of ALL COLOR : "); APPL_INFO(PFX"List of ALL COLOR : ");
for (i=0; i<listMyColor.size(); i++) { for (i=0; i<listMyColor.Size(); i++) {
//etk::UString elementName = listMyColor[i]->GetName(); //etk::UString elementName = listMyColor[i]->GetName();
//APPL_INFO(i << " : \"" << elementName.c_str() << "\"" ); //APPL_INFO(i << " : \"" << elementName.c_str() << "\"" );
listMyColor[i]->Display(i); listMyColor[i]->Display(i);

View File

@ -54,7 +54,7 @@ CodeView::CodeView(void)
m_bufferID = -1; m_bufferID = -1;
m_buttunOneSelected = false; m_buttunOneSelected = false;
m_lineNumberList.clear(); m_lineNumberList.Clear();
m_textColorFg = etk::color::color_Black; m_textColorFg = etk::color::color_Black;
@ -91,11 +91,11 @@ void CodeView::UpdateNumberOfLineReference(int32_t bufferID)
Vector2D<float> tmpCoord; Vector2D<float> tmpCoord;
tmpCoord.x = 0; tmpCoord.x = 0;
tmpCoord.y = 0; tmpCoord.y = 0;
if (m_lineNumberList.size()<=bufferID) { if (m_lineNumberList.Size()<=bufferID) {
// update the number of elements : // update the number of elements :
for (int32_t iii=m_lineNumberList.size(); iii <= bufferID; iii++) { for (int32_t iii=m_lineNumberList.Size(); iii <= bufferID; iii++) {
// add start line at 0 : // add start line at 0 :
m_lineNumberList.push_back(tmpCoord); m_lineNumberList.PushBack(tmpCoord);
} }
} }
} }
@ -289,7 +289,7 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
if(eventId == ednMsgBufferId) { if(eventId == ednMsgBufferId) {
//keep the reference of the display offset : //keep the reference of the display offset :
if( m_bufferID >=0 if( m_bufferID >=0
&& m_bufferID < m_lineNumberList.size()) { && m_bufferID < m_lineNumberList.Size()) {
m_lineNumberList[m_bufferID] = m_originScrooled; m_lineNumberList[m_bufferID] = m_originScrooled;
} }
int32_t bufferID = 0; int32_t bufferID = 0;
@ -301,7 +301,7 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
UpdateNumberOfLineReference(m_bufferID); UpdateNumberOfLineReference(m_bufferID);
// set back if needed the display position ... // set back if needed the display position ...
if( m_bufferID >=0 if( m_bufferID >=0
&& m_bufferID < m_lineNumberList.size()) { && m_bufferID < m_lineNumberList.Size()) {
m_originScrooled = m_lineNumberList[m_bufferID]; m_originScrooled = m_lineNumberList[m_bufferID];
} }
} else if (eventId == ednMsgGuiCopy) { } else if (eventId == ednMsgGuiCopy) {

View File

@ -48,19 +48,19 @@ class CodeView :public ewol::WidgetScrooled
const char * const GetObjectType(void) { return "ApplCodeView"; }; const char * const GetObjectType(void) { return "ApplCodeView"; };
virtual bool CalculateMinSize(void); virtual bool CalculateMinSize(void);
private: private:
etk::UString m_label; etk::UString m_label;
color_ts m_textColorFg; //!< Text color color_ts m_textColorFg; //!< Text color
color_ts m_textColorBg; //!< Background color color_ts m_textColorBg; //!< Background color
int32_t m_bufferID; int32_t m_bufferID;
bool m_buttunOneSelected; bool m_buttunOneSelected;
std::vector<Vector2D<float> > m_lineNumberList; etk::VectorType<Vector2D<float> > m_lineNumberList;
void UpdateNumberOfLineReference(int32_t bufferID); void UpdateNumberOfLineReference(int32_t bufferID);
// drawing elements : // drawing elements :
ewol::OObject2DTextColored m_OObjectTextNormal[NB_BOUBLE_BUFFER]; ewol::OObject2DTextColored m_OObjectTextNormal[NB_BOUBLE_BUFFER];
ewol::OObject2DTextColored m_OObjectTextBold[NB_BOUBLE_BUFFER]; ewol::OObject2DTextColored m_OObjectTextBold[NB_BOUBLE_BUFFER];
ewol::OObject2DTextColored m_OObjectTextItalic[NB_BOUBLE_BUFFER]; ewol::OObject2DTextColored m_OObjectTextItalic[NB_BOUBLE_BUFFER];
ewol::OObject2DTextColored m_OObjectTextBoldItalic[NB_BOUBLE_BUFFER]; ewol::OObject2DTextColored m_OObjectTextBoldItalic[NB_BOUBLE_BUFFER];
ewol::OObject2DColored m_OObjectsColored[NB_BOUBLE_BUFFER]; ewol::OObject2DColored m_OObjectsColored[NB_BOUBLE_BUFFER];
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);

View File

@ -33,14 +33,14 @@
#define __class__ "Highlight" #define __class__ "Highlight"
void Highlight::ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level) void Highlight::ParseRules(TiXmlNode *child, etk::VectorType<HighlightPattern*> &mListPatern, int32_t level)
{ {
// Create the patern ... // Create the patern ...
HighlightPattern *myPattern = new HighlightPattern(); HighlightPattern *myPattern = new HighlightPattern();
// parse under Element // parse under Element
myPattern->ParseRules(child, level); myPattern->ParseRules(child, level);
// add element in the list // add element in the list
mListPatern.push_back(myPattern); mListPatern.PushBack(myPattern);
} }
@ -100,7 +100,7 @@ Highlight::Highlight(etk::UString &xmlFilename)
if (NULL != myData) { if (NULL != myData) {
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData); //APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
etk::UString * myEdnData = new etk::UString(myData); etk::UString * myEdnData = new etk::UString(myData);
m_listExtentions.push_back(myEdnData); m_listExtentions.PushBack(myEdnData);
} }
} else if (!strcmp(child->Value(), "pass1")) { } else if (!strcmp(child->Value(), "pass1")) {
// Get sub Nodes ... // Get sub Nodes ...
@ -145,35 +145,35 @@ Highlight::~Highlight(void)
{ {
int32_t i; int32_t i;
// clean all Element // clean all Element
for (i=0; i< m_listHighlightPass1.size(); i++) { for (i=0; i< m_listHighlightPass1.Size(); i++) {
if (NULL != m_listHighlightPass1[i]) { if (NULL != m_listHighlightPass1[i]) {
delete(m_listHighlightPass1[i]); delete(m_listHighlightPass1[i]);
m_listHighlightPass1[i] = NULL; m_listHighlightPass1[i] = NULL;
} }
} }
// clear the compleate list // clear the compleate list
m_listHighlightPass1.clear(); m_listHighlightPass1.Clear();
// clean all Element // clean all Element
for (i=0; i< m_listExtentions.size(); i++) { for (i=0; i< m_listExtentions.Size(); i++) {
if (NULL != m_listExtentions[i]) { if (NULL != m_listExtentions[i]) {
delete(m_listExtentions[i]); delete(m_listExtentions[i]);
m_listExtentions[i] = NULL; m_listExtentions[i] = NULL;
} }
} }
// clear the compleate list // clear the compleate list
m_listExtentions.clear(); m_listExtentions.Clear();
} }
void Highlight::ReloadColor(void) void Highlight::ReloadColor(void)
{ {
int32_t i; int32_t i;
for (i=0; i< m_listHighlightPass1.size(); i++) { for (i=0; i< m_listHighlightPass1.Size(); i++) {
if (NULL != m_listHighlightPass1[i]) { if (NULL != m_listHighlightPass1[i]) {
m_listHighlightPass1[i]->ReloadColor(); m_listHighlightPass1[i]->ReloadColor();
} }
} }
for (i=0; i< m_listHighlightPass2.size(); i++) { for (i=0; i< m_listHighlightPass2.Size(); i++) {
if (NULL != m_listHighlightPass2[i]) { if (NULL != m_listHighlightPass2[i]) {
m_listHighlightPass2[i]->ReloadColor(); m_listHighlightPass2[i]->ReloadColor();
} }
@ -183,7 +183,7 @@ void Highlight::ReloadColor(void)
bool Highlight::HasExtention(etk::UString &ext) bool Highlight::HasExtention(etk::UString &ext)
{ {
int32_t i; int32_t i;
for (i=0; i<m_listExtentions.size(); i++) { for (i=0; i<m_listExtentions.Size(); i++) {
if (ext == *m_listExtentions[i] ) { if (ext == *m_listExtentions[i] ) {
return true; return true;
} }
@ -203,7 +203,7 @@ bool Highlight::FileNameCompatible(etk::File &fileName)
} }
APPL_DEBUG(" try to find : in \"" << fileName << "\" extention:\"" << extention << "\" "); APPL_DEBUG(" try to find : in \"" << fileName << "\" extention:\"" << extention << "\" ");
for (i=0; i<m_listExtentions.size(); i++) { for (i=0; i<m_listExtentions.Size(); i++) {
if (extention == *m_listExtentions[i] ) { if (extention == *m_listExtentions[i] ) {
return true; return true;
} }
@ -216,16 +216,16 @@ void Highlight::Display(void)
{ {
int32_t i; int32_t i;
APPL_INFO("List of ALL Highlight : "); APPL_INFO("List of ALL Highlight : ");
for (i=0; i< m_listExtentions.size(); i++) { for (i=0; i< m_listExtentions.Size(); i++) {
APPL_INFO(" Extention : " << i << " : " << *m_listExtentions[i] ); APPL_INFO(" Extention : " << i << " : " << *m_listExtentions[i] );
} }
// Display all elements // Display all elements
for (i=0; i< m_listHighlightPass1.size(); i++) { for (i=0; i< m_listHighlightPass1.Size(); i++) {
APPL_INFO(" " << i << " Pass 1 : " << m_listHighlightPass1[i]->GetName() ); APPL_INFO(" " << i << " Pass 1 : " << m_listHighlightPass1[i]->GetName() );
//m_listHighlightPass1[i]->Display(); //m_listHighlightPass1[i]->Display();
} }
// Display all elements // Display all elements
for (i=0; i< m_listHighlightPass2.size(); i++) { for (i=0; i< m_listHighlightPass2.Size(); i++) {
APPL_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName() ); APPL_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName() );
//m_listHighlightPass2[i]->Display(); //m_listHighlightPass2[i]->Display();
} }
@ -236,7 +236,7 @@ void Highlight::Display(void)
// TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas trègrave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer... // TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas trègrave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer...
void Highlight::Parse(int32_t start, void Highlight::Parse(int32_t start,
int32_t stop, int32_t stop,
std::vector<colorInformation_ts> &metaData, etk::VectorType<colorInformation_ts> &metaData,
int32_t addingPos, int32_t addingPos,
EdnVectorBuf &buffer) EdnVectorBuf &buffer)
{ {
@ -250,27 +250,27 @@ void Highlight::Parse(int32_t start,
while (elementStart<elementStop) { while (elementStart<elementStop) {
//APPL_DEBUG("Parse element in the buffer id=" << elementStart); //APPL_DEBUG("Parse element in the buffer id=" << elementStart);
//try to fond the HL in ALL of we have //try to fond the HL in ALL of we have
for (int32_t jjj=0; jjj<m_listHighlightPass1.size(); jjj++){ for (int32_t jjj=0; jjj<m_listHighlightPass1.Size(); jjj++){
resultFind_te ret = HLP_FIND_OK; resultFind_te ret = HLP_FIND_OK;
//APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" ); //APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" );
// Stop the search to the end (to get the end of the pattern) // Stop the search to the end (to get the end of the pattern)
ret = m_listHighlightPass1[jjj]->Find(elementStart, buffer.size(), resultat, buffer); ret = m_listHighlightPass1[jjj]->Find(elementStart, buffer.Size(), resultat, buffer);
if (HLP_FIND_ERROR != ret) { if (HLP_FIND_ERROR != ret) {
//APPL_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" ); //APPL_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// Remove element in the current List where the current Element have a end inside the next... // Remove element in the current List where the current Element have a end inside the next...
int32_t kkk=addingPos; int32_t kkk=addingPos;
while(kkk < metaData.size() ) { while(kkk < metaData.Size() ) {
if (metaData[kkk].beginStart <= resultat.endStop) { if (metaData[kkk].beginStart <= resultat.endStop) {
// Remove element // Remove element
//APPL_INFO("Erase element=" << kkk); //APPL_INFO("Erase element=" << kkk);
metaData.erase(metaData.begin()+kkk, metaData.begin()+kkk+1); metaData.EraseLen(kkk, kkk+1);
// Increase the end of search // Increase the end of search
if (kkk < metaData.size()) { if (kkk < metaData.Size()) {
// just befor the end of the next element // just befor the end of the next element
elementStop = metaData[kkk].beginStart-1; elementStop = metaData[kkk].beginStart-1;
} else { } else {
// end of the buffer // end of the buffer
elementStop = buffer.size(); elementStop = buffer.Size();
} }
} else { } else {
// Not find ==> exit the cycle : // Not find ==> exit the cycle :
@ -278,7 +278,7 @@ void Highlight::Parse(int32_t start,
} }
} }
// Add curent element in the list ... // Add curent element in the list ...
metaData.insert(metaData.begin()+addingPos, resultat); metaData.Insert(addingPos, resultat);
//APPL_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop ); //APPL_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop );
// Update the current research starting element: (Set position at the end of the current element // Update the current research starting element: (Set position at the end of the current element
elementStart = resultat.endStop-1; elementStart = resultat.endStop-1;
@ -300,7 +300,7 @@ void Highlight::Parse(int32_t start,
*/ */
void Highlight::Parse2(int32_t start, void Highlight::Parse2(int32_t start,
int32_t stop, int32_t stop,
std::vector<colorInformation_ts> &metaData, etk::VectorType<colorInformation_ts> &metaData,
EdnVectorBuf &buffer) EdnVectorBuf &buffer)
{ {
//APPL_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() << " ==> position search: (" << start << "," << stop << ")" ); //APPL_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() << " ==> position search: (" << start << "," << stop << ")" );
@ -311,7 +311,7 @@ void Highlight::Parse2(int32_t start,
//APPL_DEBUG("Parse element in the buffer id=" << elementStart); //APPL_DEBUG("Parse element in the buffer id=" << elementStart);
//try to fond the HL in ALL of we have //try to fond the HL in ALL of we have
int32_t jjj; int32_t jjj;
for (jjj=0; jjj<m_listHighlightPass2.size(); jjj++){ for (jjj=0; jjj<m_listHighlightPass2.Size(); jjj++){
resultFind_te ret = HLP_FIND_OK; resultFind_te ret = HLP_FIND_OK;
//APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" ); //APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" );
// Stop the search to the end (to get the end of the pattern) // Stop the search to the end (to get the end of the pattern)
@ -319,7 +319,7 @@ void Highlight::Parse2(int32_t start,
if (HLP_FIND_ERROR != ret) { if (HLP_FIND_ERROR != ret) {
//APPL_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" ); //APPL_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// Add curent element in the list ... // Add curent element in the list ...
metaData.push_back(resultat); metaData.PushBack(resultat);
elementStart = resultat.endStop-1; elementStart = resultat.endStop-1;
// Exit current cycle // Exit current cycle
break; break;

View File

@ -59,19 +59,19 @@ class Highlight {
void ReloadColor(void); void ReloadColor(void);
void Parse(int32_t start, void Parse(int32_t start,
int32_t stop, int32_t stop,
std::vector<colorInformation_ts> &metaData, etk::VectorType<colorInformation_ts> &metaData,
int32_t addingPos, int32_t addingPos,
EdnVectorBuf &buffer); EdnVectorBuf &buffer);
void Parse2(int32_t start, void Parse2(int32_t start,
int32_t stop, int32_t stop,
std::vector<colorInformation_ts> &metaData, etk::VectorType<colorInformation_ts> &metaData,
EdnVectorBuf &buffer); EdnVectorBuf &buffer);
private: private:
void ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level); void ParseRules(TiXmlNode *child, etk::VectorType<HighlightPattern*> &mListPatern, int32_t level);
etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash") etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
std::vector<etk::UString*> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h" etk::VectorType<etk::UString*> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
std::vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer) etk::VectorType<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer)
std::vector<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) ) etk::VectorType<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) )
}; };

View File

@ -35,7 +35,7 @@
class localClassHighlightManager: public ewol::EObject class localClassHighlightManager: public ewol::EObject
{ {
private: private:
std::vector<Highlight*> listHighlight; //!< List of ALL hightlight modules etk::VectorType<Highlight*> listHighlight; //!< List of ALL hightlight modules
public: public:
// Constructeur // Constructeur
localClassHighlightManager(void) { localClassHighlightManager(void) {
@ -44,14 +44,14 @@ class localClassHighlightManager: public ewol::EObject
~localClassHighlightManager(void) { ~localClassHighlightManager(void) {
int32_t i; int32_t i;
// clean all Element // clean all Element
for (i=0; i< listHighlight.size(); i++) { for (i=0; i< listHighlight.Size(); i++) {
if (NULL != listHighlight[i]) { if (NULL != listHighlight[i]) {
delete(listHighlight[i]); delete(listHighlight[i]);
listHighlight[i] = NULL; listHighlight[i] = NULL;
} }
} }
// clear the compleate list // clear the compleate list
listHighlight.clear(); listHighlight.Clear();
}; };
/** /**
@ -92,7 +92,7 @@ class localClassHighlightManager: public ewol::EObject
Highlight* Get(etk::File &fileName) Highlight* Get(etk::File &fileName)
{ {
int32_t i; int32_t i;
for (i=0; i<listHighlight.size(); i++) { for (i=0; i<listHighlight.Size(); i++) {
if (true == listHighlight[i]->FileNameCompatible(fileName) ) { if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
return listHighlight[i]; return listHighlight[i];
} }
@ -113,47 +113,47 @@ class localClassHighlightManager: public ewol::EObject
{ {
etk::UString xmlFilename = "lang_c.xml"; etk::UString xmlFilename = "lang_c.xml";
Highlight *myHightline = new Highlight(xmlFilename); Highlight *myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = "lang_boo.xml"; xmlFilename = "lang_boo.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = "lang_Makefile.xml"; xmlFilename = "lang_Makefile.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = "lang_asm.xml"; xmlFilename = "lang_asm.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = "lang_xml.xml"; xmlFilename = "lang_xml.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = "lang_php.xml"; xmlFilename = "lang_php.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = "lang_bash.xml"; xmlFilename = "lang_bash.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = "lang_matlab.xml"; xmlFilename = "lang_matlab.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = "lang_java.xml"; xmlFilename = "lang_java.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = "lang_lua.xml"; xmlFilename = "lang_lua.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = "lang_in.xml"; xmlFilename = "lang_in.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
//myHightline->Display(); //myHightline->Display();
} }

View File

@ -118,7 +118,7 @@ void HighlightPattern::Display(void)
} }
*/ */
// Display all elements // Display all elements
for (int32_t i=0; i< m_subPatern.size(); i++) { for (int32_t i=0; i< m_subPatern.Size(); i++) {
APPL_INFO(" " << i << " SubPattern : " << m_subPatern[i]->GetName() ); APPL_INFO(" " << i << " SubPattern : " << m_subPatern[i]->GetName() );
m_subPatern[i]->Display(); m_subPatern[i]->Display();
} }

View File

@ -33,7 +33,7 @@ class HighlightPattern;
#include <etk/RegExp.h> #include <etk/RegExp.h>
#include <Colorize.h> #include <Colorize.h>
#include <vector> #include <etk/VectorType.h>
#include <tinyXML/tinyxml.h> #include <tinyXML/tinyxml.h>
#include <EdnVectorBuf.h> #include <EdnVectorBuf.h>
@ -72,17 +72,17 @@ class HighlightPattern {
void ReloadColor(void); void ReloadColor(void);
private: private:
int32_t m_level; //!< Level of the pattern ==> this is to overwrite next pattern when we create an higher .... int32_t m_level; //!< Level of the pattern ==> this is to overwrite next pattern when we create an higher ....
etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash") etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
etk::UString m_colorName; //!< Current color name etk::UString m_colorName; //!< Current color name
Colorize * m_color; //!< Link to the color manager Colorize * m_color; //!< Link to the color manager
etk::RegExp<EdnVectorBuf> * m_regExpStart; //!< Start of Regular expression etk::RegExp<EdnVectorBuf> * m_regExpStart; //!< Start of Regular expression
etk::RegExp<EdnVectorBuf> * m_regExpStop; //!< Stop of Regular Expression etk::RegExp<EdnVectorBuf> * m_regExpStop; //!< Stop of Regular Expression
bool m_haveStopPatern; //!< Stop patern presence bool m_haveStopPatern; //!< Stop patern presence
bool m_multiline; //!< The patern is multiline bool m_multiline; //!< The patern is multiline
uniChar_t m_escapeChar; //!< Escape char to prevent exeit of patern .... uniChar_t m_escapeChar; //!< Escape char to prevent exeit of patern ....
std::vector<HighlightPattern *> m_subPatern; //!< Under patern of this one etk::VectorType<HighlightPattern *> m_subPatern; //!< Under patern of this one
// std::vector<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ... // etk::VectorType<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
}; };
#endif #endif