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

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

View File

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

View File

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

View File

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

View File

@@ -118,7 +118,7 @@ void HighlightPattern::Display(void)
}
*/
// 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() );
m_subPatern[i]->Display();
}

View File

@@ -33,7 +33,7 @@ class HighlightPattern;
#include <etk/RegExp.h>
#include <Colorize.h>
#include <etk/VectorType.h>
#include <vector>
#include <tinyXML/tinyxml.h>
#include <EdnVectorBuf.h>
@@ -72,17 +72,17 @@ class HighlightPattern {
void ReloadColor(void);
private:
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_colorName; //!< Current color name
Colorize * m_color; //!< Link to the color manager
etk::RegExp<EdnVectorBuf> * m_regExpStart; //!< Start of Regular expression
etk::RegExp<EdnVectorBuf> * m_regExpStop; //!< Stop of Regular Expression
bool m_haveStopPatern; //!< Stop patern presence
bool m_multiline; //!< The patern is multiline
uniChar_t m_escapeChar; //!< Escape char to prevent exeit of patern ....
etk::VectorType<HighlightPattern *> m_subPatern; //!< Under patern of this one
// etk::VectorType<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
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_colorName; //!< Current color name
Colorize * m_color; //!< Link to the color manager
etk::RegExp<EdnVectorBuf> * m_regExpStart; //!< Start of Regular expression
etk::RegExp<EdnVectorBuf> * m_regExpStop; //!< Stop of Regular Expression
bool m_haveStopPatern; //!< Stop patern presence
bool m_multiline; //!< The patern is multiline
uniChar_t m_escapeChar; //!< Escape char to prevent exeit of patern ....
std::vector<HighlightPattern *> m_subPatern; //!< Under patern of this one
// std::vector<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
};
#endif