Remove std::vector and std::string from the sources for reson of portability

This commit is contained in:
Edouard Dupin 2011-08-08 14:06:11 +02:00
parent 2c6f280c58
commit a196c615bf
15 changed files with 199 additions and 221 deletions

View File

@ -26,8 +26,6 @@
#ifndef __BUFFER_TEXT_H__
#define __BUFFER_TEXT_H__
#include <vector>
#include <string>
#include "ColorizeManager.h"
#include "Buffer.h"
#include "EdnBuf.h"

View File

@ -37,8 +37,17 @@ ColorizeManager::ColorizeManager(void)
ColorizeManager::~ColorizeManager(void)
{
delete(errorColor);
// TODO : delete all color previously
listMyColor.clear();
uint32_t i;
// clean all Element
for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
}
@ -181,7 +190,7 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
myNewColor->SetItalic(true);
}
}
listMyColor.push_back(myNewColor);
listMyColor.PushBack(myNewColor);
} else {
EDN_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [color]");
}
@ -199,7 +208,7 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
Colorize *ColorizeManager::Get(const char *colorName)
{
uint32_t i;
for (i=0; i<listMyColor.size(); i++) {
for (i=0; i<listMyColor.Size(); i++) {
Edn::String elementName = listMyColor[i]->GetName();
if (elementName == colorName) {
return listMyColor[i];
@ -228,7 +237,7 @@ color_ts & ColorizeManager::Get(basicColor_te myColor)
bool ColorizeManager::Exist(const char *colorName)
{
uint32_t i;
for (i=0; i<listMyColor.size(); i++) {
for (i=0; i<listMyColor.Size(); i++) {
Edn::String elementName = listMyColor[i]->GetName();
if (elementName == colorName) {
return true;
@ -245,7 +254,7 @@ void ColorizeManager::DisplayListOfColor(void)
{
uint32_t i;
EDN_INFO(PFX"List of ALL COLOR : ");
for (i=0; i<listMyColor.size(); i++) {
for (i=0; i<listMyColor.Size(); i++) {
//Edn::String elementName = listMyColor[i]->GetName();
//EDN_INFO(i << " : \"" << elementName.c_str() << "\"" );
listMyColor[i]->Display(i);

View File

@ -27,9 +27,8 @@
#define __COLORIZE_MANAGER_H__
#include "Singleton.h"
#include <vector>
#include <string>
#include "Colorize.h"
#include "Edn.h"
typedef enum {
// BASIC color for codeViewer
@ -59,19 +58,19 @@ class ColorizeManager: public Singleton<ColorizeManager>
ColorizeManager(void);
~ColorizeManager(void);
public:
void LoadFile(Edn::String &xmlFilename);
void LoadFile(const char * xmlFilename);
Colorize * Get(const char *colorName);
Colorize * Get(Edn::String &colorName);
color_ts & Get(basicColor_te myColor);
bool Exist(Edn::String &colorName);
bool Exist(const char *colorName);
void DisplayListOfColor(void);
void LoadFile(Edn::String &xmlFilename);
void LoadFile(const char * xmlFilename);
Colorize * Get(const char *colorName);
Colorize * Get(Edn::String &colorName);
color_ts & Get(basicColor_te myColor);
bool Exist(Edn::String &colorName);
bool Exist(const char *colorName);
void DisplayListOfColor(void);
private:
std::vector<Colorize*> listMyColor; //!< List of ALL Color
Colorize* errorColor;
color_ts basicColors[COLOR_NUMBER_MAX];
Edn::VectorType<Colorize*> listMyColor; //!< List of ALL Color
Colorize * errorColor;
color_ts basicColors[COLOR_NUMBER_MAX];
};
#endif

View File

@ -26,8 +26,6 @@
#define __BUFFER_VIEW_H__
#include "tools_debug.h"
#include <vector>
#include <string>
#include "Singleton.h"
#include "CodeView.h"
#include "BufferManager.h"

View File

@ -28,8 +28,7 @@
#include "tools_debug.h"
#include "Singleton.h"
#include <string>
#include <vector>
class MainAreaView: public Singleton<MainAreaView>

View File

@ -28,8 +28,6 @@
#include "tools_debug.h"
#include "Singleton.h"
#include <string>
#include <vector>
class Search: public Singleton<Search>

View File

@ -33,14 +33,14 @@
#define __class__ "Highlight"
void Highlight::ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level)
void Highlight::ParseRules(TiXmlNode *child, Edn::VectorType<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.push_back(myPattern);
mListPatern.PushBack(myPattern);
}
@ -72,8 +72,8 @@ Highlight::Highlight(Edn::String &xmlFilename)
const char *myData = child->ToElement()->GetText();
if (NULL != myData) {
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
Edn::String myEdnData = myData;
m_listExtentions.push_back(myEdnData);
Edn::String * myEdnData = new Edn::String(myData);
m_listExtentions.PushBack(myEdnData);
}
} else if (!strcmp(child->Value(), "pass1")) {
// Get sub Nodes ...
@ -113,21 +113,34 @@ Highlight::Highlight(Edn::String &xmlFilename)
Highlight::~Highlight(void)
{
uint32_t i;
int32_t i;
// clean all Element
for (i=0; i< m_listHighlightPass1.size(); i++) {
delete(m_listHighlightPass1[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++) {
if (NULL != m_listExtentions[i]) {
delete(m_listExtentions[i]);
m_listExtentions[i] = NULL;
}
}
// clear the compleate list
m_listExtentions.Clear();
}
bool Highlight::HasExtention(Edn::String &ext)
{
uint32_t i;
for (i=0; i<m_listExtentions.size(); i++) {
if (ext == m_listExtentions[i] ) {
int32_t i;
for (i=0; i<m_listExtentions.Size(); i++) {
if (ext == *m_listExtentions[i] ) {
return true;
}
}
@ -136,7 +149,7 @@ bool Highlight::HasExtention(Edn::String &ext)
bool Highlight::FileNameCompatible(Edn::File &fileName)
{
uint32_t i;
int32_t i;
Edn::String extention;
if (true == fileName.HasExtention() ) {
extention = "*.";
@ -146,8 +159,8 @@ bool Highlight::FileNameCompatible(Edn::File &fileName)
}
EDN_DEBUG(" try to find : in \"" << fileName << "\" extention:\"" << extention << "\" ");
for (i=0; i<m_listExtentions.size(); i++) {
if (extention == m_listExtentions[i] ) {
for (i=0; i<m_listExtentions.Size(); i++) {
if (extention == *m_listExtentions[i] ) {
return true;
}
}
@ -157,18 +170,18 @@ bool Highlight::FileNameCompatible(Edn::File &fileName)
void Highlight::Display(void)
{
uint32_t i;
int32_t i;
EDN_INFO("List of ALL Highlight : ");
for (i=0; i< m_listExtentions.size(); i++) {
EDN_INFO(" Extention : " << i << " : " << m_listExtentions[i] );
for (i=0; i< m_listExtentions.Size(); i++) {
EDN_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++) {
EDN_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++) {
EDN_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName() );
//m_listHighlightPass2[i]->Display();
}
@ -178,14 +191,14 @@ void Highlight::Display(void)
// 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...
void Highlight::Parse(int32_t start,
int32_t stop,
std::vector<colorInformation_ts> &metaData,
Edn::VectorType<colorInformation_ts> &metaData,
int32_t addingPos,
EdnVectorBuf &buffer)
{
if (0 > addingPos) {
addingPos = 0;
}
//EDN_DEBUG("Parse element 0 => " << m_listHighlightPass1.size() << " ==> position search: (" << start << "," << stop << ")" );
//EDN_DEBUG("Parse element 0 => " << m_listHighlightPass1.Size() << " ==> position search: (" << start << "," << stop << ")" );
int32_t elementStart = start;
int32_t elementStop = stop;
colorInformation_ts resultat;
@ -193,7 +206,7 @@ void Highlight::Parse(int32_t start,
//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 (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)
@ -202,12 +215,12 @@ void Highlight::Parse(int32_t start,
//EDN_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 < (int32_t)metaData.size() ) {
while(kkk < metaData.Size() ) {
if (metaData[kkk].beginStart <= resultat.endStop) {
// Remove element
metaData.erase(metaData.begin()+kkk, metaData.begin()+kkk+1);
metaData.Erase(kkk, kkk+1);
// Increase the end of search
if (kkk < (int32_t)metaData.size()) {
if (kkk < metaData.Size()) {
// just befor the end of the next element
elementStop = metaData[kkk].beginStart-1;
} else {
@ -220,7 +233,7 @@ void Highlight::Parse(int32_t start,
}
}
// Add curent element in the list ...
metaData.insert(metaData.begin() + addingPos, resultat);
metaData.Insert(addingPos, resultat);
//EDN_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;
@ -242,10 +255,9 @@ void Highlight::Parse(int32_t start,
*/
void Highlight::Parse2(int32_t start,
int32_t stop,
std::vector<colorInformation_ts> &metaData,
Edn::VectorType<colorInformation_ts> &metaData,
EdnVectorBuf &buffer)
{
int32_t elementID = 0;
//EDN_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() << " ==> position search: (" << start << "," << stop << ")" );
int32_t elementStart = start;
int32_t elementStop = stop;
@ -254,7 +266,7 @@ void Highlight::Parse2(int32_t start,
//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_listHighlightPass2.size(); jjj++){
for (jjj=0; jjj<m_listHighlightPass2.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)
@ -262,7 +274,7 @@ void Highlight::Parse2(int32_t start,
if (HLP_FIND_ERROR != ret) {
//EDN_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// Add curent element in the list ...
metaData.push_back(resultat);
metaData.PushBack(resultat);
elementStart = resultat.endStop;
// Exit current cycle
break;

View File

@ -23,6 +23,7 @@
*******************************************************************************
*/
#include "Edn.h"
#ifndef __HIGHLIGHT_H__
#define __HIGHLIGHT_H__
@ -38,14 +39,12 @@ extern "C" {
int32_t endStart;
int32_t endStop;
bool notEnded;
HighlightPattern * patern; // pointer on class :
HighlightPattern * patern; // pointer on class :
} colorInformation_ts;
}
#include <vector>
#include "HighlightPattern.h"
#include "Colorize.h"
#include "Edn.h"
#include "EdnVectorBuf.h"
#include "tinyxml.h"
@ -59,19 +58,19 @@ class Highlight {
void Display(void);
void Parse(int32_t start,
int32_t stop,
std::vector<colorInformation_ts> &metaData,
Edn::VectorType<colorInformation_ts> &metaData,
int32_t addingPos,
EdnVectorBuf &buffer);
void Parse2(int32_t start,
int32_t stop,
std::vector<colorInformation_ts> &metaData,
Edn::VectorType<colorInformation_ts> &metaData,
EdnVectorBuf &buffer);
private:
void ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level);
Edn::String m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
std::vector<Edn::String> 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)) )
void ParseRules(TiXmlNode *child, Edn::VectorType<HighlightPattern*> &mListPatern, int32_t level);
Edn::String m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
Edn::VectorType<Edn::String*> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
Edn::VectorType<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer)
Edn::VectorType<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) )
};

View File

@ -37,14 +37,23 @@ HighlightManager::HighlightManager(void)
HighlightManager::~HighlightManager(void)
{
listHighlight.clear();
uint32_t i;
// clean all Element
for (i=0; i< listHighlight.Size(); i++) {
if (NULL != listHighlight[i]) {
delete(listHighlight[i]);
listHighlight[i] = NULL;
}
}
// clear the compleate list
listHighlight.Clear();
}
Highlight *HighlightManager::Get(Edn::File &fileName)
{
uint32_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];
}
@ -73,32 +82,32 @@ void HighlightManager::loadLanguages(void)
Edn::String xmlFilename = homedir;
xmlFilename += "lang_c.xml";
Highlight *myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_boo.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_Makefile.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_asm.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_xml.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_php.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
myHightline->Display();
}

View File

@ -29,8 +29,6 @@
class HighlightManager;
#include "Singleton.h"
#include <vector>
#include <string>
#include "Highlight.h"
@ -49,7 +47,7 @@ class HighlightManager: public Singleton<HighlightManager>
bool Exist(Edn::File &fileName);
private:
std::vector<Highlight*> listHighlight; //!< List of ALL hightlight modules
Edn::VectorType<Highlight*> listHighlight; //!< List of ALL hightlight modules
};
#endif

View File

@ -26,11 +26,9 @@
#ifndef __TOOLS_DISPLAY_H__
#define __TOOLS_DISPLAY_H__
#include "tools_debug.h"
#include "Colorize.h"
#include "ColorizeManager.h"
#include <string>
#include <vector>
#include "tools_debug.h"
#include "Colorize.h"
#include "ColorizeManager.h"
/**

View File

@ -49,13 +49,13 @@ end *************** *************
*/
typedef struct {
bool selected; //!< True if the selection is active
bool rectangular; //!< True if the selection is rectangular
bool zeroWidth; //!< Width 0 selections aren't "real" selections, but they can be useful when creating rectangular selections from the keyboard.
int32_t start; //!< Pos. of start of selection, or if rectangular start of line containing it.
int32_t end; //!< Pos. of end of selection, or if rectangular end of line containing it.
int32_t rectStart; //!< Indent of left edge of rect. selection
int32_t rectEnd; //!< Indent of right edge of rect. selection
bool selected; //!< True if the selection is active
bool rectangular; //!< True if the selection is rectangular
bool zeroWidth; //!< Width 0 selections aren't "real" selections, but they can be useful when creating rectangular selections from the keyboard.
int32_t start; //!< Pos. of start of selection, or if rectangular start of line containing it.
int32_t end; //!< Pos. of end of selection, or if rectangular end of line containing it.
int32_t rectStart; //!< Indent of left edge of rect. selection
int32_t rectEnd; //!< Indent of right edge of rect. selection
} selection;
typedef enum{
@ -67,10 +67,10 @@ typedef enum{
typedef struct {
std::vector<colorInformation_ts> HLData;
int32_t idSequence;
int32_t posHLPass1;
int32_t posHLPass2;
Edn::VectorType<colorInformation_ts> HLData;
int32_t idSequence;
int32_t posHLPass1;
int32_t posHLPass2;
}displayHLData_ts;
@ -125,54 +125,54 @@ class EdnBuf {
// selection remember...
// -----------------------------------------
public:
bool SelectHasSelection( selectionType_te select);
void Select( selectionType_te select, int32_t start, int32_t end);
void Unselect( selectionType_te select);
void RectSelect( selectionType_te select, int32_t start, int32_t end, int32_t rectStart, int32_t rectEnd);
bool GetSelectionPos( selectionType_te select, int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd);
void GetSelectionText( selectionType_te select, Edn::VectorType<int8_t> &text);
void RemoveSelected( selectionType_te select);
void ReplaceSelected( selectionType_te select, Edn::VectorType<int8_t> &text);
bool SelectHasSelection( selectionType_te select);
void Select( selectionType_te select, int32_t start, int32_t end);
void Unselect( selectionType_te select);
void RectSelect( selectionType_te select, int32_t start, int32_t end, int32_t rectStart, int32_t rectEnd);
bool GetSelectionPos( selectionType_te select, int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd);
void GetSelectionText( selectionType_te select, Edn::VectorType<int8_t> &text);
void RemoveSelected( selectionType_te select);
void ReplaceSelected( selectionType_te select, Edn::VectorType<int8_t> &text);
private:
// current selection of the buffer
selection m_selectionList[SELECTION_SIZE]; //!< Selection area of the buffer
void UpdateSelection( selectionType_te select, int32_t pos, int32_t nDeleted, int32_t nInserted);
void UpdateSelections( int32_t pos, int32_t nDeleted, int32_t nInserted);
selection m_selectionList[SELECTION_SIZE]; //!< Selection area of the buffer
void UpdateSelection( selectionType_te select, int32_t pos, int32_t nDeleted, int32_t nInserted);
void UpdateSelections( int32_t pos, int32_t nDeleted, int32_t nInserted);
// -----------------------------------------
// History section :
// -----------------------------------------
public:
int32_t Undo( void);
int32_t Redo( void);
int32_t Undo(void);
int32_t Redo(void);
private:
bool m_isUndoProcessing;
bool m_isRedoProcessing;
Edn::VectorType<EdnBufHistory*> m_historyUndo;
Edn::VectorType<EdnBufHistory*> m_historyRedo;
bool m_isUndoProcessing;
bool m_isRedoProcessing;
Edn::VectorType<EdnBufHistory*> m_historyUndo;
Edn::VectorType<EdnBufHistory*> m_historyRedo;
// -----------------------------------------
// hightlight section :
// -----------------------------------------
private:
Highlight * m_Highlight; //!< internal link with the Highlight system
std::vector<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
int32_t m_HLDataSequence; //!< position of the start of line requested by the screen viewer
void RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded);
void GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos=0);
void CleanHighLight(void);
void FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t &startId, int32_t &stopId, bool backPreviousNotEnded);
Highlight * m_Highlight; //!< internal link with the Highlight system
Edn::VectorType<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
int32_t m_HLDataSequence; //!< position of the start of line requested by the screen viewer
void RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded);
void GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos=0);
void CleanHighLight(void);
void FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t &startId, int32_t &stopId, bool backPreviousNotEnded);
public:
void SetHLSystem( Highlight * newHLSystem);
void HightlightGenerateLines(displayHLData_ts & MData, int32_t startPos, int32_t nbLines);
colorInformation_ts * GetElementColorAtPosition(displayHLData_ts & MData, int32_t pos);
void SetHLSystem( Highlight * newHLSystem);
void HightlightGenerateLines(displayHLData_ts & MData, int32_t startPos, int32_t nbLines);
colorInformation_ts * GetElementColorAtPosition(displayHLData_ts & MData, int32_t pos);
private:
colorInformation_ts * GetElementColorAtPosition(int32_t pos, int32_t &starPos);
colorInformation_ts * GetElementColorAtPosition(int32_t pos, int32_t &starPos);
private:
EdnVectorBuf m_data; //!< buffer of the data in the mode int8_t
void CountNumberOfLines(void);
int32_t m_nbLine; //!< Number of line in the biffer
EdnVectorBuf m_data; //!< buffer of the data in the mode int8_t
void CountNumberOfLines(void);
int32_t m_nbLine; //!< Number of line in the biffer
// -----------------------------------------
// Display property and charset ...
@ -186,27 +186,27 @@ class EdnBuf {
void SetUTF8Mode(bool newOne) { m_isUtf8 = newOne; m_charsetType=EDN_CHARSET_UTF8; };
private:
// Special mode of the buffer :
bool m_isUtf8; //!< true if we are in UTF8 mode ==> if true the size of a char is 0, otherwise .. 1->4 ( TODO : not now)
charset_te m_charsetType; //!< if UTF8 mode is at false : the charset type of the buffer
bool m_isUtf8; //!< true if we are in UTF8 mode ==> if true the size of a char is 0, otherwise .. 1->4 ( TODO : not now)
charset_te m_charsetType; //!< if UTF8 mode is at false : the charset type of the buffer
// Local Tabulation policies
int32_t m_tabDist; //!< equiv. number of characters in a tab
bool m_useTabs; //!< True if buffer routines are allowed to use tabs for padding in rectangular operations
int32_t m_tabDist; //!< equiv. number of characters in a tab
bool m_useTabs; //!< True if buffer routines are allowed to use tabs for padding in rectangular operations
// -----------------------------------------
// Local function :
// -----------------------------------------
private:
void findRectSelBoundariesForCopy( int32_t lineStartPos, int32_t rectStart, int32_t rectEnd, int32_t *selStart, int32_t *selEnd);
char *getSelectionText( selection &sel);
void removeSelected( selection &sel);
void replaceSelected( selection &sel, const char *text);
void findRectSelBoundariesForCopy( int32_t lineStartPos, int32_t rectStart, int32_t rectEnd, int32_t *selStart, int32_t *selEnd);
char * getSelectionText( selection &sel);
void removeSelected( selection &sel);
void replaceSelected( selection &sel, const char *text);
void eventModification( int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText);
void eventModification( int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText);
int32_t insert( int32_t pos, Edn::VectorType<int8_t> &insertText);
int32_t insert( int32_t pos, Edn::VectorType<int8_t> &insertText);
bool charMatch( char first, char second, bool caseSensitive = true);
bool charMatch( char first, char second, bool caseSensitive = true);
};
#endif

View File

@ -35,7 +35,7 @@ void EdnBuf::SetHLSystem(Highlight * newHLSystem)
{
if (m_Highlight != newHLSystem) {
m_Highlight = newHLSystem;
m_HLDataPass1.clear();
m_HLDataPass1.Clear();
RegenerateHighLightAt(0, 0, m_data.Size());
}
}
@ -67,7 +67,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
int32_t startId;
int32_t stopId;
// clean data if needed
if (0 != m_HLDataPass1.size()) {
if (0 != m_HLDataPass1.Size()) {
// find element previous
FindMainHighLightPosition(pos, posEnd, startId, stopId, true);
@ -75,19 +75,19 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
if( -1 == startId
&& -1 == stopId)
{
m_HLDataPass1.clear();
m_HLDataPass1.Clear();
} else if(-1 == startId) {
if (0 == stopId){
m_HLDataPass1.erase(m_HLDataPass1.begin());
m_HLDataPass1.Erase(0);
} else {
m_HLDataPass1.erase(m_HLDataPass1.begin(),m_HLDataPass1.begin()+stopId);
m_HLDataPass1.Erase(0,stopId);
}
} else if(-1 == stopId) {
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1,m_HLDataPass1.end());
m_HLDataPass1.Erase(startId+1, m_HLDataPass1.Size());
} else {
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1,m_HLDataPass1.begin()+stopId);
m_HLDataPass1.Erase(startId+1, stopId);
}
EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1);
EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.Size()-1);
// update position after the range position :
int32_t elemStart;
if(-1 == startId) {
@ -95,7 +95,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
} else {
elemStart = startId+1;
}
for (i=elemStart; i< (int32_t)m_HLDataPass1.size(); i++) {
for (i=elemStart; i< (int32_t)m_HLDataPass1.Size(); i++) {
//EDN_DEBUG("move element=" << i);
m_HLDataPass1[i].beginStart += nbAdded - nbDeleted;
m_HLDataPass1[i].beginStop += nbAdded - nbDeleted;
@ -113,7 +113,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
GenerateHighLightAt(0, m_HLDataPass1[0].beginStart, 0);
} else if(-1 == stopId) {
//EDN_DEBUG("******* Regenerate STOP");
GenerateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].endStop, m_data.Size(), m_HLDataPass1.size());
GenerateHighLightAt(m_HLDataPass1[m_HLDataPass1.Size() -1].endStop, m_data.Size(), m_HLDataPass1.Size());
} else {
//EDN_DEBUG("******* Regenerate RANGE");
GenerateHighLightAt(m_HLDataPass1[startId].endStop, m_HLDataPass1[startId+1].beginStart, startId+1);
@ -123,7 +123,7 @@ 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++) {
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();
@ -177,7 +177,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
S=-1 *************** E
*/
int32_t i;
for (i=0; i< (int32_t)m_HLDataPass1.size(); i++) {
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
if (m_HLDataPass1[i].endStop > startPos) {
break;
}
@ -198,7 +198,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
} else {
elemStart = startId+1;
}
for (i=elemStart; i< (int32_t)m_HLDataPass1.size(); i++) {
for (i=elemStart; i< (int32_t)m_HLDataPass1.Size(); i++) {
if (m_HLDataPass1[i].beginStart > endPos)
{
stopId = i;
@ -206,13 +206,13 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
}
}
/*
if (-1 != startId && startId < (int32_t)m_HLDataPass1.size()) {
EDN_DEBUG("==> BEGIN : start="<<m_HLDataPass1[startId].beginStart<<", stop="<<m_HLDataPass1[startId].endStop<<" id=" << startId << "/" << (int32_t)m_HLDataPass1.size()-1);
if (-1 != startId && startId < (int32_t)m_HLDataPass1.Size()) {
EDN_DEBUG("==> BEGIN : start="<<m_HLDataPass1[startId].beginStart<<", stop="<<m_HLDataPass1[startId].endStop<<" id=" << startId << "/" << (int32_t)m_HLDataPass1.Size()-1);
} else {
EDN_DEBUG("==> BEGIN : start=???, stop=??? id=" << startId);
}
if (-1 != stopId && stopId < (int32_t)m_HLDataPass1.size()) {
EDN_DEBUG("==> END : start="<<m_HLDataPass1[stopId].beginStart<<", stop="<<m_HLDataPass1[stopId].endStop<<" id=" << stopId<< "/" << (int32_t)m_HLDataPass1.size()-1);
if (-1 != stopId && stopId < (int32_t)m_HLDataPass1.Size()) {
EDN_DEBUG("==> END : start="<<m_HLDataPass1[stopId].beginStart<<", stop="<<m_HLDataPass1[stopId].endStop<<" id=" << stopId<< "/" << (int32_t)m_HLDataPass1.Size()-1);
} else {
EDN_DEBUG("==> END : start=???, stop=??? id=" << stopId);
}
@ -228,7 +228,7 @@ void EdnBuf::GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos)
return;
}
//EDN_DEBUG("area : ("<<pos<<","<<endPos<<") insert at : " << addinPos);
m_Highlight->ParseOneElement(pos, endPos, m_HLDataPass1, addinPos, m_data);
m_Highlight->Parse(pos, endPos, m_HLDataPass1, addinPos, m_data);
}
@ -236,7 +236,7 @@ void EdnBuf::GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos)
void EdnBuf::CleanHighLight(void)
{
// Remove all element in the list...
m_HLDataPass1.clear();
m_HLDataPass1.Clear();
}
@ -244,7 +244,7 @@ colorInformation_ts *EdnBuf::GetElementColorAtPosition(int32_t pos, int32_t &sta
{
int32_t i;
int32_t start = edn_max(0, starPos-1);
for (i=start; i<(int32_t)m_HLDataPass1.size(); i++) {
for (i=start; i<(int32_t)m_HLDataPass1.Size(); i++) {
starPos = i;
if( m_HLDataPass1[i].beginStart <= pos
&& m_HLDataPass1[i].endStop > pos)
@ -272,7 +272,7 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
g_get_current_time(&timeStart);
MData.idSequence = m_HLDataSequence;
HLStart = StartOfLine(HLStart);
MData.HLData.clear();
MData.HLData.Clear();
int32_t HLStop = CountForwardNLines(HLStart, nbLines);
int32_t startId, stopId;
// find element previous
@ -282,7 +282,7 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
//EDN_DEBUG("List of section between : "<< startId << " & " << stopId);
int32_t endSearch = stopId+1;
if (-1 == stopId) {
endSearch = m_HLDataPass1.size();
endSearch = m_HLDataPass1.Size();
}
for (k=edn_max(startId, 0); k<endSearch; k++) {
// empty section :
@ -305,9 +305,9 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
//EDN_DEBUG(" ==> (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
// TODO : ...
}
if (endSearch == (int32_t)m_HLDataPass1.size() ){
//if( k < (int32_t)m_HLDataPass1.size()) {
if (m_HLDataPass1.size() != 0) {
if (endSearch == (int32_t)m_HLDataPass1.Size() ){
//if( k < (int32_t)m_HLDataPass1.Size()) {
if (m_HLDataPass1.Size() != 0) {
//EDN_DEBUG(" ==> (empty section 3 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<HLStop );
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
HLStop,
@ -334,7 +334,7 @@ colorInformation_ts * EdnBuf::GetElementColorAtPosition(displayHLData_ts & MData
{
int32_t i;
int32_t start = edn_max(0, MData.posHLPass2-1);
for (i=start; i<(int32_t)MData.HLData.size(); i++) {
for (i=start; i<(int32_t)MData.HLData.Size(); i++) {
MData.posHLPass2 = i;
if( MData.HLData[i].beginStart <= pos
&& MData.HLData[i].endStop > pos)

View File

@ -26,14 +26,11 @@
#include "tools_globals.h"
#include "ColorizeManager.h"
#include "MsgBroadcast.h"
#include <string>
#undef __class__
#define __class__ "globals"
// Variables privé du namespace
static std::string curentFileName = "???";
erreurCode_te globals::init(void)
@ -201,36 +198,3 @@ bool globals::IsSetInsert(void)
/*
* Basic GUI system :
*
*
*
*
*/
void globals::DisplaySystemString(std::vector<int32_t> &data)
{
// Display the copyed data ...
uint32_t i;
EDN_INFO("Display Data : ");
printf(" ========================================================\n");
for(i=0; i<data.size(); i++) {
# ifdef USE_GTK_VERSION_2_0
if (GDK_Return == data[i]) {
# elif USE_GTK_VERSION_3_0
if (GDK_KEY_Return == data[i]) {
# endif
printf("\n = ");
} else {
printf("%c", (char)data[i]);
}
}
printf("\n ========================================================\n");
}

View File

@ -27,14 +27,12 @@
#define __TOOLS_GLOBALS_H__
#include "tools_debug.h"
#include <string>
#include <vector>
namespace globals
{
erreurCode_te init(void);
int32_t getNbColoneBorder(void);
int32_t getNbLineBorder(void);
erreurCode_te init(void);
int32_t getNbColoneBorder(void);
int32_t getNbLineBorder(void);
bool IsSetDisplayEndOfLine(void);
void SetDisplayEndOfLine(bool newVal);
@ -45,25 +43,24 @@ namespace globals
bool IsSetAutoIndent(void);
void SetAutoIndent(bool newVal);
void init2(void);
void init2(void);
void SetShift(void);
void UnSetShift(void);
bool IsSetShift(void);
void SetAlt(void);
void UnSetAlt(void);
bool IsSetAlt(void);
void SetCtrl(void);
void UnSetCtrl(void);
bool IsSetCtrl(void);
void SetPomme(void);
void UnSetPomme(void);
bool IsSetPomme(void);
void SetInsert(void);
void UnSetInsert(void);
void ToggleInsert(void);
bool IsSetInsert(void);
void DisplaySystemString(std::vector<int32_t> &data);
void SetShift(void);
void UnSetShift(void);
bool IsSetShift(void);
void SetAlt(void);
void UnSetAlt(void);
bool IsSetAlt(void);
void SetCtrl(void);
void UnSetCtrl(void);
bool IsSetCtrl(void);
void SetPomme(void);
void UnSetPomme(void);
bool IsSetPomme(void);
void SetInsert(void);
void UnSetInsert(void);
void ToggleInsert(void);
bool IsSetInsert(void);
}
#endif