SYS : Add a Edn:VectorType eraseLen and an erase ==> normalisation with std::vector

This commit is contained in:
Edouard Dupin 2011-09-01 14:33:58 +02:00
parent 28b709bfb8
commit 88b76c074d
6 changed files with 40 additions and 12 deletions

View File

@ -233,7 +233,7 @@ void Highlight::Parse(int32_t start,
if (metaData[kkk].beginStart <= resultat.endStop) { if (metaData[kkk].beginStart <= resultat.endStop) {
// Remove element // Remove element
//EDN_INFO("Erase element=" << kkk); //EDN_INFO("Erase element=" << kkk);
metaData.Erase(kkk, 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

View File

@ -170,7 +170,7 @@ void CTagsManager::AddToHistory(int32_t bufferID)
for(int32_t iii= m_historyPos; iii < m_historyList.Size(); iii++) { for(int32_t iii= m_historyPos; iii < m_historyList.Size(); iii++) {
delete(m_historyList[iii]); delete(m_historyList[iii]);
} }
m_historyList.Erase(m_historyPos, m_historyList.Size() - m_historyPos); m_historyList.EraseLen(m_historyPos, m_historyList.Size() - m_historyPos);
} }
// add the current element // add the current element
BufferManager *myBufferManager = BufferManager::getInstance(); BufferManager *myBufferManager = BufferManager::getInstance();

View File

@ -90,17 +90,17 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
m_HLDataPass1.Erase(0); m_HLDataPass1.Erase(0);
//EDN_DEBUG("1 * Erase 0"); //EDN_DEBUG("1 * Erase 0");
} else { } else {
m_HLDataPass1.Erase(0,stopId); m_HLDataPass1.EraseLen(0,stopId);
//EDN_DEBUG("2 * Erase 0->" << stopId); //EDN_DEBUG("2 * Erase 0->" << stopId);
} }
} else if(-1 == stopId) { } else if(-1 == stopId) {
//EDN_DEBUG("3 * Erase " << startId+1 << "-> end"); //EDN_DEBUG("3 * Erase " << startId+1 << "-> end");
m_HLDataPass1.Erase(startId+1, m_HLDataPass1.Size() - startId); 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();
//EDN_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" ); //EDN_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
m_HLDataPass1.Erase(startId+1, stopId - startId); m_HLDataPass1.EraseLen(startId+1, stopId - startId);
if (stopId == currentSize-1) { if (stopId == currentSize-1) {
stopId = -1; stopId = -1;
} }

View File

@ -471,7 +471,7 @@ void Edn::String::Remove(int32_t currentID, int32_t len)
return; return;
} }
// TODO : check the size of the data // TODO : check the size of the data
m_data.Erase(currentID, len); m_data.EraseLen(currentID, len);
} }

View File

@ -474,7 +474,33 @@ template<typename MY_TYPE=int32_t> class VectorType
} }
/** /**
* @brief Remove one element * @brief Remove N elements
*
* @param[in] pos Position to remove the data
* @param[in] posEnd Last position number
*
* @return ---
*
*/
void Erase(int32_t pos, int32_t posEnd)
{
if (pos>m_size) {
EDN_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
return;
}
if (posEnd>m_size) {
posEnd = m_size;
}
int32_t nbElement = m_size - pos;
int32_t tmpSize = m_size;
// move curent data
memmove((m_data + pos), (m_data + pos + nbElement), (tmpSize - (pos+nbElement))*sizeof(MY_TYPE) );
// Request resize of the current buffer
Resize(m_size-nbElement);
}
/**
* @brief Remove N element
* *
* @param[in] pos Position to remove the data * @param[in] pos Position to remove the data
* @param[in] nbElement number of element to remove * @param[in] nbElement number of element to remove
@ -482,10 +508,10 @@ template<typename MY_TYPE=int32_t> class VectorType
* @return --- * @return ---
* *
*/ */
void Erase(int32_t pos, int32_t nbElement) void EraseLen(int32_t pos, int32_t nbElement)
{ {
if (pos>m_size) { if (pos>m_size) {
EDN_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size); EDN_ERROR(" can not Erase Len Element at this position : " << pos << " > " << m_size);
return; return;
} }
if (pos+nbElement>m_size) { if (pos+nbElement>m_size) {

View File

@ -15,19 +15,21 @@
- Project manager phase 1 - Project manager phase 1
# action a faire (ordonner par révision) : # action a faire (ordonner par révision) :
* 0.1.X :
- Edn::VectorType : Rewrite the erase fuction to support start => stop and Erase len methode ...
* 0.2.X : * 0.2.X :
- gui : Amelioration du full-screen et du display de base (sans l'entete de la fenetre)
- gui : Mise en place d'un display ligne par ligne - gui : Mise en place d'un display ligne par ligne
- gui : ascenceur quand nécessaire
- gui : Demander la création de nouveaux fichier quand il n'existe pas (a l'ouverture en ligne de commande) - gui : Demander la création de nouveaux fichier quand il n'existe pas (a l'ouverture en ligne de commande)
- sys : Mise en place des colorisation de base pour le - sys : Mise en place des colorisation de base pour le
* java script * java script
* SQL * SQL
- gui : ascenceur quand nécessaire
- Catch Shift+TAB - Catch Shift+TAB
- Correction du bug des entré bizard tel que les chapot et les guillemets - Correction du bug des entré bizard tel que les chapot et les guillemets
- pb de sélection quand la ligne est pleine et la première ligne séctionnée. - pb de sélection quand la ligne est pleine et la première ligne séctionnée.
- PB de copier coller sur les éàè ... - PB de copier coller sur les éàè ...
- PB sur le caplock et les caractère multiples type chapot ...
- PB du entrer sur le kaypad qui fait un <CR> ==> ajouter la fonction shift+enter qui cree un <CR>
- catch F[1-12] ==> for user function
* 0.3.X : * 0.3.X :
- Charset UTF-8 et iso 8859-15 correcte - Charset UTF-8 et iso 8859-15 correcte
- Transformation de charset a la volée - Transformation de charset a la volée