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)
|
||||
{
|
||||
BasicInit();
|
||||
EDN_INFO("Add Data from file(" << GetFileName().GetCompleateName().c_str() << ")");
|
||||
EDN_INFO("Add Data from file(" << GetFileName() << ")");
|
||||
FILE * myFile = NULL;
|
||||
// try to open the file. if not existed, new file
|
||||
|
||||
@ -113,7 +113,7 @@ BufferText::BufferText(Edn::File &fileName) : Buffer(fileName)
|
||||
SetModify(false);
|
||||
} else {
|
||||
// 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);
|
||||
}
|
||||
UpdateWindowsPosition();
|
||||
@ -131,7 +131,7 @@ BufferText::BufferText(Edn::File &fileName) : Buffer(fileName)
|
||||
*/
|
||||
void BufferText::Save(void)
|
||||
{
|
||||
EDN_INFO("Save File : \"" << GetFileName().GetCompleateName().c_str() << "\"" );
|
||||
EDN_INFO("Save File : \"" << GetFileName() << "\"" );
|
||||
FILE * myFile = NULL;
|
||||
myFile = fopen(GetFileName().GetCompleateName().c_str(), "w");
|
||||
if (NULL != myFile) {
|
||||
@ -1047,7 +1047,7 @@ int32_t BufferText::FindLine(Edn::String &data)
|
||||
EDN_WARNING("no search data");
|
||||
return 0;
|
||||
}
|
||||
EDN_INFO("Search data line : \"" << data.c_str() << "\"");
|
||||
EDN_INFO("Search data line : \"" << data << "\"");
|
||||
Edn::VectorType<int8_t> mVectSearch;
|
||||
mVectSearch = data.GetVector();
|
||||
//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)
|
||||
{
|
||||
EDN_INFO("Search data : \"" << data.c_str() << "\"");
|
||||
EDN_INFO("Search data : \"" << data << "\"");
|
||||
|
||||
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
||||
bool SelectionIsRect;
|
||||
|
@ -139,7 +139,7 @@ void CTagsManager::LoadTagFile(void)
|
||||
return;
|
||||
}
|
||||
// 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);
|
||||
if (NULL != m_ctagFile) {
|
||||
EDN_INFO("open exuberant Ctags file is OK ...");
|
||||
@ -281,7 +281,7 @@ void CTagsManager::JumpTo(void)
|
||||
Edn::String destinationFilename = m_tagFolderBase;
|
||||
destinationFilename += entry.file;
|
||||
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) ) {
|
||||
// need to open the file :
|
||||
int32_t openID = myBufferManager->Open(myfile);
|
||||
@ -291,13 +291,13 @@ void CTagsManager::JumpTo(void)
|
||||
}
|
||||
int32_t localId = myBufferManager->GetId(myfile);
|
||||
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) {
|
||||
pattern.Remove(0,2);
|
||||
pattern.Remove(pattern.Size()-1,2);
|
||||
}
|
||||
// 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);
|
||||
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, destLine);
|
||||
/*
|
||||
|
@ -30,6 +30,18 @@
|
||||
|
||||
#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)
|
||||
{
|
||||
m_lineNumberOpen = LineNumber;
|
||||
@ -135,14 +147,14 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
|
||||
m_folder = "";
|
||||
m_shortFilename = "";
|
||||
m_lineNumberOpen = 0;
|
||||
//EDN_DEBUG("1 :Set Name : " << newFilename.c_str() );
|
||||
EDN_DEBUG("1 :Set Name : " << newFilename );
|
||||
Edn::String destFilename;
|
||||
if (newFilename.Size() == 0) {
|
||||
destFilename = "no-name";
|
||||
} else {
|
||||
destFilename = newFilename;
|
||||
}
|
||||
//EDN_DEBUG("2 : Get file Name : " << destFilename.c_str() );
|
||||
//EDN_DEBUG("2 : Get file Name : " << destFilename );
|
||||
if ('/' != *destFilename.c_str()) {
|
||||
// Get the command came from the running of the program :
|
||||
char cCurrentPath[FILENAME_MAX];
|
||||
@ -155,7 +167,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
|
||||
destFilename += '/';
|
||||
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
|
||||
ok = realpath(destFilename.c_str(), buf);
|
||||
@ -165,10 +177,10 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
|
||||
// Get the FileName
|
||||
Edn::String tmpFilename = destFilename.Extract(lastPos+1);
|
||||
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);
|
||||
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_folder = destFilename;
|
||||
} else {
|
||||
@ -177,7 +189,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
|
||||
m_folder = destFilename;
|
||||
}
|
||||
} else {
|
||||
EDN_WARNING("file : \"" << destFilename.c_str() << "\" ==> No data???");
|
||||
EDN_WARNING("file : \"" << destFilename << "\" ==> No data???");
|
||||
// Basic ERROR ...
|
||||
m_shortFilename = destFilename;
|
||||
}
|
||||
@ -189,11 +201,11 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
|
||||
m_folder = destFilename.Extract(0, lastPos);
|
||||
} else {
|
||||
// Basic ERROR ...
|
||||
EDN_WARNING("file : \"" << destFilename.c_str() << "\" ==> No data???");
|
||||
EDN_WARNING("file : \"" << destFilename << "\" ==> No data???");
|
||||
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)
|
||||
|
@ -40,17 +40,21 @@ namespace Edn
|
||||
Edn::String GetShortFilename(void) const;
|
||||
Edn::String GetCompleateName(void) const;
|
||||
int32_t GetLineNumber(void);
|
||||
void SetCompleateName(Edn::String &newFilename);
|
||||
|
||||
const Edn::File& operator= (const Edn::File &ednF );
|
||||
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 :
|
||||
Edn::String m_folder;
|
||||
Edn::String m_shortFilename;
|
||||
int32_t m_lineNumberOpen;
|
||||
};
|
||||
|
||||
std::ostream& operator <<(std::ostream &os, const Edn::File &obj);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -28,8 +28,13 @@
|
||||
|
||||
|
||||
#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
|
||||
@ -595,57 +600,57 @@ void Edn::TestUntaire_String(void)
|
||||
|
||||
int32_t iddd = 0;
|
||||
Edn::String * monString = new Edn::String();
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
monString = new Edn::String("test de direct data");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
monString = new Edn::String("test de direct data", 7);
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
int32_t testId = -6789;
|
||||
monString = new Edn::String(testId);
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
uint32_t testId2 = 12345;
|
||||
monString = new Edn::String((unsigned int)testId2);
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
Edn::String plop = "otherString";
|
||||
monString = new Edn::String(plop);
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
|
||||
delete(monString);
|
||||
|
||||
|
||||
Edn::String s1 = "test de base ...";
|
||||
s1 += s1;
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||
s1 += " plop 2 ";
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||
s1 += plop;
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||
s1 = plop;
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||
s1 = "test direct 44";
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||
Edn::VectorType<int8_t> vb1;
|
||||
vb1.PushBack('v');
|
||||
vb1.PushBack('b');
|
||||
vb1.PushBack('1');
|
||||
s1 = vb1;
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||
vb1.Clear();
|
||||
vb1.PushBack('v');
|
||||
vb1.PushBack('b');
|
||||
vb1.PushBack('2');
|
||||
vb1.PushBack('\0');
|
||||
s1 = vb1;
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
|
||||
EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
|
||||
|
||||
if (s1 == "vb2") {
|
||||
EDN_INFO("phase : " << iddd++ << " : == OK");
|
||||
|
@ -57,7 +57,7 @@ namespace Edn
|
||||
Edn::String operator+ (const Edn::String &ednS); // + operator
|
||||
Edn::String operator+ (const char * inputData);
|
||||
//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;
|
||||
int32_t Size(void) const;
|
||||
@ -79,16 +79,13 @@ namespace Edn
|
||||
};
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user