HL : Correction of a bug of reparsing the buffer betwwen 2 element Erase was not implemented as std::vector ==> I might change this ...

This commit is contained in:
2011-08-09 14:28:58 +02:00
parent 5a47446a09
commit d96a133c6a
5 changed files with 35 additions and 60 deletions

View File

@@ -186,9 +186,10 @@ void Highlight::Display(void)
//m_listHighlightPass2[i]->Display();
}
}
// 13h 46min 22s | (l= 214) Highlight::Parse | [II] Find Pattern in the Buffer : (2457,2479)
// TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas tr\Uffffffffgrave... 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<EFBFBD>grave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer...
void Highlight::Parse(int32_t start,
int32_t stop,
Edn::VectorType<colorInformation_ts> &metaData,
@@ -205,8 +206,7 @@ void Highlight::Parse(int32_t start,
while (elementStart<elementStop) {
//EDN_DEBUG("Parse element in the buffer id=" << elementStart);
//try to fond the HL in ALL of we have
int32_t jjj;
for (jjj=0; jjj<m_listHighlightPass1.Size(); jjj++){
for (int32_t jjj=0; jjj<m_listHighlightPass1.Size(); jjj++){
resultFind_te ret = HLP_FIND_OK;
//EDN_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" );
// Stop the search to the end (to get the end of the pattern)
@@ -218,6 +218,7 @@ void Highlight::Parse(int32_t start,
while(kkk < metaData.Size() ) {
if (metaData[kkk].beginStart <= resultat.endStop) {
// Remove element
//EDN_INFO("Erase element=" << kkk);
metaData.Erase(kkk, kkk+1);
// Increase the end of search
if (kkk < metaData.Size()) {

View File

@@ -60,8 +60,17 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
return;
}
// normal case
EDN_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");");
//EDN_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");");
int32_t i;
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
Edn::String ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
}
EDN_DEBUG("HighLight (previous) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
}
*/
int32_t posEnd = pos + nbDeleted;
// search position of the old element to reparse IT...
int32_t startId;
@@ -79,15 +88,29 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
} else if(-1 == startId) {
if (0 == stopId){
m_HLDataPass1.Erase(0);
//EDN_DEBUG("1 * Erase 0");
} else {
m_HLDataPass1.Erase(0,stopId);
//EDN_DEBUG("2 * Erase 0->" << stopId);
}
} else if(-1 == stopId) {
m_HLDataPass1.Erase(startId+1, m_HLDataPass1.Size());
//EDN_DEBUG("3 * Erase " << startId+1 << "-> end");
m_HLDataPass1.Erase(startId+1, m_HLDataPass1.Size() - startId);
stopId = -1;
} else {
m_HLDataPass1.Erase(startId+1, stopId);
//EDN_DEBUG("4 * Erase " << startId+1 << "->" << stopId);
m_HLDataPass1.Erase(startId+1, stopId - startId);
}
EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.Size()-1);
//EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.Size()-1);
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
Edn::String ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
}
EDN_DEBUG("HighLight (Middle) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
}
*/
// update position after the range position :
int32_t elemStart;
if(-1 == startId) {
@@ -123,13 +146,15 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
//GenerateHighLightAt(pos, nbAdded);
GenerateHighLightAt(0, m_data.Size());
}
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
Edn::String ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
}
//EDN_DEBUG("HighLight element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp.c_str() );
EDN_DEBUG("HighLight (end) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
}
*/
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_DEBUG("HL General = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");

View File

@@ -36,8 +36,6 @@
*
* @tparam[in] SIZE Size of the current element.
*
* @todo : Need to add : popBack / Assign / Insert / Erase / Swap / Clear
*
* m_data
* <------------ m_dataSize ------------>
* ----------------------------------------