Edn::File is now implemented an integrated in the system ==> test is OK
This commit is contained in:
parent
ff055b88d4
commit
7b303d2aad
@ -41,9 +41,11 @@
|
|||||||
*/
|
*/
|
||||||
Buffer::Buffer()
|
Buffer::Buffer()
|
||||||
{
|
{
|
||||||
|
static int32_t fileBasicID = 0;
|
||||||
m_fileModify = true;
|
m_fileModify = true;
|
||||||
m_haveName = false;
|
m_haveName = false;
|
||||||
Edn::String mString = "No-Name";
|
Edn::String mString = "Untitle - ";
|
||||||
|
mString += fileBasicID++;
|
||||||
SetFileName(mString);
|
SetFileName(mString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,10 +57,10 @@ Buffer::Buffer()
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Buffer::Buffer(Edn::String &newFileName)
|
Buffer::Buffer(Edn::File &newName)
|
||||||
{
|
{
|
||||||
m_fileModify = false;
|
m_fileModify = false;
|
||||||
SetFileName(newFileName);
|
SetFileName(newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +45,7 @@ typedef struct{
|
|||||||
class Buffer {
|
class Buffer {
|
||||||
public:
|
public:
|
||||||
Buffer(void);
|
Buffer(void);
|
||||||
Buffer(Edn::String &filename);
|
Buffer(Edn::File &newName);
|
||||||
virtual ~Buffer(void);
|
virtual ~Buffer(void);
|
||||||
|
|
||||||
Edn::File GetFileName(void)
|
Edn::File GetFileName(void)
|
||||||
@ -105,9 +105,10 @@ class Buffer {
|
|||||||
virtual void JumpAtLine(int32_t newLine);
|
virtual void JumpAtLine(int32_t newLine);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_fileModify;
|
bool m_fileModify; //!<
|
||||||
Edn::File m_fileName;
|
// naming
|
||||||
bool m_haveName; //!< to know if the file have a name or NOT
|
Edn::File m_fileName; //!< filename of the curent buffer
|
||||||
|
bool m_haveName; //!< to know if the file have a name or NOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,10 +185,11 @@ int32_t BufferManager::Create(void)
|
|||||||
* @todo : check if this file is not curently open and return the old ID
|
* @todo : check if this file is not curently open and return the old ID
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t BufferManager::Open(Edn::String &filename)
|
int32_t BufferManager::Open(Edn::File &myFile)
|
||||||
{
|
{
|
||||||
|
// TODO : Check here if the file is already open ==> and display it if needed
|
||||||
// allocate a new Buffer
|
// allocate a new Buffer
|
||||||
Buffer *myBuffer = new BufferText(filename);
|
Buffer *myBuffer = new BufferText(myFile);
|
||||||
// Add at the list of element
|
// Add at the list of element
|
||||||
listBuffer.PushBack(myBuffer);
|
listBuffer.PushBack(myBuffer);
|
||||||
int32_t basicID = listBuffer.Size() - 1;
|
int32_t basicID = listBuffer.Size() - 1;
|
||||||
@ -235,14 +236,23 @@ bool BufferManager::Exist(int32_t BufferID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t BufferManager::GetId(Edn::String &filename)
|
bool BufferManager::Exist(Edn::File &myFile )
|
||||||
|
{
|
||||||
|
if (-1 == GetId(myFile)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t BufferManager::GetId(Edn::File &myFile)
|
||||||
{
|
{
|
||||||
int32_t iii;
|
int32_t iii;
|
||||||
// check if the Buffer existed
|
// check if the Buffer existed
|
||||||
for (iii=0; iii < listBuffer.Size(); iii++) {
|
for (iii=0; iii < listBuffer.Size(); iii++) {
|
||||||
// check if the buffer already existed
|
// check if the buffer already existed
|
||||||
if (NULL != listBuffer[iii]) {
|
if (NULL != listBuffer[iii]) {
|
||||||
if ( listBuffer[iii]->GetFileName().GetCompleateName() == filename) {
|
if ( listBuffer[iii]->GetFileName() == myFile) {
|
||||||
return iii;
|
return iii;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,14 +260,6 @@ int32_t BufferManager::GetId(Edn::String &filename)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BufferManager::Exist(Edn::String &filename)
|
|
||||||
{
|
|
||||||
if (-1 == GetId(filename)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
|
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
|
||||||
uint32_t BufferManager::Size(void)
|
uint32_t BufferManager::Size(void)
|
||||||
|
@ -48,13 +48,13 @@ class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
|
|||||||
// create a buffer with no element
|
// create a buffer with no element
|
||||||
int32_t Create(void);
|
int32_t Create(void);
|
||||||
// open curent filename
|
// open curent filename
|
||||||
int32_t Open(Edn::String &filename);
|
int32_t Open(Edn::File &myFile);
|
||||||
int32_t GetSelected(void) { return m_idSelected;};
|
int32_t GetSelected(void) { return m_idSelected;};
|
||||||
void SetSelected(int32_t id) {m_idSelected = id;};
|
void SetSelected(int32_t id) {m_idSelected = id;};
|
||||||
Buffer * Get(int32_t BufferID);
|
Buffer * Get(int32_t BufferID);
|
||||||
bool Exist(int32_t BufferID);
|
bool Exist(int32_t BufferID);
|
||||||
bool Exist(Edn::String &filename);
|
bool Exist(Edn::File &myFile);
|
||||||
int32_t GetId(Edn::String &filename);
|
int32_t GetId(Edn::File &myFile);
|
||||||
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
|
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
|
||||||
uint32_t Size(void);
|
uint32_t Size(void);
|
||||||
int32_t WitchBuffer(int32_t iEmeElement);
|
int32_t WitchBuffer(int32_t iEmeElement);
|
||||||
|
@ -50,16 +50,10 @@ const uint32_t nbLineAllocatedInBase = 300;
|
|||||||
*/
|
*/
|
||||||
void BufferText::BasicInit(void)
|
void BufferText::BasicInit(void)
|
||||||
{
|
{
|
||||||
static int32_t fileBasicID = 0;
|
|
||||||
NeedToCleanEndPage = true;
|
NeedToCleanEndPage = true;
|
||||||
// set the first element that is displayed
|
// set the first element that is displayed
|
||||||
m_displayStartBufferPos = 0;
|
m_displayStartBufferPos = 0;
|
||||||
// set basic filename :
|
|
||||||
filename = "Untitled ";
|
|
||||||
filename += fileBasicID;
|
|
||||||
// no name ...
|
|
||||||
haveName = false;
|
|
||||||
fileBasicID++;
|
|
||||||
// set the number of the lineNumber;
|
// set the number of the lineNumber;
|
||||||
nbColoneForLineNumber = 1;
|
nbColoneForLineNumber = 1;
|
||||||
// init the link with the buffer manager
|
// init the link with the buffer manager
|
||||||
@ -104,16 +98,14 @@ BufferText::BufferText()
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
BufferText::BufferText(Edn::String &newFileName)
|
BufferText::BufferText(Edn::File &fileName) : Buffer(fileName)
|
||||||
{
|
{
|
||||||
BasicInit();
|
BasicInit();
|
||||||
EDN_INFO("Add Data from file(" << newFileName.c_str() << ")");
|
EDN_INFO("Add Data from file(" << GetFileName().GetCompleateName().c_str() << ")");
|
||||||
FILE * myFile = NULL;
|
FILE * myFile = NULL;
|
||||||
// set the filename :
|
|
||||||
SetName(newFileName);
|
|
||||||
// try to open the file. if not existed, new file
|
// try to open the file. if not existed, new file
|
||||||
|
|
||||||
myFile = fopen(newFileName.c_str(), "r");
|
myFile = fopen(fileName.GetCompleateName().c_str(), "r");
|
||||||
if (NULL != myFile) {
|
if (NULL != myFile) {
|
||||||
m_EdnBuf.DumpFrom(myFile);
|
m_EdnBuf.DumpFrom(myFile);
|
||||||
// close the input file
|
// close the input file
|
||||||
@ -121,7 +113,7 @@ BufferText::BufferText(Edn::String &newFileName)
|
|||||||
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(" << newFileName.c_str() << ")");
|
EDN_WARNING("No File ==> created a new one(" << GetFileName().GetCompleateName().c_str() << ")");
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
}
|
}
|
||||||
UpdateWindowsPosition();
|
UpdateWindowsPosition();
|
||||||
@ -139,9 +131,9 @@ BufferText::BufferText(Edn::String &newFileName)
|
|||||||
*/
|
*/
|
||||||
void BufferText::Save(void)
|
void BufferText::Save(void)
|
||||||
{
|
{
|
||||||
EDN_INFO("Save File : \"" << filename.c_str() << "\"" );
|
EDN_INFO("Save File : \"" << GetFileName().GetCompleateName().c_str() << "\"" );
|
||||||
FILE * myFile = NULL;
|
FILE * myFile = NULL;
|
||||||
myFile = fopen(filename.c_str(), "w");
|
myFile = fopen(GetFileName().GetCompleateName().c_str(), "w");
|
||||||
if (NULL != myFile) {
|
if (NULL != myFile) {
|
||||||
m_EdnBuf.DumpIn(myFile);
|
m_EdnBuf.DumpIn(myFile);
|
||||||
fclose(myFile);
|
fclose(myFile);
|
||||||
@ -187,104 +179,6 @@ void BufferText::SelectionCheckMode(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
Edn::String BufferText::GetName(void)
|
|
||||||
{
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
Edn::String BufferText::GetShortName(void)
|
|
||||||
{
|
|
||||||
char *ptr = strrchr(filename.c_str(), '/');
|
|
||||||
if (NULL == ptr) {
|
|
||||||
ptr = strrchr(filename.c_str(), '\\');
|
|
||||||
}
|
|
||||||
Edn::String out = filename;
|
|
||||||
if (NULL != ptr) {
|
|
||||||
out = ptr+1;
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
Edn::String BufferText::GetFolder(void)
|
|
||||||
{
|
|
||||||
char tmpVal[4096];
|
|
||||||
strncpy(tmpVal, filename.c_str(), 4096);
|
|
||||||
tmpVal[4096-1] = '\0';
|
|
||||||
char *ptr = strrchr(tmpVal, '/');
|
|
||||||
if (NULL == ptr) {
|
|
||||||
ptr = strrchr(tmpVal, '\\');
|
|
||||||
}
|
|
||||||
Edn::String out = "./";
|
|
||||||
if (NULL != ptr) {
|
|
||||||
*ptr = '\0';
|
|
||||||
out = tmpVal;
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
bool BufferText::HaveName(void)
|
|
||||||
{
|
|
||||||
return haveName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void BufferText::SetName(Edn::String &newName)
|
|
||||||
{
|
|
||||||
filename = newName;
|
|
||||||
haveName = true;
|
|
||||||
// Find HL system
|
|
||||||
if (true == HighlightManager::getInstance()->Exist(newName)) {
|
|
||||||
Highlight * myHL = HighlightManager::getInstance()->Get(newName);
|
|
||||||
// Set the new HL
|
|
||||||
if (NULL != myHL) {
|
|
||||||
m_EdnBuf.SetHLSystem(myHL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
|
@ -41,14 +41,9 @@ typedef enum {
|
|||||||
class BufferText : public Buffer {
|
class BufferText : public Buffer {
|
||||||
public:
|
public:
|
||||||
BufferText(void);
|
BufferText(void);
|
||||||
BufferText(Edn::String &filename);
|
BufferText(Edn::File &fileName);
|
||||||
virtual ~BufferText(void);
|
virtual ~BufferText(void);
|
||||||
Edn::String GetName(void);
|
|
||||||
Edn::String GetShortName(void);
|
|
||||||
Edn::String GetFolder(void);
|
|
||||||
void SetName(Edn::String &newName);
|
|
||||||
void Save(void);
|
void Save(void);
|
||||||
bool HaveName(void);
|
|
||||||
|
|
||||||
void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
||||||
void SetLineDisplay(uint32_t lineNumber);
|
void SetLineDisplay(uint32_t lineNumber);
|
||||||
@ -80,9 +75,6 @@ class BufferText : public Buffer {
|
|||||||
void SetCharset(charset_te newCharset);
|
void SetCharset(charset_te newCharset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// naming
|
|
||||||
Edn::String filename; //!< filename of the curent buffer
|
|
||||||
bool haveName; //!< to know if the file have a name or NOT
|
|
||||||
// Display
|
// Display
|
||||||
bool NeedToCleanEndPage; //!< if true, the end of the page need to be clean (arrive after a remove line)
|
bool NeedToCleanEndPage; //!< if true, the end of the page need to be clean (arrive after a remove line)
|
||||||
uint32_t nbColoneForLineNumber; //!< number of colome used to display the line Number
|
uint32_t nbColoneForLineNumber; //!< number of colome used to display the line Number
|
||||||
|
@ -255,24 +255,28 @@ void BufferView::OnPopupEventShow(GtkWidget *menuitem, gpointer data)
|
|||||||
{
|
{
|
||||||
BufferView * self = reinterpret_cast<BufferView*>(data);
|
BufferView * self = reinterpret_cast<BufferView*>(data);
|
||||||
self->SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, self->m_contectMenuSelectID);
|
self->SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, self->m_contectMenuSelectID);
|
||||||
|
self->m_contectMenuSelectID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferView::OnPopupEventClose(GtkWidget *menuitem, gpointer data)
|
void BufferView::OnPopupEventClose(GtkWidget *menuitem, gpointer data)
|
||||||
{
|
{
|
||||||
BufferView * self = reinterpret_cast<BufferView*>(data);
|
BufferView * self = reinterpret_cast<BufferView*>(data);
|
||||||
self->SendMessage(EDN_MSG__BUFF_ID_CLOSE, self->m_contectMenuSelectID);
|
self->SendMessage(EDN_MSG__BUFF_ID_CLOSE, self->m_contectMenuSelectID);
|
||||||
|
self->m_contectMenuSelectID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferView::OnPopupEventSave(GtkWidget *menuitem, gpointer data)
|
void BufferView::OnPopupEventSave(GtkWidget *menuitem, gpointer data)
|
||||||
{
|
{
|
||||||
BufferView * self = reinterpret_cast<BufferView*>(data);
|
BufferView * self = reinterpret_cast<BufferView*>(data);
|
||||||
self->SendMessage(EDN_MSG__BUFF_ID_SAVE, self->m_contectMenuSelectID);
|
self->SendMessage(EDN_MSG__BUFF_ID_SAVE, self->m_contectMenuSelectID);
|
||||||
|
self->m_contectMenuSelectID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferView::OnPopupEventSaveAs(GtkWidget *menuitem, gpointer data)
|
void BufferView::OnPopupEventSaveAs(GtkWidget *menuitem, gpointer data)
|
||||||
{
|
{
|
||||||
BufferView * self = reinterpret_cast<BufferView*>(data);
|
BufferView * self = reinterpret_cast<BufferView*>(data);
|
||||||
self->SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, self->m_contectMenuSelectID);
|
self->SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, self->m_contectMenuSelectID);
|
||||||
|
self->m_contectMenuSelectID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
|
|||||||
}
|
}
|
||||||
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||||
{
|
{
|
||||||
Edn::String myfilename;
|
Edn::File myfilename;
|
||||||
myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
|
myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
|
||||||
|
|
||||||
if (false == myBufferManager->Exist(myfilename) ) {
|
if (false == myBufferManager->Exist(myfilename) ) {
|
||||||
|
@ -280,15 +280,16 @@ void CTagsManager::JumpTo(void)
|
|||||||
BufferManager *myBufferManager = BufferManager::getInstance();
|
BufferManager *myBufferManager = BufferManager::getInstance();
|
||||||
Edn::String destinationFilename = m_tagFolderBase;
|
Edn::String destinationFilename = m_tagFolderBase;
|
||||||
destinationFilename += entry.file;
|
destinationFilename += entry.file;
|
||||||
EDN_INFO(" OPEN the TAG file Destination : " << destinationFilename.c_str() );
|
Edn::File myfile = destinationFilename;
|
||||||
if (false == myBufferManager->Exist(destinationFilename) ) {
|
EDN_INFO(" OPEN the TAG file Destination : " << myfile.GetCompleateName().c_str() );
|
||||||
|
if (false == myBufferManager->Exist(myfile) ) {
|
||||||
// need to open the file :
|
// need to open the file :
|
||||||
int32_t openID = myBufferManager->Open(destinationFilename);
|
int32_t openID = myBufferManager->Open(myfile);
|
||||||
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
|
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
|
||||||
} else {
|
} else {
|
||||||
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(destinationFilename));
|
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(myfile));
|
||||||
}
|
}
|
||||||
int32_t localId = myBufferManager->GetId(destinationFilename);
|
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.c_str() << "\"" );
|
||||||
if (pattern.Size() > 4) {
|
if (pattern.Size() > 4) {
|
||||||
|
@ -110,13 +110,7 @@ int main (int argc, char *argv[])
|
|||||||
EDN_INFO("show list of files : ");
|
EDN_INFO("show list of files : ");
|
||||||
for( int32_t i=1 ; i<argc; i++) {
|
for( int32_t i=1 ; i<argc; i++) {
|
||||||
EDN_INFO("need load file : \"" << argv[i] << "\"" );
|
EDN_INFO("need load file : \"" << argv[i] << "\"" );
|
||||||
Edn::String myfile = "";
|
Edn::File myfile = (char *)argv[i];
|
||||||
// Special case for the root file origin
|
|
||||||
if ('/' != argv[i][0]) {
|
|
||||||
myfile+=cCurrentPath;
|
|
||||||
myfile+="/";
|
|
||||||
}
|
|
||||||
myfile+=(char *)argv[i];
|
|
||||||
|
|
||||||
if (false == myBufferManager->Exist(myfile) ) {
|
if (false == myBufferManager->Exist(myfile) ) {
|
||||||
int32_t idBuffOpened = myBufferManager->Open(myfile);
|
int32_t idBuffOpened = myBufferManager->Open(myfile);
|
||||||
|
@ -32,11 +32,19 @@
|
|||||||
|
|
||||||
Edn::File::File(Edn::String &filename, int32_t LineNumber)
|
Edn::File::File(Edn::String &filename, int32_t LineNumber)
|
||||||
{
|
{
|
||||||
m_lineNumberOpen = 0;
|
m_lineNumberOpen = LineNumber;
|
||||||
SetCompleateName(filename);
|
SetCompleateName(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Edn::File::File(const char *filename, int32_t LineNumber)
|
||||||
|
{
|
||||||
|
Edn::String tmpString = filename;
|
||||||
|
m_lineNumberOpen = LineNumber;
|
||||||
|
SetCompleateName(tmpString);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Edn::File::File(Edn::String &filename, Edn::String &folder, int32_t lineNumber)
|
Edn::File::File(Edn::String &filename, Edn::String &folder, int32_t lineNumber)
|
||||||
{
|
{
|
||||||
Edn::String tmpString = folder;
|
Edn::String tmpString = folder;
|
||||||
@ -46,29 +54,29 @@ Edn::File::File(Edn::String &filename, Edn::String &folder, int32_t lineNumber)
|
|||||||
m_lineNumberOpen = lineNumber;
|
m_lineNumberOpen = lineNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Edn::File::~File(void)
|
Edn::File::~File(void)
|
||||||
{
|
{
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Edn::String Edn::File::GetFolder(void)
|
Edn::String Edn::File::GetFolder(void) const
|
||||||
{
|
{
|
||||||
return m_folder;
|
return m_folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
Edn::String Edn::File::GetShortFilename(void)
|
Edn::String Edn::File::GetShortFilename(void) const
|
||||||
{
|
{
|
||||||
return m_shortFilename;
|
return m_shortFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
Edn::String Edn::File::GetCompleateName(void)
|
Edn::String Edn::File::GetCompleateName(void) const
|
||||||
{
|
{
|
||||||
Edn::String out;
|
Edn::String out;
|
||||||
out = m_folder;
|
out = m_folder;
|
||||||
out += '/';
|
out += '/';
|
||||||
out += m_shortFilename;
|
out += m_shortFilename;
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Edn::File& Edn::File::operator= (const Edn::File &ednF )
|
const Edn::File& Edn::File::operator= (const Edn::File &ednF )
|
||||||
@ -83,6 +91,41 @@ const Edn::File& Edn::File::operator= (const Edn::File &ednF )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param[in,out]
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool Edn::File::operator== (const Edn::File &ednF) const
|
||||||
|
{
|
||||||
|
if( this != &ednF ) {
|
||||||
|
if (ednF.GetCompleateName() == GetCompleateName() ) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param[in,out]
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool Edn::File::operator!= (const Edn::File &ednF) const
|
||||||
|
{
|
||||||
|
return !(*this == ednF);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Edn::File::SetCompleateName(Edn::String &newFilename)
|
void Edn::File::SetCompleateName(Edn::String &newFilename)
|
||||||
{
|
{
|
||||||
char buf[MAX_FILE_NAME];
|
char buf[MAX_FILE_NAME];
|
||||||
@ -92,13 +135,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::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() );
|
||||||
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];
|
||||||
@ -111,6 +155,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
|
|||||||
destFilename += '/';
|
destFilename += '/';
|
||||||
destFilename += tmpFilename;
|
destFilename += tmpFilename;
|
||||||
}
|
}
|
||||||
|
//EDN_DEBUG("3 : Get file Name : " << destFilename.c_str() );
|
||||||
|
|
||||||
// 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);
|
||||||
|
@ -33,14 +33,17 @@ namespace Edn
|
|||||||
public:
|
public:
|
||||||
File(void) { m_lineNumberOpen=0; }
|
File(void) { m_lineNumberOpen=0; }
|
||||||
File(Edn::String &filename, int32_t LineNumber = 0);
|
File(Edn::String &filename, int32_t LineNumber = 0);
|
||||||
|
File(const char *filename, int32_t LineNumber = 0);
|
||||||
File(Edn::String &filename, Edn::String &folder, int32_t lineNumber = 0);
|
File(Edn::String &filename, Edn::String &folder, int32_t lineNumber = 0);
|
||||||
~File(void);
|
~File(void);
|
||||||
Edn::String GetFolder(void);
|
Edn::String GetFolder(void) const;
|
||||||
Edn::String GetShortFilename(void);
|
Edn::String GetShortFilename(void) const;
|
||||||
Edn::String GetCompleateName(void);
|
Edn::String GetCompleateName(void) const;
|
||||||
int32_t GetLineNumber(void);
|
int32_t GetLineNumber(void);
|
||||||
|
|
||||||
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;
|
||||||
void SetCompleateName(Edn::String &newFilename);
|
void SetCompleateName(Edn::String &newFilename);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
@ -385,6 +385,9 @@ Edn::String Edn::String::operator+ (const char * inputData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#ifndef __END__STRING_H__
|
#ifndef __END__STRING_H__
|
||||||
#define __END__STRING_H__
|
#define __END__STRING_H__
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Edn
|
namespace Edn
|
||||||
{
|
{
|
||||||
class String
|
class String
|
||||||
@ -55,6 +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);
|
||||||
|
|
||||||
bool IsEmpty(void) const;
|
bool IsEmpty(void) const;
|
||||||
int32_t Size(void) const;
|
int32_t Size(void) const;
|
||||||
@ -78,5 +81,15 @@ namespace Edn
|
|||||||
void TestUntaire_String(void);
|
void TestUntaire_String(void);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
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