error whith the Highlight detection

This commit is contained in:
2011-08-07 10:47:06 +02:00
parent 322120a3f3
commit 45b4dca615
16 changed files with 96 additions and 46 deletions

View File

@@ -52,7 +52,7 @@ Highlight::Highlight(Edn::String &xmlFilename)
// open the curent File
bool loadError = XmlDocument.LoadFile(xmlFilename.c_str());
if (false == loadError) {
EDN_ERROR( "can not load Hightlight XML: PARSING error: \"" << xmlFilename.c_str() << "\"");
EDN_ERROR( "can not load Hightlight XML: PARSING error: \"" << xmlFilename << "\"");
return;
}
TiXmlElement* root = XmlDocument.FirstChildElement( "EdnLang" );
@@ -134,24 +134,17 @@ bool Highlight::HasExtention(Edn::String &ext)
return false;
}
bool Highlight::FileNameCompatible(Edn::String &fileName)
bool Highlight::FileNameCompatible(Edn::File &fileName)
{
uint32_t i;
int32_t posCopy = fileName.FindBack('/');
Edn::String shortFilename;
if (-1 != posCopy) {
shortFilename = fileName.Extract(posCopy+1);
} else {
shortFilename = fileName;
}
posCopy = shortFilename.FindBack('.');
Edn::String extention;
if (-1 != posCopy) {
extention = shortFilename.Extract(posCopy);
if (true == fileName.HasExtention() ) {
extention = "*.";
extention += fileName.GetExtention();
} else {
extention = shortFilename;
extention = fileName.GetShortFilename();
}
EDN_DEBUG(" try to find : in \"" << fileName.c_str() << "\" shortfilename\"" << shortFilename.c_str() << "\" extention:\"" << extention.c_str() << "\" ");
EDN_DEBUG(" try to find : in \"" << fileName << "\" extention:\"" << extention << "\" ");
for (i=0; i<m_listExtentions.size(); i++) {
if (extention == m_listExtentions[i] ) {
@@ -167,16 +160,16 @@ void Highlight::Display(void)
uint32_t i;
EDN_INFO("List of ALL Highlight : ");
for (i=0; i< m_listExtentions.size(); i++) {
EDN_INFO(" Extention : " << i << " : " << m_listExtentions[i].c_str() );
EDN_INFO(" Extention : " << i << " : " << m_listExtentions[i] );
}
// Display all elements
for (i=0; i< m_listHighlightPass1.size(); i++) {
EDN_INFO(" " << i << " Pass 1 : " << m_listHighlightPass1[i]->GetName().c_str() );
EDN_INFO(" " << i << " Pass 1 : " << m_listHighlightPass1[i]->GetName() );
//m_listHighlightPass1[i]->Display();
}
// Display all elements
for (i=0; i< m_listHighlightPass2.size(); i++) {
EDN_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName().c_str() );
EDN_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName() );
//m_listHighlightPass2[i]->Display();
}
}

View File

@@ -55,7 +55,7 @@ class Highlight {
Highlight(Edn::String &xmlFilename);
~Highlight(void);
bool HasExtention(Edn::String &ext);
bool FileNameCompatible(Edn::String &fileName);
bool FileNameCompatible(Edn::File &fileName);
void Display(void);
void Parse( int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, int32_t &addingPos, EdnVectorBuf &buffer, int32_t elementID=0);
void Parse2(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, EdnVectorBuf &buffer, int32_t elementID=0);

View File

@@ -41,7 +41,7 @@ HighlightManager::~HighlightManager(void)
}
Highlight *HighlightManager::Get(Edn::String &fileName)
Highlight *HighlightManager::Get(Edn::File &fileName)
{
uint32_t i;
for (i=0; i<listHighlight.size(); i++) {
@@ -52,13 +52,10 @@ Highlight *HighlightManager::Get(Edn::String &fileName)
return NULL;
}
bool HighlightManager::Exist(Edn::String &fileName)
bool HighlightManager::Exist(Edn::File &fileName)
{
uint32_t i;
for (i=0; i<listHighlight.size(); i++) {
if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
return true;
}
if (NULL != Get(fileName) ) {
return true;
}
return false;
}

View File

@@ -45,8 +45,8 @@ class HighlightManager: public Singleton<HighlightManager>
public:
void loadLanguages(void);
Highlight * Get(Edn::String &fileName);
bool Exist(Edn::String &fileName);
Highlight * Get(Edn::File &fileName);
bool Exist(Edn::File &fileName);
private:
std::vector<Highlight*> listHighlight; //!< List of ALL hightlight modules

View File

@@ -98,10 +98,10 @@ bool HighlightPattern::IsEnable(void)
void HighlightPattern::Display(void)
{
/*
EDN_INFO("patern : \"" << m_paternName.c_str() << "\" level=" << m_level );
EDN_INFO(" ==> colorName \"" << m_colorName.c_str() << "\"");
EDN_INFO(" ==> regExpStart \"" << m_regExpStart->GetRegExp().c_str() << "\"");
EDN_INFO(" ==> regExpStop \"" << m_regExpStop->GetRegExp().c_str() << "\"");
EDN_INFO("patern : \"" << m_paternName << "\" level=" << m_level );
EDN_INFO(" ==> colorName \"" << m_colorName << "\"");
EDN_INFO(" ==> regExpStart \"" << m_regExpStart->GetRegExp() << "\"");
EDN_INFO(" ==> regExpStop \"" << m_regExpStop->GetRegExp() << "\"");
if (true == m_haveStopPatern) {
EDN_INFO(" ==> stop pattern: YES");
} else {
@@ -115,7 +115,7 @@ void HighlightPattern::Display(void)
*/
// Display all elements
for (int32_t i=0; i< m_subPatern.Size(); i++) {
EDN_INFO(" " << i << " SubPattern : " << m_subPatern[i]->GetName().c_str() );
EDN_INFO(" " << i << " SubPattern : " << m_subPatern[i]->GetName() );
m_subPatern[i]->Display();
}
}