String stream and file stream is now OK
This commit is contained in:
parent
7b303d2aad
commit
4c5f3a0424
@ -101,7 +101,7 @@ BufferText::BufferText()
|
|||||||
BufferText::BufferText(Edn::File &fileName) : Buffer(fileName)
|
BufferText::BufferText(Edn::File &fileName) : Buffer(fileName)
|
||||||
{
|
{
|
||||||
BasicInit();
|
BasicInit();
|
||||||
EDN_INFO("Add Data from file(" << GetFileName().GetCompleateName().c_str() << ")");
|
EDN_INFO("Add Data from file(" << GetFileName() << ")");
|
||||||
FILE * myFile = NULL;
|
FILE * myFile = NULL;
|
||||||
// try to open the file. if not existed, new file
|
// try to open the file. if not existed, new file
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ BufferText::BufferText(Edn::File &fileName) : Buffer(fileName)
|
|||||||
SetModify(false);
|
SetModify(false);
|
||||||
} else {
|
} else {
|
||||||
// fichier inexistant... creation d'un nouveaux
|
// fichier inexistant... creation d'un nouveaux
|
||||||
EDN_WARNING("No File ==> created a new one(" << GetFileName().GetCompleateName().c_str() << ")");
|
EDN_WARNING("No File ==> created a new one(" << GetFileName() << ")");
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
}
|
}
|
||||||
UpdateWindowsPosition();
|
UpdateWindowsPosition();
|
||||||
@ -131,7 +131,7 @@ BufferText::BufferText(Edn::File &fileName) : Buffer(fileName)
|
|||||||
*/
|
*/
|
||||||
void BufferText::Save(void)
|
void BufferText::Save(void)
|
||||||
{
|
{
|
||||||
EDN_INFO("Save File : \"" << GetFileName().GetCompleateName().c_str() << "\"" );
|
EDN_INFO("Save File : \"" << GetFileName() << "\"" );
|
||||||
FILE * myFile = NULL;
|
FILE * myFile = NULL;
|
||||||
myFile = fopen(GetFileName().GetCompleateName().c_str(), "w");
|
myFile = fopen(GetFileName().GetCompleateName().c_str(), "w");
|
||||||
if (NULL != myFile) {
|
if (NULL != myFile) {
|
||||||
@ -1047,7 +1047,7 @@ int32_t BufferText::FindLine(Edn::String &data)
|
|||||||
EDN_WARNING("no search data");
|
EDN_WARNING("no search data");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EDN_INFO("Search data line : \"" << data.c_str() << "\"");
|
EDN_INFO("Search data line : \"" << data << "\"");
|
||||||
Edn::VectorType<int8_t> mVectSearch;
|
Edn::VectorType<int8_t> mVectSearch;
|
||||||
mVectSearch = data.GetVector();
|
mVectSearch = data.GetVector();
|
||||||
//EDN_INFO("search data Forward : startSearchPos=" << startSearchPos );
|
//EDN_INFO("search data Forward : startSearchPos=" << startSearchPos );
|
||||||
@ -1072,7 +1072,7 @@ void BufferText::JumpAtLine(int32_t newLine)
|
|||||||
|
|
||||||
void BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
|
void BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
|
||||||
{
|
{
|
||||||
EDN_INFO("Search data : \"" << data.c_str() << "\"");
|
EDN_INFO("Search data : \"" << data << "\"");
|
||||||
|
|
||||||
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
||||||
bool SelectionIsRect;
|
bool SelectionIsRect;
|
||||||
|
@ -139,7 +139,7 @@ void CTagsManager::LoadTagFile(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// load (open) the tag file :
|
// load (open) the tag file :
|
||||||
EDN_INFO("try to open tag file : " << m_tagFilename.c_str());
|
EDN_INFO("try to open tag file : " << m_tagFilename);
|
||||||
m_ctagFile = tagsOpen(m_tagFilename.c_str(), &info);
|
m_ctagFile = tagsOpen(m_tagFilename.c_str(), &info);
|
||||||
if (NULL != m_ctagFile) {
|
if (NULL != m_ctagFile) {
|
||||||
EDN_INFO("open exuberant Ctags file is OK ...");
|
EDN_INFO("open exuberant Ctags file is OK ...");
|
||||||
@ -281,7 +281,7 @@ void CTagsManager::JumpTo(void)
|
|||||||
Edn::String destinationFilename = m_tagFolderBase;
|
Edn::String destinationFilename = m_tagFolderBase;
|
||||||
destinationFilename += entry.file;
|
destinationFilename += entry.file;
|
||||||
Edn::File myfile = destinationFilename;
|
Edn::File myfile = destinationFilename;
|
||||||
EDN_INFO(" OPEN the TAG file Destination : " << myfile.GetCompleateName().c_str() );
|
EDN_INFO(" OPEN the TAG file Destination : " << myfile );
|
||||||
if (false == myBufferManager->Exist(myfile) ) {
|
if (false == myBufferManager->Exist(myfile) ) {
|
||||||
// need to open the file :
|
// need to open the file :
|
||||||
int32_t openID = myBufferManager->Open(myfile);
|
int32_t openID = myBufferManager->Open(myfile);
|
||||||
@ -291,13 +291,13 @@ void CTagsManager::JumpTo(void)
|
|||||||
}
|
}
|
||||||
int32_t localId = myBufferManager->GetId(myfile);
|
int32_t localId = myBufferManager->GetId(myfile);
|
||||||
Edn::String pattern = entry.address.pattern;
|
Edn::String pattern = entry.address.pattern;
|
||||||
EDN_DEBUG("try to find line with : \"" << pattern.c_str() << "\"" );
|
EDN_DEBUG("try to find line with : \"" << pattern << "\"" );
|
||||||
if (pattern.Size() > 4) {
|
if (pattern.Size() > 4) {
|
||||||
pattern.Remove(0,2);
|
pattern.Remove(0,2);
|
||||||
pattern.Remove(pattern.Size()-1,2);
|
pattern.Remove(pattern.Size()-1,2);
|
||||||
}
|
}
|
||||||
// TODO : remove '\' char when needed ...
|
// TODO : remove '\' char when needed ...
|
||||||
EDN_DEBUG("try to find line with : \"" << pattern.c_str() << "\"" );
|
EDN_DEBUG("try to find line with : \"" << pattern << "\"" );
|
||||||
int32_t destLine = myBufferManager->Get(localId)->FindLine(pattern);
|
int32_t destLine = myBufferManager->Get(localId)->FindLine(pattern);
|
||||||
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, destLine);
|
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, destLine);
|
||||||
/*
|
/*
|
||||||
|
@ -30,6 +30,18 @@
|
|||||||
|
|
||||||
#define MAX_FILE_NAME (10240)
|
#define MAX_FILE_NAME (10240)
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "Edn::File"
|
||||||
|
|
||||||
|
|
||||||
|
std::ostream& Edn::operator <<(std::ostream &os, const Edn::File &obj)
|
||||||
|
{
|
||||||
|
os << obj.m_folder;
|
||||||
|
os << "/";
|
||||||
|
os << obj.m_shortFilename;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
Edn::File::File(Edn::String &filename, int32_t LineNumber)
|
Edn::File::File(Edn::String &filename, int32_t LineNumber)
|
||||||
{
|
{
|
||||||
m_lineNumberOpen = LineNumber;
|
m_lineNumberOpen = LineNumber;
|
||||||
@ -135,14 +147,14 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
|
|||||||
m_folder = "";
|
m_folder = "";
|
||||||
m_shortFilename = "";
|
m_shortFilename = "";
|
||||||
m_lineNumberOpen = 0;
|
m_lineNumberOpen = 0;
|
||||||
//EDN_DEBUG("1 :Set Name : " << newFilename.c_str() );
|
EDN_DEBUG("1 :Set Name : " << newFilename );
|
||||||
Edn::String destFilename;
|
Edn::String destFilename;
|
||||||
if (newFilename.Size() == 0) {
|
if (newFilename.Size() == 0) {
|
||||||
destFilename = "no-name";
|
destFilename = "no-name";
|
||||||
} else {
|
} else {
|
||||||
destFilename = newFilename;
|
destFilename = newFilename;
|
||||||
}
|
}
|
||||||
//EDN_DEBUG("2 : Get file Name : " << destFilename.c_str() );
|
//EDN_DEBUG("2 : Get file Name : " << destFilename );
|
||||||
if ('/' != *destFilename.c_str()) {
|
if ('/' != *destFilename.c_str()) {
|
||||||
// Get the command came from the running of the program :
|
// Get the command came from the running of the program :
|
||||||
char cCurrentPath[FILENAME_MAX];
|
char cCurrentPath[FILENAME_MAX];
|
||||||
@ -155,7 +167,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
|
|||||||
destFilename += '/';
|
destFilename += '/';
|
||||||
destFilename += tmpFilename;
|
destFilename += tmpFilename;
|
||||||
}
|
}
|
||||||
//EDN_DEBUG("3 : Get file Name : " << destFilename.c_str() );
|
//EDN_DEBUG("3 : Get file Name : " << destFilename );
|
||||||
|
|
||||||
// Get the real Path of the current File
|
// Get the real Path of the current File
|
||||||
ok = realpath(destFilename.c_str(), buf);
|
ok = realpath(destFilename.c_str(), buf);
|
||||||
@ -165,10 +177,10 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
|
|||||||
// Get the FileName
|
// Get the FileName
|
||||||
Edn::String tmpFilename = destFilename.Extract(lastPos+1);
|
Edn::String tmpFilename = destFilename.Extract(lastPos+1);
|
||||||
destFilename.Remove(lastPos, destFilename.Size() - lastPos);
|
destFilename.Remove(lastPos, destFilename.Size() - lastPos);
|
||||||
//EDN_DEBUG("try to find :\"" << destFilename.c_str() << "\" / \"" << tmpFilename.c_str() << "\" ");
|
//EDN_DEBUG("try to find :\"" << destFilename << "\" / \"" << tmpFilename << "\" ");
|
||||||
ok = realpath(destFilename.c_str(), buf);
|
ok = realpath(destFilename.c_str(), buf);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
EDN_ERROR("Can not find real Path name of \"" << destFilename.c_str() << "\"");
|
EDN_ERROR("Can not find real Path name of \"" << destFilename << "\"");
|
||||||
m_shortFilename = tmpFilename;
|
m_shortFilename = tmpFilename;
|
||||||
m_folder = destFilename;
|
m_folder = destFilename;
|
||||||
} else {
|
} else {
|
||||||
@ -177,7 +189,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
|
|||||||
m_folder = destFilename;
|
m_folder = destFilename;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
EDN_WARNING("file : \"" << destFilename.c_str() << "\" ==> No data???");
|
EDN_WARNING("file : \"" << destFilename << "\" ==> No data???");
|
||||||
// Basic ERROR ...
|
// Basic ERROR ...
|
||||||
m_shortFilename = destFilename;
|
m_shortFilename = destFilename;
|
||||||
}
|
}
|
||||||
@ -189,11 +201,11 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
|
|||||||
m_folder = destFilename.Extract(0, lastPos);
|
m_folder = destFilename.Extract(0, lastPos);
|
||||||
} else {
|
} else {
|
||||||
// Basic ERROR ...
|
// Basic ERROR ...
|
||||||
EDN_WARNING("file : \"" << destFilename.c_str() << "\" ==> No data???");
|
EDN_WARNING("file : \"" << destFilename << "\" ==> No data???");
|
||||||
m_shortFilename = destFilename;
|
m_shortFilename = destFilename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EDN_DEBUG("Set FileName :\"" << m_folder.c_str() << "\" / \"" << m_shortFilename.c_str() << "\" ");
|
EDN_DEBUG("Set FileName :\"" << m_folder << "\" / \"" << m_shortFilename << "\" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Edn::File::GetLineNumber(void)
|
int32_t Edn::File::GetLineNumber(void)
|
||||||
|
@ -40,17 +40,21 @@ namespace Edn
|
|||||||
Edn::String GetShortFilename(void) const;
|
Edn::String GetShortFilename(void) const;
|
||||||
Edn::String GetCompleateName(void) const;
|
Edn::String GetCompleateName(void) const;
|
||||||
int32_t GetLineNumber(void);
|
int32_t GetLineNumber(void);
|
||||||
|
void SetCompleateName(Edn::String &newFilename);
|
||||||
|
|
||||||
const Edn::File& operator= (const Edn::File &ednF );
|
const Edn::File& operator= (const Edn::File &ednF );
|
||||||
bool operator== (const Edn::File &ednF ) const;
|
bool operator== (const Edn::File &ednF ) const;
|
||||||
bool operator!= (const Edn::File &ednF ) const;
|
bool operator!= (const Edn::File &ednF ) const;
|
||||||
void SetCompleateName(Edn::String &newFilename);
|
friend std::ostream& operator <<( std::ostream &os,const Edn::File &obj);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
Edn::String m_folder;
|
Edn::String m_folder;
|
||||||
Edn::String m_shortFilename;
|
Edn::String m_shortFilename;
|
||||||
int32_t m_lineNumberOpen;
|
int32_t m_lineNumberOpen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::ostream& operator <<(std::ostream &os, const Edn::File &obj);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,8 +28,13 @@
|
|||||||
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "EdnString"
|
#define __class__ "Edn::String"
|
||||||
|
|
||||||
|
std::ostream& Edn::operator <<(std::ostream &os, const Edn::String &obj)
|
||||||
|
{
|
||||||
|
os << (char*)&obj.m_data[0];
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
@ -595,57 +600,57 @@ void Edn::TestUntaire_String(void)
|
|||||||
|
|
||||||
int32_t iddd = 0;
|
int32_t iddd = 0;
|
||||||
Edn::String * monString = new Edn::String();
|
Edn::String * monString = new Edn::String();
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||||
delete(monString);
|
delete(monString);
|
||||||
|
|
||||||
monString = new Edn::String("test de direct data");
|
monString = new Edn::String("test de direct data");
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||||
delete(monString);
|
delete(monString);
|
||||||
|
|
||||||
monString = new Edn::String("test de direct data", 7);
|
monString = new Edn::String("test de direct data", 7);
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||||
delete(monString);
|
delete(monString);
|
||||||
|
|
||||||
int32_t testId = -6789;
|
int32_t testId = -6789;
|
||||||
monString = new Edn::String(testId);
|
monString = new Edn::String(testId);
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||||
delete(monString);
|
delete(monString);
|
||||||
|
|
||||||
uint32_t testId2 = 12345;
|
uint32_t testId2 = 12345;
|
||||||
monString = new Edn::String((unsigned int)testId2);
|
monString = new Edn::String((unsigned int)testId2);
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||||
delete(monString);
|
delete(monString);
|
||||||
|
|
||||||
Edn::String plop = "otherString";
|
Edn::String plop = "otherString";
|
||||||
monString = new Edn::String(plop);
|
monString = new Edn::String(plop);
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||||
delete(monString);
|
delete(monString);
|
||||||
|
|
||||||
|
|
||||||
Edn::String s1 = "test de base ...";
|
Edn::String s1 = "test de base ...";
|
||||||
s1 += s1;
|
s1 += s1;
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||||
s1 += " plop 2 ";
|
s1 += " plop 2 ";
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||||
s1 += plop;
|
s1 += plop;
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||||
s1 = plop;
|
s1 = plop;
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||||
s1 = "test direct 44";
|
s1 = "test direct 44";
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||||
Edn::VectorType<int8_t> vb1;
|
Edn::VectorType<int8_t> vb1;
|
||||||
vb1.PushBack('v');
|
vb1.PushBack('v');
|
||||||
vb1.PushBack('b');
|
vb1.PushBack('b');
|
||||||
vb1.PushBack('1');
|
vb1.PushBack('1');
|
||||||
s1 = vb1;
|
s1 = vb1;
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||||
vb1.Clear();
|
vb1.Clear();
|
||||||
vb1.PushBack('v');
|
vb1.PushBack('v');
|
||||||
vb1.PushBack('b');
|
vb1.PushBack('b');
|
||||||
vb1.PushBack('2');
|
vb1.PushBack('2');
|
||||||
vb1.PushBack('\0');
|
vb1.PushBack('\0');
|
||||||
s1 = vb1;
|
s1 = vb1;
|
||||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||||
|
|
||||||
if (s1 == "vb2") {
|
if (s1 == "vb2") {
|
||||||
EDN_INFO("phase : " << iddd++ << " : == OK");
|
EDN_INFO("phase : " << iddd++ << " : == OK");
|
||||||
|
@ -57,7 +57,7 @@ namespace Edn
|
|||||||
Edn::String operator+ (const Edn::String &ednS); // + operator
|
Edn::String operator+ (const Edn::String &ednS); // + operator
|
||||||
Edn::String operator+ (const char * inputData);
|
Edn::String operator+ (const char * inputData);
|
||||||
//operator const char *()
|
//operator const char *()
|
||||||
//friend std::ostream& operator <<( std::ostream &os,const Edn::String &obj);
|
friend std::ostream& operator <<( std::ostream &os,const Edn::String &obj);
|
||||||
|
|
||||||
bool IsEmpty(void) const;
|
bool IsEmpty(void) const;
|
||||||
int32_t Size(void) const;
|
int32_t Size(void) const;
|
||||||
@ -79,16 +79,13 @@ namespace Edn
|
|||||||
};
|
};
|
||||||
|
|
||||||
void TestUntaire_String(void);
|
void TestUntaire_String(void);
|
||||||
|
|
||||||
|
std::ostream& operator <<(std::ostream &os, const Edn::String &obj);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
std::ostream& operator <<(std::ostream &os, const Edn::String &obj)
|
|
||||||
{
|
|
||||||
os << obj.c_str();
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user