[DEV] code style step 1
This commit is contained in:
@@ -23,7 +23,7 @@ void Highlight::ParseRules(exml::Element* child, etk::Vector<HighlightPattern*>
|
||||
// parse under Element
|
||||
myPattern->ParseRules(child, level);
|
||||
// add element in the list
|
||||
mListPatern.PushBack(myPattern);
|
||||
mListPatern.pushBack(myPattern);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ void Highlight::ParseRules(exml::Element* child, etk::Vector<HighlightPattern*>
|
||||
Highlight::Highlight(const etk::UString& _xmlFilename)
|
||||
{
|
||||
exml::Document doc;
|
||||
if (doc.Load(_xmlFilename)==false) {
|
||||
if (doc.load(_xmlFilename) == false) {
|
||||
APPL_ERROR(" can not load file XML : " << _xmlFilename);
|
||||
return;
|
||||
}
|
||||
exml::Element* root = (exml::Element*)doc.GetNamed("EdnLang");
|
||||
exml::Element* root = (exml::Element*)doc.getNamed("EdnLang");
|
||||
if (NULL == root ) {
|
||||
APPL_ERROR("(l ?) main node not find: \"EdnLang\" ...");
|
||||
return;
|
||||
@@ -43,46 +43,46 @@ Highlight::Highlight(const etk::UString& _xmlFilename)
|
||||
int32_t level1 = 0;
|
||||
int32_t level2 = 0;
|
||||
// parse all the elements :
|
||||
for(int32_t iii=0; iii< root->Size(); iii++) {
|
||||
exml::Element* child = root->GetElement(iii);
|
||||
if (child==NULL) {
|
||||
for(int32_t iii=0; iii< root->size(); iii++) {
|
||||
exml::Element* child = root->getElement(iii);
|
||||
if (child == NULL) {
|
||||
// trash here all that is not element ...
|
||||
continue;
|
||||
}
|
||||
if (child->GetValue() == "ext") {
|
||||
etk::UString myData = child->GetText();
|
||||
if (myData.Size()!=0) {
|
||||
if (child->getValue() == "ext") {
|
||||
etk::UString myData = child->getText();
|
||||
if (myData.size()!=0) {
|
||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
|
||||
m_listExtentions.PushBack(myData);
|
||||
m_listExtentions.pushBack(myData);
|
||||
}
|
||||
} else if (child->GetValue()=="pass1") {
|
||||
// Get sub Nodes ...
|
||||
for(int32_t jjj=0; jjj< child->Size(); jjj++) {
|
||||
exml::Element* passChild = child->GetElement(jjj);
|
||||
if (passChild==NULL) {
|
||||
} else if (child->getValue() == "pass1") {
|
||||
// get sub Nodes ...
|
||||
for(int32_t jjj=0; jjj< child->size(); jjj++) {
|
||||
exml::Element* passChild = child->getElement(jjj);
|
||||
if (passChild == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (passChild->GetValue() != "rule") {
|
||||
APPL_ERROR("(l "<< passChild->GetPos() << ") node not suported : \""<< passChild->GetValue() << "\" must be [rule]" );
|
||||
if (passChild->getValue() != "rule") {
|
||||
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->GetValue() << "\" must be [rule]" );
|
||||
continue;
|
||||
}
|
||||
ParseRules(passChild, m_listHighlightPass1, level1++);
|
||||
}
|
||||
} else if (child->GetValue() == "pass2") {
|
||||
// Get sub Nodes ...
|
||||
for(int32_t jjj=0; jjj< child->Size(); jjj++) {
|
||||
exml::Element* passChild = child->GetElement(jjj);
|
||||
if (passChild==NULL) {
|
||||
} else if (child->getValue() == "pass2") {
|
||||
// get sub Nodes ...
|
||||
for(int32_t jjj=0; jjj< child->size(); jjj++) {
|
||||
exml::Element* passChild = child->getElement(jjj);
|
||||
if (passChild == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (passChild->GetValue() != "rule") {
|
||||
APPL_ERROR("(l "<< passChild->GetPos() << ") node not suported : \""<< passChild->GetValue() << "\" must be [rule]" );
|
||||
if (passChild->getValue() != "rule") {
|
||||
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->GetValue() << "\" must be [rule]" );
|
||||
continue;
|
||||
}
|
||||
ParseRules(passChild, m_listHighlightPass2, level2++);
|
||||
}
|
||||
} else {
|
||||
APPL_ERROR("(l "<< child->GetPos() << ") node not suported : \""<< child->GetValue() << "\" must be [ext,pass1,pass2]" );
|
||||
APPL_ERROR("(l "<< child->getPos() << ") node not suported : \""<< child->GetValue() << "\" must be [ext,pass1,pass2]" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,36 +91,36 @@ 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();
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Highlight::HasExtention(const etk::UString& _ext)
|
||||
bool Highlight::hasExtention(const etk::UString& _ext)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listExtentions.Size(); iii++) {
|
||||
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) {
|
||||
if (_ext == m_listExtentions[iii] ) {
|
||||
return true;
|
||||
}
|
||||
@@ -128,18 +128,18 @@ bool Highlight::HasExtention(const etk::UString& _ext)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Highlight::FileNameCompatible(etk::FSNode &_fileName)
|
||||
bool Highlight::fileNameCompatible(etk::FSNode &_fileName)
|
||||
{
|
||||
etk::UString extention;
|
||||
if (true == _fileName.FileHasExtention() ) {
|
||||
if (true == _fileName.fileHasExtention() ) {
|
||||
extention = "*.";
|
||||
extention += _fileName.FileGetExtention();
|
||||
extention += _fileName.fileGetExtention();
|
||||
} else {
|
||||
extention = _fileName.GetNameFile();
|
||||
extention = _fileName.getNameFile();
|
||||
}
|
||||
APPL_DEBUG(" try to find : in \"" << _fileName << "\" extention:\"" << extention << "\" ");
|
||||
|
||||
for (int32_t iii=0; iii<m_listExtentions.Size(); iii++) {
|
||||
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) {
|
||||
if (extention == m_listExtentions[iii] ) {
|
||||
return true;
|
||||
}
|
||||
@@ -148,24 +148,24 @@ bool Highlight::FileNameCompatible(etk::FSNode &_fileName)
|
||||
}
|
||||
|
||||
|
||||
void Highlight::Display(void)
|
||||
void Highlight::display(void)
|
||||
{
|
||||
APPL_INFO("List of ALL Highlight : ");
|
||||
for (int32_t iii=0; iii< m_listExtentions.Size(); iii++) {
|
||||
for (int32_t iii=0; iii< m_listExtentions.size(); iii++) {
|
||||
APPL_INFO(" Extention : " << iii << " : " << m_listExtentions[iii] );
|
||||
}
|
||||
// Display all elements
|
||||
for (int32_t iii=0; iii< m_listHighlightPass1.Size(); iii++) {
|
||||
APPL_INFO(" " << iii << " Pass 1 : " << m_listHighlightPass1[iii]->GetName() );
|
||||
//m_listHighlightPass1[i]->Display();
|
||||
// display all elements
|
||||
for (int32_t iii=0; iii< m_listHighlightPass1.size(); iii++) {
|
||||
APPL_INFO(" " << iii << " Pass 1 : " << m_listHighlightPass1[iii]->getName() );
|
||||
//m_listHighlightPass1[i]->display();
|
||||
}
|
||||
// Display all elements
|
||||
for (int32_t iii=0; iii< m_listHighlightPass2.Size(); iii++) {
|
||||
APPL_INFO(" " << iii << " Pass 2 : " << m_listHighlightPass2[iii]->GetName() );
|
||||
//m_listHighlightPass2[i]->Display();
|
||||
// display all elements
|
||||
for (int32_t iii=0; iii< m_listHighlightPass2.size(); iii++) {
|
||||
APPL_INFO(" " << iii << " Pass 2 : " << m_listHighlightPass2[iii]->getName() );
|
||||
//m_listHighlightPass2[i]->display();
|
||||
}
|
||||
}
|
||||
// 13h 46min 22s | (l= 214) Highlight::Parse | [II] Find Pattern in the Buffer : (2457,2479)
|
||||
// 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<74>grave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer...
|
||||
@@ -178,48 +178,48 @@ void Highlight::Parse(int32_t start,
|
||||
if (0 > addingPos) {
|
||||
addingPos = 0;
|
||||
}
|
||||
//APPL_DEBUG("Parse element 0 => " << m_listHighlightPass1.Size() << " ==> position search: (" << start << "," << stop << ")" );
|
||||
//APPL_DEBUG("Parse element 0 => " << m_listHighlightPass1.size() << " == > position search: (" << start << "," << stop << ")" );
|
||||
int32_t elementStart = start;
|
||||
int32_t elementStop = stop;
|
||||
colorInformation_ts resultat;
|
||||
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() << ")" );
|
||||
//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...
|
||||
// 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
|
||||
// remove element
|
||||
//APPL_INFO("Erase element=" << kkk);
|
||||
metaData.EraseLen(kkk, 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 :
|
||||
// Not find == > exit the cycle :
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Add curent element in the list ...
|
||||
metaData.Insert(addingPos, resultat);
|
||||
// add curent element in the list ...
|
||||
metaData.insert(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
|
||||
// update the current research starting element: (set position at the end of the current element
|
||||
elementStart = resultat.endStop-1;
|
||||
// increment the position of insertion:
|
||||
addingPos++;
|
||||
// We find a pattern ==> Stop search for the current element
|
||||
// We find a pattern == > Stop search for the current element
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -238,7 +238,7 @@ void Highlight::Parse2(int32_t start,
|
||||
etk::Vector<colorInformation_ts> &metaData,
|
||||
etk::Buffer &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 << ")" );
|
||||
int32_t elementStart = start;
|
||||
int32_t elementStop = stop;
|
||||
colorInformation_ts resultat;
|
||||
@@ -246,15 +246,15 @@ 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() << ")" );
|
||||
//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_listHighlightPass2[jjj]->Find(elementStart, elementStop, resultat, buffer);
|
||||
ret = m_listHighlightPass2[jjj]->find(elementStart, elementStop, resultat, buffer);
|
||||
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);
|
||||
// add curent element in the list ...
|
||||
metaData.pushBack(resultat);
|
||||
elementStart = resultat.endStop-1;
|
||||
// Exit current cycle
|
||||
break;
|
||||
|
@@ -36,9 +36,9 @@ class Highlight {
|
||||
// Constructeur
|
||||
Highlight(const etk::UString& _xmlFilename);
|
||||
~Highlight(void);
|
||||
bool HasExtention(const etk::UString& _ext);
|
||||
bool FileNameCompatible(etk::FSNode &_fileName);
|
||||
void Display(void);
|
||||
bool hasExtention(const etk::UString& _ext);
|
||||
bool fileNameCompatible(etk::FSNode &_fileName);
|
||||
void display(void);
|
||||
void ReloadColor(void);
|
||||
void Parse(int32_t start,
|
||||
int32_t stop,
|
||||
@@ -53,8 +53,8 @@ class Highlight {
|
||||
void ParseRules(exml::Element* child, etk::Vector<HighlightPattern*> &mListPatern, int32_t level);
|
||||
etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
|
||||
etk::Vector<etk::UString> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
|
||||
etk::Vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer)
|
||||
etk::Vector<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) )
|
||||
etk::Vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer)
|
||||
etk::Vector<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) )
|
||||
};
|
||||
|
||||
|
||||
|
@@ -22,36 +22,36 @@ class localClassHighlightManager: public ewol::EObject
|
||||
public:
|
||||
// Constructeur
|
||||
localClassHighlightManager(void) {
|
||||
//ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferColor);
|
||||
//ewol::widgetMessageMultiCast::add(getWidgetId(), ednMsgBufferColor);
|
||||
};
|
||||
~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();
|
||||
};
|
||||
|
||||
// herited function
|
||||
const char * const GetObjectType(void)
|
||||
const char * const getObjectType(void)
|
||||
{
|
||||
return "ApplHighlightManager";
|
||||
}
|
||||
|
||||
// herited function
|
||||
virtual void OnReceiveMessage(const ewol::EMessage& _msg)
|
||||
virtual void onReceiveMessage(const ewol::EMessage& _msg)
|
||||
{
|
||||
/*
|
||||
switch (id)
|
||||
{
|
||||
case APPL_MSG__COLOR_HAS_CHANGE:
|
||||
APPL_INFO("UPDATE the color pointer on the HL");
|
||||
for (int32_t i=0; i<listHighlight.Size(); i++) {
|
||||
for (int32_t i=0; i<listHighlight.size(); i++) {
|
||||
if (NULL != listHighlight[i]) {
|
||||
listHighlight[i]->ReloadColor();
|
||||
}
|
||||
@@ -61,11 +61,11 @@ class localClassHighlightManager: public ewol::EObject
|
||||
*/
|
||||
}
|
||||
|
||||
Highlight* Get(etk::FSNode &fileName)
|
||||
Highlight* get(etk::FSNode &fileName)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<listHighlight.Size(); i++) {
|
||||
if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
|
||||
for (i=0; i<listHighlight.size(); i++) {
|
||||
if (true == listHighlight[i]->fileNameCompatible(fileName) ) {
|
||||
return listHighlight[i];
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class localClassHighlightManager: public ewol::EObject
|
||||
|
||||
bool Exist(etk::FSNode &fileName)
|
||||
{
|
||||
if (NULL != Get(fileName) ) {
|
||||
if (NULL != get(fileName) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -86,17 +86,17 @@ class localClassHighlightManager: public ewol::EObject
|
||||
etk::FSNode myFile("DATA:languages/");
|
||||
// get the subfolder list :
|
||||
etk::Vector<etk::FSNode *> list = myFile.FolderGetSubList(false, true, false,false);
|
||||
for ( int32_t iii=0 ; iii<list.Size() ; iii++ ) {
|
||||
for ( int32_t iii=0 ; iii<list.size() ; iii++ ) {
|
||||
if (NULL!=list[iii]) {
|
||||
if (list[iii]->GetNodeType()==etk::FSN_FOLDER) {
|
||||
etk::UString filename = list[iii]->GetName() + "/highlight.xml";
|
||||
if (list[iii]->getNodeType() == etk::FSN_FOLDER) {
|
||||
etk::UString filename = list[iii]->getName() + "/highlight.xml";
|
||||
APPL_DEBUG("Load xml name : " << filename);
|
||||
Highlight *myHightline = new Highlight(filename);
|
||||
listHighlight.PushBack(myHightline);
|
||||
listHighlight.pushBack(myHightline);
|
||||
}
|
||||
}
|
||||
}
|
||||
//myHightline->Display();
|
||||
//myHightline->display();
|
||||
}
|
||||
|
||||
};
|
||||
@@ -105,10 +105,10 @@ static localClassHighlightManager * localManager = NULL;
|
||||
|
||||
|
||||
|
||||
void HighlightManager::Init(void)
|
||||
void HighlightManager::init(void)
|
||||
{
|
||||
if (NULL != localManager) {
|
||||
APPL_ERROR("HighlightManager ==> already exist, just unlink the previous ...");
|
||||
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
|
||||
localManager = NULL;
|
||||
}
|
||||
localManager = new localClassHighlightManager();
|
||||
@@ -121,7 +121,7 @@ void HighlightManager::Init(void)
|
||||
void HighlightManager::UnInit(void)
|
||||
{
|
||||
if (NULL == localManager) {
|
||||
APPL_ERROR("HighlightManager ==> request UnInit, but does not exist ...");
|
||||
APPL_ERROR("HighlightManager == > request UnInit, but does not exist ...");
|
||||
return;
|
||||
}
|
||||
delete(localManager);
|
||||
@@ -136,12 +136,12 @@ void HighlightManager::loadLanguages(void)
|
||||
localManager->loadLanguages();
|
||||
}
|
||||
|
||||
Highlight* HighlightManager::Get(etk::FSNode &fileName)
|
||||
Highlight* HighlightManager::get(etk::FSNode &fileName)
|
||||
{
|
||||
if (NULL == localManager) {
|
||||
return NULL;
|
||||
}
|
||||
return localManager->Get(fileName);
|
||||
return localManager->get(fileName);
|
||||
}
|
||||
|
||||
bool HighlightManager::Exist(etk::FSNode &fileName)
|
||||
|
@@ -16,10 +16,10 @@
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
namespace HighlightManager{
|
||||
void Init(void);
|
||||
void init(void);
|
||||
void UnInit(void);
|
||||
void loadLanguages(void);
|
||||
Highlight* Get(etk::FSNode &fileName);
|
||||
Highlight* get(etk::FSNode &fileName);
|
||||
bool Exist(etk::FSNode &fileName);
|
||||
};
|
||||
|
||||
|
@@ -21,7 +21,7 @@ HighlightPattern::HighlightPattern(void)
|
||||
{
|
||||
m_haveStopPatern = false;
|
||||
m_multiline = false;
|
||||
m_color = ColorizeManager::Get("normal");
|
||||
m_color = ColorizeManager::get("normal");
|
||||
m_regExpStart = new etk::RegExp<etk::Buffer>();
|
||||
m_regExpStop = new etk::RegExp<etk::Buffer>();
|
||||
m_escapeChar = 0;
|
||||
@@ -33,24 +33,24 @@ HighlightPattern::~HighlightPattern(void)
|
||||
delete(m_regExpStop);
|
||||
}
|
||||
|
||||
void HighlightPattern::SetPaternStart(etk::UString ®Exp)
|
||||
void HighlightPattern::setPaternStart(etk::UString ®Exp)
|
||||
{
|
||||
m_regExpStart->SetRegExp(regExp);
|
||||
m_regExpStart->setRegExp(regExp);
|
||||
}
|
||||
|
||||
void HighlightPattern::SetPaternStop(etk::UString ®Exp)
|
||||
void HighlightPattern::setPaternStop(etk::UString ®Exp)
|
||||
{
|
||||
if (regExp.Size() != 0) {
|
||||
m_regExpStop->SetRegExp(regExp);
|
||||
if (regExp.size() != 0) {
|
||||
m_regExpStop->setRegExp(regExp);
|
||||
m_haveStopPatern = true;
|
||||
} else {
|
||||
m_haveStopPatern = false;
|
||||
}
|
||||
}
|
||||
|
||||
void HighlightPattern::SetEscapeChar(etk::UString &EscapeChar)
|
||||
void HighlightPattern::setEscapeChar(etk::UString &EscapeChar)
|
||||
{
|
||||
if (EscapeChar.Size()>0) {
|
||||
if (EscapeChar.size()>0) {
|
||||
m_escapeChar = EscapeChar[0];
|
||||
} else {
|
||||
m_escapeChar = 0;
|
||||
@@ -58,13 +58,13 @@ void HighlightPattern::SetEscapeChar(etk::UString &EscapeChar)
|
||||
}
|
||||
|
||||
|
||||
void HighlightPattern::SetColor(etk::UString &colorName)
|
||||
void HighlightPattern::setColor(etk::UString &colorName)
|
||||
{
|
||||
m_colorName = colorName;
|
||||
m_color = ColorizeManager::Get(m_colorName);
|
||||
m_color = ColorizeManager::get(m_colorName);
|
||||
}
|
||||
|
||||
bool HighlightPattern::IsEnable(void)
|
||||
bool HighlightPattern::isEnable(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ bool HighlightPattern::IsEnable(void)
|
||||
|
||||
void HighlightPattern::ReloadColor(void)
|
||||
{
|
||||
m_color = ColorizeManager::Get(m_colorName);
|
||||
m_color = ColorizeManager::get(m_colorName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,28 +83,28 @@ void HighlightPattern::ReloadColor(void)
|
||||
* @eturn
|
||||
*
|
||||
*/
|
||||
void HighlightPattern::Display(void)
|
||||
void HighlightPattern::display(void)
|
||||
{
|
||||
/*
|
||||
APPL_INFO("patern : \"" << m_paternName << "\" level=" << m_level );
|
||||
APPL_INFO(" ==> colorName \"" << m_colorName << "\"");
|
||||
APPL_INFO(" ==> regExpStart \"" << m_regExpStart->GetRegExp() << "\"");
|
||||
APPL_INFO(" ==> regExpStop \"" << m_regExpStop->GetRegExp() << "\"");
|
||||
APPL_INFO(" == > colorName \"" << m_colorName << "\"");
|
||||
APPL_INFO(" == > regExpStart \"" << m_regExpStart->getRegExp() << "\"");
|
||||
APPL_INFO(" == > regExpStop \"" << m_regExpStop->getRegExp() << "\"");
|
||||
if (true == m_haveStopPatern) {
|
||||
APPL_INFO(" ==> stop pattern: YES");
|
||||
APPL_INFO(" == > stop pattern: YES");
|
||||
} else {
|
||||
APPL_INFO(" ==> stop pattern: NO");
|
||||
APPL_INFO(" == > stop pattern: NO");
|
||||
}
|
||||
if (true == m_multiline) {
|
||||
APPL_INFO(" ==> multiline pattern: YES");
|
||||
APPL_INFO(" == > multiline pattern: YES");
|
||||
} else {
|
||||
APPL_INFO(" ==> multiline pattern: NO");
|
||||
APPL_INFO(" == > multiline pattern: NO");
|
||||
}
|
||||
*/
|
||||
// Display all elements
|
||||
for (int32_t i=0; i< m_subPatern.Size(); i++) {
|
||||
APPL_INFO(" " << i << " SubPattern : " << m_subPatern[i]->GetName() );
|
||||
m_subPatern[i]->Display();
|
||||
// display all elements
|
||||
for (int32_t i=0; i< m_subPatern.size(); i++) {
|
||||
APPL_INFO(" " << i << " subPattern : " << m_subPatern[i]->getName() );
|
||||
m_subPatern[i]->display();
|
||||
}
|
||||
}
|
||||
void HighlightPattern::ParseRules(exml::Element *child, int32_t level)
|
||||
@@ -120,51 +120,51 @@ void HighlightPattern::ParseRules(exml::Element *child, int32_t level)
|
||||
*/
|
||||
//--------------------------------------------------------------------------------------------
|
||||
// process attribute
|
||||
etk::UString highLightName = child->GetAttribute("name");
|
||||
etk::UString highLightName = child->getAttribute("name");
|
||||
etk::UString myEdnDataTmp = "???";
|
||||
if (highLightName.Size()!=0) {
|
||||
if (highLightName.size()!=0) {
|
||||
myEdnDataTmp = highLightName;
|
||||
}
|
||||
SetName(myEdnDataTmp);
|
||||
SetLevel(level);
|
||||
setName(myEdnDataTmp);
|
||||
setLevel(level);
|
||||
|
||||
exml::Element* xChild = (exml::Element*)child->GetNamed("color");
|
||||
exml::Element* xChild = (exml::Element*)child->getNamed("color");
|
||||
if (NULL != xChild) {
|
||||
etk::UString myData = xChild->GetText();
|
||||
if (myData.Size()!=0) {
|
||||
etk::UString myData = xChild->getText();
|
||||
if (myData.size()!=0) {
|
||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||
etk::UString myEdnData = myData;
|
||||
SetColor(myEdnData);
|
||||
setColor(myEdnData);
|
||||
}
|
||||
}
|
||||
xChild = (exml::Element*)child->GetNamed("start");
|
||||
xChild = (exml::Element*)child->getNamed("start");
|
||||
if (NULL != xChild) {
|
||||
etk::UString myData = xChild->GetText();
|
||||
if (myData.Size()!=0) {
|
||||
etk::UString myData = xChild->getText();
|
||||
if (myData.size()!=0) {
|
||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||
etk::UString myEdnData = myData;
|
||||
SetPaternStart(myEdnData);
|
||||
setPaternStart(myEdnData);
|
||||
}
|
||||
}
|
||||
xChild = (exml::Element*)child->GetNamed("end");
|
||||
xChild = (exml::Element*)child->getNamed("end");
|
||||
if (NULL != xChild) {
|
||||
etk::UString myData = xChild->GetText();
|
||||
if (myData.Size()!=0) {
|
||||
etk::UString myData = xChild->getText();
|
||||
if (myData.size()!=0) {
|
||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||
etk::UString myEdnData = myData;
|
||||
SetPaternStop(myEdnData);
|
||||
setPaternStop(myEdnData);
|
||||
}
|
||||
}
|
||||
xChild = (exml::Element*)child->GetNamed("EscapeChar");
|
||||
xChild = (exml::Element*)child->getNamed("EscapeChar");
|
||||
if (NULL != xChild) {
|
||||
etk::UString myData = xChild->GetText();
|
||||
if (myData.Size()!=0) {
|
||||
etk::UString myData = xChild->getText();
|
||||
if (myData.size()!=0) {
|
||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||
etk::UString myEdnData = myData;
|
||||
SetEscapeChar(myEdnData);
|
||||
setEscapeChar(myEdnData);
|
||||
}
|
||||
}
|
||||
xChild = (exml::Element*)child->GetNamed("rule");
|
||||
xChild = (exml::Element*)child->getNamed("rule");
|
||||
if (NULL != xChild) {
|
||||
/*
|
||||
// Create the patern ...
|
||||
@@ -172,7 +172,7 @@ void HighlightPattern::ParseRules(exml::Element *child, int32_t level)
|
||||
// parse under Element
|
||||
myPattern->ParseRules(ruleChild, level+1);
|
||||
// add element in the list
|
||||
m_subPatern.PushBack(myPattern);
|
||||
m_subPatern.pushBack(myPattern);
|
||||
//ParseRules(passChild, m_listHighlightPass1, level1++);
|
||||
*/
|
||||
}
|
||||
@@ -180,7 +180,7 @@ void HighlightPattern::ParseRules(exml::Element *child, int32_t level)
|
||||
|
||||
|
||||
/**
|
||||
* @brief Find Element only in the specify start characters and find the end with the range done
|
||||
* @brief find Element only in the specify start characters and find the end with the range done
|
||||
*
|
||||
* @param[in] start First character to search data (if recognise it start here)
|
||||
* @param[in] stop End of the possibility whe search can continue
|
||||
@@ -191,7 +191,7 @@ void HighlightPattern::ParseRules(exml::Element *child, int32_t level)
|
||||
* @return HLP_FIND_OK_NO_END Xe find a partial pattern (missing end)
|
||||
* @return HLP_FIND_ERROR Not find the pattern
|
||||
*/
|
||||
resultFind_te HighlightPattern::Find(int32_t start, int32_t stop, colorInformation_ts &resultat, etk::Buffer &buffer)
|
||||
resultFind_te HighlightPattern::find(int32_t start, int32_t stop, colorInformation_ts &resultat, etk::Buffer &buffer)
|
||||
{
|
||||
//APPL_DEBUG(" try to find the element");
|
||||
resultat.beginStart = -1;
|
||||
|
@@ -34,28 +34,28 @@ class HighlightPattern {
|
||||
HighlightPattern(void);
|
||||
~HighlightPattern(void);
|
||||
|
||||
void SetName(etk::UString &name) { m_paternName = name;};
|
||||
etk::UString GetName(void) { return m_paternName;};
|
||||
void setName(etk::UString &name) { m_paternName = name;};
|
||||
etk::UString getName(void) { return m_paternName;};
|
||||
|
||||
void SetPaternStart(etk::UString ®Exp);
|
||||
void SetPaternStop(etk::UString ®Exp);
|
||||
void SetColor(etk::UString &colorName);
|
||||
void SetEscapeChar(etk::UString &EscapeChar);
|
||||
void SetMultiline(bool enable) { m_multiline = enable; };
|
||||
void setPaternStart(etk::UString ®Exp);
|
||||
void setPaternStop(etk::UString ®Exp);
|
||||
void setColor(etk::UString &colorName);
|
||||
void setEscapeChar(etk::UString &EscapeChar);
|
||||
void setMultiline(bool enable) { m_multiline = enable; };
|
||||
|
||||
void SetLevel(int32_t newLevel) { m_level = newLevel; };
|
||||
int32_t GetLevel(void) { return m_level; };
|
||||
void setLevel(int32_t newLevel) { m_level = newLevel; };
|
||||
int32_t getLevel(void) { return m_level; };
|
||||
|
||||
bool IsEnable(void);
|
||||
void Display(void);
|
||||
resultFind_te Find(int32_t start, int32_t stop, colorInformation_ts &resultat, etk::Buffer &buffer);
|
||||
Colorize * GetColor(void) { return m_color; };
|
||||
bool isEnable(void);
|
||||
void display(void);
|
||||
resultFind_te find(int32_t start, int32_t stop, colorInformation_ts &resultat, etk::Buffer &buffer);
|
||||
Colorize * getColor(void) { return m_color; };
|
||||
void ParseRules(exml::Element *child, int32_t level);
|
||||
|
||||
void ReloadColor(void);
|
||||
|
||||
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_colorName; //!< Current color name
|
||||
Colorize * m_color; //!< Link to the color manager
|
||||
|
Reference in New Issue
Block a user