diff --git a/Directory.h b/Directory.h index 56f203b..38e3fa5 100644 --- a/Directory.h +++ b/Directory.h @@ -5,46 +5,46 @@ # include "DirectoryEntry.h" namespace coreutils { - + class Directory { - + public: Directory(std::string path) { - dir = opendir(path.c_str()); - if(dir) { - struct dirent *entry = readdir(dir); - while(entry) { - directory.emplace(std::string(entry->d_name), entry); - entry = readdir(dir); - } + dir = opendir(path.c_str()); + if(dir) { + struct dirent *entry = readdir(dir); + while(entry) { + directory.emplace(std::string(entry->d_name), entry); + entry = readdir(dir); + } } - if(directory.size() > 0) + if(directory.size() > 0) cursor = directory.begin(); } - + ~Directory() {} - + bool eod() { return cursor == directory.end(); } - + DirectoryEntry get() { if(cursor == directory.end()) return NULL; return cursor->second; } - + void next() { ++cursor; } - + private: DIR *dir; std::map directory; std::map::iterator cursor; - + }; - + } #endif \ No newline at end of file diff --git a/DirectoryEntry.h b/DirectoryEntry.h index 1b6bd68..64a14c0 100644 --- a/DirectoryEntry.h +++ b/DirectoryEntry.h @@ -4,25 +4,25 @@ # include "includes" namespace coreutils { - + class DirectoryEntry { - + public: DirectoryEntry(struct dirent *entry) { - memcpy(&this->entry, entry, sizeof(struct dirent)); + memcpy(&this->entry, entry, sizeof(struct dirent)); } - - ~DirectoryEntry() {} - + + ~DirectoryEntry() {} + std::string getName() { - return std::string(entry.d_name); + return std::string(entry.d_name); } - + private: struct dirent entry; - + }; - + } #endif diff --git a/File.cpp b/File.cpp index 722ada1..9d377df 100644 --- a/File.cpp +++ b/File.cpp @@ -23,7 +23,7 @@ namespace coreutils { } File::~File() { - + close(fd); } void File::setBufferSize(size_t size) { diff --git a/File.h b/File.h index 393f3d7..578028f 100644 --- a/File.h +++ b/File.h @@ -5,32 +5,32 @@ /// /// File -/// +/// /// File abstraction class for accessing local file system files. /// namespace coreutils { - + class File { - + public: File(std::string fileName, int mode = O_RDONLY, int authority = 0664); - ~File(); + ~File(); void setBufferSize(size_t size); void read(); void write(std::string data); std::string asString(); - + char *buffer; size_t size; - + std::string fileName; - + private: int fd; - + }; - + } #endif diff --git a/IMFMessage.cpp b/IMFMessage.cpp index d88cdf2..35033a7 100644 --- a/IMFMessage.cpp +++ b/IMFMessage.cpp @@ -16,6 +16,8 @@ namespace coreutils { bool IMFMessage::parse(PString &in) { + coreutils::Log(coreutils::LOG_DEBUG_1) << "Parsing-------\n" << in.str(); + while (!in.ifNext("\r\n")) { headers.emplace_back(in); }