Edn::File is now implemented an integrated in the system ==> test is OK

This commit is contained in:
2011-08-05 14:31:47 +02:00
parent ff055b88d4
commit 7b303d2aad
14 changed files with 121 additions and 167 deletions

View File

@@ -32,11 +32,19 @@
Edn::File::File(Edn::String &filename, int32_t LineNumber)
{
m_lineNumberOpen = 0;
m_lineNumberOpen = LineNumber;
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::String tmpString = folder;
@@ -46,29 +54,29 @@ Edn::File::File(Edn::String &filename, Edn::String &folder, int32_t lineNumber)
m_lineNumberOpen = lineNumber;
}
Edn::File::~File(void)
{
// nothing to do ...
}
Edn::String Edn::File::GetFolder(void)
Edn::String Edn::File::GetFolder(void) const
{
return m_folder;
}
Edn::String Edn::File::GetShortFilename(void)
Edn::String Edn::File::GetShortFilename(void) const
{
return m_shortFilename;
}
Edn::String Edn::File::GetCompleateName(void)
Edn::String Edn::File::GetCompleateName(void) const
{
Edn::String out;
out = m_folder;
out += '/';
out += m_shortFilename;
return out;
}
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)
{
char buf[MAX_FILE_NAME];
@@ -92,13 +135,14 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
m_folder = "";
m_shortFilename = "";
m_lineNumberOpen = 0;
//EDN_DEBUG("1 :Set Name : " << newFilename.c_str() );
Edn::String destFilename;
if (newFilename.Size() == 0) {
destFilename = "no-name";
} else {
destFilename = newFilename;
}
//EDN_DEBUG("2 : Get file Name : " << destFilename.c_str() );
if ('/' != *destFilename.c_str()) {
// Get the command came from the running of the program :
char cCurrentPath[FILENAME_MAX];
@@ -111,6 +155,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
destFilename += '/';
destFilename += tmpFilename;
}
//EDN_DEBUG("3 : Get file Name : " << destFilename.c_str() );
// Get the real Path of the current File
ok = realpath(destFilename.c_str(), buf);

View File

@@ -33,14 +33,17 @@ namespace Edn
public:
File(void) { m_lineNumberOpen=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(void);
Edn::String GetFolder(void);
Edn::String GetShortFilename(void);
Edn::String GetCompleateName(void);
Edn::String GetFolder(void) const;
Edn::String GetShortFilename(void) const;
Edn::String GetCompleateName(void) const;
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);
private :

View File

@@ -385,6 +385,9 @@ Edn::String Edn::String::operator+ (const char * inputData)
}
/**
* @brief
*

View File

@@ -25,6 +25,8 @@
#ifndef __END__STRING_H__
#define __END__STRING_H__
#include <iostream>
namespace Edn
{
class String
@@ -55,6 +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);
bool IsEmpty(void) const;
int32_t Size(void) const;
@@ -78,5 +81,15 @@ namespace Edn
void TestUntaire_String(void);
}
/*
std::ostream& operator <<(std::ostream &os, const Edn::String &obj)
{
os << obj.c_str();
return os;
}
*/
#endif