diff --git a/CoreUtils.mk b/CoreUtils.mk
index c5a364f..ccaf744 100644
--- a/CoreUtils.mk
+++ b/CoreUtils.mk
@@ -5,22 +5,22 @@
## Debug
ProjectName :=CoreUtils
ConfigurationName :=Debug
-WorkspacePath :=/home/barant/Development/BMA/server_core
-ProjectPath :=/home/barant/Development/BMA/server_core/CoreUtils
+WorkspacePath :=/home/bradarant/barant
+ProjectPath :=/home/bradarant/barant/CoreUtils
IntermediateDirectory :=./Debug
OutDir := $(IntermediateDirectory)
CurrentFileName :=
CurrentFilePath :=
CurrentFileFullPath :=
User :=Brad Arant
-Date :=02/08/19
-CodeLitePath :=/home/barant/.codelite
-LinkerName :=g++
-SharedObjectLinkerName :=g++ -shared -fPIC
+Date :=12/09/19
+CodeLitePath :=/home/bradarant/.codelite
+LinkerName :=/usr/bin/x86_64-linux-gnu-g++
+SharedObjectLinkerName :=/usr/bin/x86_64-linux-gnu-g++ -shared -fPIC
ObjectSuffix :=.o
DependSuffix :=.o.d
-PreprocessSuffix :=.o.i
-DebugSwitch :=-gstab
+PreprocessSuffix :=.i
+DebugSwitch :=-g
IncludeSwitch :=-I
LibrarySwitch :=-l
OutputSwitch :=-o
@@ -31,7 +31,7 @@ OutputFile :=$(IntermediateDirectory)/lib$(ProjectName).a
Preprocessors :=
ObjectSwitch :=-o
ArchiveOutputSwitch :=
-PreprocessOnlySwitch :=-E
+PreprocessOnlySwitch :=-E
ObjectsFileList :="CoreUtils.txt"
PCHCompileFlags :=
MakeDirCommand :=mkdir -p
@@ -47,20 +47,21 @@ LibPath := $(LibraryPathSwitch).
## Common variables
## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables
##
-AR := ar rcus
-CXX := g++
-CC := gcc
+AR := /usr/bin/x86_64-linux-gnu-ar rcu
+CXX := /usr/bin/x86_64-linux-gnu-g++
+CC := /usr/bin/x86_64-linux-gnu-gcc
CXXFLAGS := -g $(Preprocessors)
CFLAGS := -g $(Preprocessors)
ASFLAGS :=
-AS := as
+AS := /usr/bin/x86_64-linux-gnu-as
##
## User defined environment variables
##
CodeLiteDir:=/usr/share/codelite
-Objects0=$(IntermediateDirectory)/IMFHeader.cpp$(ObjectSuffix) $(IntermediateDirectory)/PString.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFMultipart.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFMessage.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFRequest.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFResponse.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFFormData.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFPlainText.cpp$(ObjectSuffix)
+Objects0=$(IntermediateDirectory)/IMFHeader.cpp$(ObjectSuffix) $(IntermediateDirectory)/PString.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFMultipart.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFMessage.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFRequest.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFResponse.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFFormData.cpp$(ObjectSuffix) $(IntermediateDirectory)/IMFPlainText.cpp$(ObjectSuffix) $(IntermediateDirectory)/File.cpp$(ObjectSuffix) $(IntermediateDirectory)/Log.cpp$(ObjectSuffix) \
+ $(IntermediateDirectory)/Exception.cpp$(ObjectSuffix)
@@ -77,8 +78,8 @@ $(OutputFile): $(Objects)
@echo "" > $(IntermediateDirectory)/.d
@echo $(Objects0) > $(ObjectsFileList)
$(AR) $(ArchiveOutputSwitch)$(OutputFile) @$(ObjectsFileList) $(ArLibs)
- @$(MakeDirCommand) "/home/barant/Development/BMA/server_core/.build-debug"
- @echo rebuilt > "/home/barant/Development/BMA/server_core/.build-debug/CoreUtils"
+ @$(MakeDirCommand) "/home/bradarant/barant/.build-debug"
+ @echo rebuilt > "/home/bradarant/barant/.build-debug/CoreUtils"
MakeIntermediateDirs:
@test -d ./Debug || $(MakeDirCommand) ./Debug
@@ -94,7 +95,7 @@ PreBuild:
## Objects
##
$(IntermediateDirectory)/IMFHeader.cpp$(ObjectSuffix): IMFHeader.cpp $(IntermediateDirectory)/IMFHeader.cpp$(DependSuffix)
- $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/CoreUtils/IMFHeader.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFHeader.cpp$(ObjectSuffix) $(IncludePath)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFHeader.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFHeader.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/IMFHeader.cpp$(DependSuffix): IMFHeader.cpp
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFHeader.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFHeader.cpp$(DependSuffix) -MM IMFHeader.cpp
@@ -102,7 +103,7 @@ $(IntermediateDirectory)/IMFHeader.cpp$(PreprocessSuffix): IMFHeader.cpp
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFHeader.cpp$(PreprocessSuffix) IMFHeader.cpp
$(IntermediateDirectory)/PString.cpp$(ObjectSuffix): PString.cpp $(IntermediateDirectory)/PString.cpp$(DependSuffix)
- $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/CoreUtils/PString.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PString.cpp$(ObjectSuffix) $(IncludePath)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/PString.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PString.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/PString.cpp$(DependSuffix): PString.cpp
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PString.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PString.cpp$(DependSuffix) -MM PString.cpp
@@ -110,7 +111,7 @@ $(IntermediateDirectory)/PString.cpp$(PreprocessSuffix): PString.cpp
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PString.cpp$(PreprocessSuffix) PString.cpp
$(IntermediateDirectory)/IMFMultipart.cpp$(ObjectSuffix): IMFMultipart.cpp $(IntermediateDirectory)/IMFMultipart.cpp$(DependSuffix)
- $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/CoreUtils/IMFMultipart.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFMultipart.cpp$(ObjectSuffix) $(IncludePath)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFMultipart.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFMultipart.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/IMFMultipart.cpp$(DependSuffix): IMFMultipart.cpp
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFMultipart.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFMultipart.cpp$(DependSuffix) -MM IMFMultipart.cpp
@@ -118,7 +119,7 @@ $(IntermediateDirectory)/IMFMultipart.cpp$(PreprocessSuffix): IMFMultipart.cpp
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFMultipart.cpp$(PreprocessSuffix) IMFMultipart.cpp
$(IntermediateDirectory)/IMFMessage.cpp$(ObjectSuffix): IMFMessage.cpp $(IntermediateDirectory)/IMFMessage.cpp$(DependSuffix)
- $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/CoreUtils/IMFMessage.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFMessage.cpp$(ObjectSuffix) $(IncludePath)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFMessage.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFMessage.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/IMFMessage.cpp$(DependSuffix): IMFMessage.cpp
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFMessage.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFMessage.cpp$(DependSuffix) -MM IMFMessage.cpp
@@ -126,7 +127,7 @@ $(IntermediateDirectory)/IMFMessage.cpp$(PreprocessSuffix): IMFMessage.cpp
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFMessage.cpp$(PreprocessSuffix) IMFMessage.cpp
$(IntermediateDirectory)/IMFRequest.cpp$(ObjectSuffix): IMFRequest.cpp $(IntermediateDirectory)/IMFRequest.cpp$(DependSuffix)
- $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/CoreUtils/IMFRequest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFRequest.cpp$(ObjectSuffix) $(IncludePath)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFRequest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFRequest.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/IMFRequest.cpp$(DependSuffix): IMFRequest.cpp
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFRequest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFRequest.cpp$(DependSuffix) -MM IMFRequest.cpp
@@ -134,7 +135,7 @@ $(IntermediateDirectory)/IMFRequest.cpp$(PreprocessSuffix): IMFRequest.cpp
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFRequest.cpp$(PreprocessSuffix) IMFRequest.cpp
$(IntermediateDirectory)/IMFResponse.cpp$(ObjectSuffix): IMFResponse.cpp $(IntermediateDirectory)/IMFResponse.cpp$(DependSuffix)
- $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/CoreUtils/IMFResponse.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFResponse.cpp$(ObjectSuffix) $(IncludePath)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFResponse.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFResponse.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/IMFResponse.cpp$(DependSuffix): IMFResponse.cpp
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFResponse.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFResponse.cpp$(DependSuffix) -MM IMFResponse.cpp
@@ -142,7 +143,7 @@ $(IntermediateDirectory)/IMFResponse.cpp$(PreprocessSuffix): IMFResponse.cpp
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFResponse.cpp$(PreprocessSuffix) IMFResponse.cpp
$(IntermediateDirectory)/IMFFormData.cpp$(ObjectSuffix): IMFFormData.cpp $(IntermediateDirectory)/IMFFormData.cpp$(DependSuffix)
- $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/CoreUtils/IMFFormData.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFFormData.cpp$(ObjectSuffix) $(IncludePath)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFFormData.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFFormData.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/IMFFormData.cpp$(DependSuffix): IMFFormData.cpp
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFFormData.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFFormData.cpp$(DependSuffix) -MM IMFFormData.cpp
@@ -150,13 +151,37 @@ $(IntermediateDirectory)/IMFFormData.cpp$(PreprocessSuffix): IMFFormData.cpp
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFFormData.cpp$(PreprocessSuffix) IMFFormData.cpp
$(IntermediateDirectory)/IMFPlainText.cpp$(ObjectSuffix): IMFPlainText.cpp $(IntermediateDirectory)/IMFPlainText.cpp$(DependSuffix)
- $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/CoreUtils/IMFPlainText.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFPlainText.cpp$(ObjectSuffix) $(IncludePath)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/IMFPlainText.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/IMFPlainText.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/IMFPlainText.cpp$(DependSuffix): IMFPlainText.cpp
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/IMFPlainText.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/IMFPlainText.cpp$(DependSuffix) -MM IMFPlainText.cpp
$(IntermediateDirectory)/IMFPlainText.cpp$(PreprocessSuffix): IMFPlainText.cpp
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFPlainText.cpp$(PreprocessSuffix) IMFPlainText.cpp
+$(IntermediateDirectory)/File.cpp$(ObjectSuffix): File.cpp $(IntermediateDirectory)/File.cpp$(DependSuffix)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/File.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/File.cpp$(ObjectSuffix) $(IncludePath)
+$(IntermediateDirectory)/File.cpp$(DependSuffix): File.cpp
+ @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/File.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/File.cpp$(DependSuffix) -MM File.cpp
+
+$(IntermediateDirectory)/File.cpp$(PreprocessSuffix): File.cpp
+ $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/File.cpp$(PreprocessSuffix) File.cpp
+
+$(IntermediateDirectory)/Log.cpp$(ObjectSuffix): Log.cpp $(IntermediateDirectory)/Log.cpp$(DependSuffix)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/Log.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Log.cpp$(ObjectSuffix) $(IncludePath)
+$(IntermediateDirectory)/Log.cpp$(DependSuffix): Log.cpp
+ @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Log.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Log.cpp$(DependSuffix) -MM Log.cpp
+
+$(IntermediateDirectory)/Log.cpp$(PreprocessSuffix): Log.cpp
+ $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Log.cpp$(PreprocessSuffix) Log.cpp
+
+$(IntermediateDirectory)/Exception.cpp$(ObjectSuffix): Exception.cpp $(IntermediateDirectory)/Exception.cpp$(DependSuffix)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/CoreUtils/Exception.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Exception.cpp$(ObjectSuffix) $(IncludePath)
+$(IntermediateDirectory)/Exception.cpp$(DependSuffix): Exception.cpp
+ @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Exception.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Exception.cpp$(DependSuffix) -MM Exception.cpp
+
+$(IntermediateDirectory)/Exception.cpp$(PreprocessSuffix): Exception.cpp
+ $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Exception.cpp$(PreprocessSuffix) Exception.cpp
+
-include $(IntermediateDirectory)/*$(DependSuffix)
##
diff --git a/CoreUtils.project b/CoreUtils.project
index 2de35b0..966d781 100644
--- a/CoreUtils.project
+++ b/CoreUtils.project
@@ -23,6 +23,13 @@
+
+
+
+
+
+
+
diff --git a/CoreUtils.txt b/CoreUtils.txt
index ec4192f..25e747c 100644
--- a/CoreUtils.txt
+++ b/CoreUtils.txt
@@ -1 +1 @@
-./Debug/IMFHeader.cpp.o ./Debug/PString.cpp.o ./Debug/IMFMultipart.cpp.o ./Debug/IMFMessage.cpp.o ./Debug/IMFRequest.cpp.o ./Debug/IMFResponse.cpp.o ./Debug/IMFFormData.cpp.o ./Debug/IMFPlainText.cpp.o
+./Debug/IMFHeader.cpp.o ./Debug/PString.cpp.o ./Debug/IMFMultipart.cpp.o ./Debug/IMFMessage.cpp.o ./Debug/IMFRequest.cpp.o ./Debug/IMFResponse.cpp.o ./Debug/IMFFormData.cpp.o ./Debug/IMFPlainText.cpp.o ./Debug/File.cpp.o ./Debug/Log.cpp.o ./Debug/Exception.cpp.o
diff --git a/Debug/IMFHeader.cpp.o b/Debug/IMFHeader.cpp.o
index 9d9eb6b..543ffbe 100644
Binary files a/Debug/IMFHeader.cpp.o and b/Debug/IMFHeader.cpp.o differ
diff --git a/Debug/IMFHeader.cpp.o.d b/Debug/IMFHeader.cpp.o.d
index 8520979..d5566ad 100644
--- a/Debug/IMFHeader.cpp.o.d
+++ b/Debug/IMFHeader.cpp.o.d
@@ -1,5 +1,5 @@
Debug/IMFHeader.cpp.o: IMFHeader.cpp IMFHeader.h PString.h includes \
- ../ServerCore/Exception.h ../ServerCore/includes
+ Exception.h
IMFHeader.h:
@@ -7,6 +7,4 @@ PString.h:
includes:
-../ServerCore/Exception.h:
-
-../ServerCore/includes:
+Exception.h:
diff --git a/Debug/IMFMessage.cpp.o b/Debug/IMFMessage.cpp.o
index a22fa05..628a6ec 100644
Binary files a/Debug/IMFMessage.cpp.o and b/Debug/IMFMessage.cpp.o differ
diff --git a/Debug/IMFMultipart.cpp.o b/Debug/IMFMultipart.cpp.o
index be73442..705b349 100644
Binary files a/Debug/IMFMultipart.cpp.o and b/Debug/IMFMultipart.cpp.o differ
diff --git a/Debug/IMFRequest.cpp.o b/Debug/IMFRequest.cpp.o
index 015c4b5..0268a2e 100644
Binary files a/Debug/IMFRequest.cpp.o and b/Debug/IMFRequest.cpp.o differ
diff --git a/Debug/IMFRequest.cpp.o.d b/Debug/IMFRequest.cpp.o.d
index 8e54db4..ea815c9 100644
--- a/Debug/IMFRequest.cpp.o.d
+++ b/Debug/IMFRequest.cpp.o.d
@@ -1,5 +1,5 @@
Debug/IMFRequest.cpp.o: IMFRequest.cpp IMFRequest.h PString.h includes \
- ../ServerCore/Exception.h ../ServerCore/includes
+ Exception.h
IMFRequest.h:
@@ -7,6 +7,4 @@ PString.h:
includes:
-../ServerCore/Exception.h:
-
-../ServerCore/includes:
+Exception.h:
diff --git a/Debug/IMFResponse.cpp.o b/Debug/IMFResponse.cpp.o
index 94e2fca..2b823bf 100644
Binary files a/Debug/IMFResponse.cpp.o and b/Debug/IMFResponse.cpp.o differ
diff --git a/Debug/IMFResponse.cpp.o.d b/Debug/IMFResponse.cpp.o.d
index 5f1eb8a..961603f 100644
--- a/Debug/IMFResponse.cpp.o.d
+++ b/Debug/IMFResponse.cpp.o.d
@@ -1,7 +1,6 @@
Debug/IMFResponse.cpp.o: IMFResponse.cpp IMFResponse.h includes \
- IMFMessage.h PString.h IMFHeader.h IMFRequest.h IMFBody.h \
- ../ServerCore/Log.h ../ServerCore/includes ../ServerCore/File.h \
- ../ServerCore/Object.h
+ IMFMessage.h PString.h IMFHeader.h IMFRequest.h IMFBody.h Log.h File.h \
+ ../ServerCore/Object.h ../ServerCore/includes LogListener.h
IMFResponse.h:
@@ -17,10 +16,12 @@ IMFRequest.h:
IMFBody.h:
-../ServerCore/Log.h:
+Log.h:
+
+File.h:
+
+../ServerCore/Object.h:
../ServerCore/includes:
-../ServerCore/File.h:
-
-../ServerCore/Object.h:
+LogListener.h:
diff --git a/Debug/PString.cpp.o b/Debug/PString.cpp.o
index 0af81b1..3d0e1dc 100644
Binary files a/Debug/PString.cpp.o and b/Debug/PString.cpp.o differ
diff --git a/Debug/PString.cpp.o.d b/Debug/PString.cpp.o.d
index c6161c8..45b2302 100644
--- a/Debug/PString.cpp.o.d
+++ b/Debug/PString.cpp.o.d
@@ -1,14 +1,16 @@
-Debug/PString.cpp.o: PString.cpp PString.h includes ../ServerCore/Log.h \
- ../ServerCore/includes ../ServerCore/File.h ../ServerCore/Object.h
+Debug/PString.cpp.o: PString.cpp PString.h includes Log.h File.h \
+ ../ServerCore/Object.h ../ServerCore/includes LogListener.h
PString.h:
includes:
-../ServerCore/Log.h:
+Log.h:
+
+File.h:
+
+../ServerCore/Object.h:
../ServerCore/includes:
-../ServerCore/File.h:
-
-../ServerCore/Object.h:
+LogListener.h:
diff --git a/Debug/libCoreUtils.a b/Debug/libCoreUtils.a
index 410d258..2548683 100644
Binary files a/Debug/libCoreUtils.a and b/Debug/libCoreUtils.a differ
diff --git a/Directory.h b/Directory.h
index 83b7ded..86e9dd1 100644
--- a/Directory.h
+++ b/Directory.h
@@ -10,21 +10,38 @@ namespace coreutils {
public:
Directory(std::string path) {
- dir = opendir(path);
+ dir = opendir(path.c_str());
if(dir) {
- struct dirent entry = readdir(dir);
+ struct dirent *entry = readdir(dir);
while(entry) {
directory.emplace(std::string(entry->d_name), entry);
- entry = readdir(dir)
+ entry = readdir(dir);
}
+ }
+ 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;
diff --git a/DirectoryEntry.h b/DirectoryEntry.h
index 70dd873..e54201e 100644
--- a/DirectoryEntry.h
+++ b/DirectoryEntry.h
@@ -9,13 +9,13 @@ namespace coreutils {
public:
DirectoryEntry(struct dirent *entry) {
- memcpy(this->entry, entry, sizeof(struct dirent));
+ memcpy(&this->entry, entry, sizeof(struct dirent));
}
~DirectoryEntry() {}
std::string getName() {
- return std::string(entry->d_name);
+ return std::string(entry.d_name);
}
private:
diff --git a/Exception.cpp b/Exception.cpp
new file mode 100644
index 0000000..aa8f721
--- /dev/null
+++ b/Exception.cpp
@@ -0,0 +1,20 @@
+#include "Exception.h"
+#include "Log.h"
+
+namespace coreutils {
+
+ Exception::Exception(std::string text, std::string file, int line, int errorNumber) {
+ this->text = text;
+ this->file = file;
+ this->line = line;
+ if(errorNumber == -1)
+ this->errorNumber = errno;
+ else
+ this->errorNumber = errorNumber;
+
+ Log(LOG_EXCEPT) << text;
+ }
+
+ Exception::~Exception() {}
+
+}
diff --git a/Exception.h b/Exception.h
new file mode 100644
index 0000000..cd5fd86
--- /dev/null
+++ b/Exception.h
@@ -0,0 +1,24 @@
+#ifndef __Exception_h__
+#define __Exception_h__
+
+#include "includes"
+
+namespace coreutils {
+
+ class Exception {
+
+ public:
+ Exception(std::string text, std::string file = __FILE__, int line = __LINE__, int errorNumber = -1);
+ ~Exception();
+
+ std::string className;
+ std::string file;
+ int line;
+ std::string text;
+ int errorNumber;
+
+ };
+
+}
+
+#endif
diff --git a/File.cpp b/File.cpp
new file mode 100644
index 0000000..cffcf5c
--- /dev/null
+++ b/File.cpp
@@ -0,0 +1,43 @@
+#include "File.h"
+#include "Exception.h"
+
+namespace coreutils {
+
+ File::File(std::string fileName, int mode, int authority) {
+
+ this->fileName = fileName;
+
+ struct stat status;
+ stat(fileName.c_str(), &status);
+
+ buffer = NULL;
+
+ setBufferSize(status.st_size);
+
+ fd = open(fileName.c_str(), mode, authority);
+ if(fd < 0) {
+ std::stringstream temp;
+ temp << "Error opening file " << fileName << ".";
+ throw Exception(temp.str(), __FILE__, __LINE__);
+ }
+ }
+
+ File::~File() {
+
+ }
+
+ void File::setBufferSize(size_t size) {
+ buffer = (char *)realloc(buffer, size);
+ this->size = size;
+ }
+
+ void File::read() {
+ size = ::read(fd, buffer, size);
+ setBufferSize(size);
+ }
+
+ void File::write(std::string data) {
+ ::write(fd, data.c_str(), data.length());
+ }
+
+}
diff --git a/File.h b/File.h
new file mode 100644
index 0000000..1c25fc9
--- /dev/null
+++ b/File.h
@@ -0,0 +1,35 @@
+#ifndef __File_h__
+#define __File_h__
+
+#include "includes"
+
+///
+/// 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();
+ void setBufferSize(size_t size);
+ void read();
+ void write(std::string data);
+
+ char *buffer;
+ size_t size;
+
+ std::string fileName;
+
+ private:
+ int fd;
+
+ };
+
+}
+
+#endif
diff --git a/IMFFormData.cpp b/IMFFormData.cpp
index c3ce49c..0c65494 100644
--- a/IMFFormData.cpp
+++ b/IMFFormData.cpp
@@ -12,10 +12,13 @@ namespace coreutils {
std::string value;
for(PString section: sections) {
IMFMessage message(section);
- IMFPlainText *text = (IMFPlainText *)message.getBody();
- std::cout << text->toString();
+ if(message.getHeaderKeyPairValue("Content-Disposition", "name") == name) {
+ IMFPlainText *text = (IMFPlainText *)message.getBody();
+ return text->toString();
+ }
+
}
- return value;
+ return "";
}
}
diff --git a/IMFHeader.cpp b/IMFHeader.cpp
index bc2be1e..237c578 100644
--- a/IMFHeader.cpp
+++ b/IMFHeader.cpp
@@ -10,11 +10,11 @@ namespace coreutils {
IMFHeader::IMFHeader(PString &in) {
key = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-");
if(!in.ifNext(":"))
- throw core::Exception("Invalid character in expected header token.");
+ throw coreutils::Exception("Invalid character in expected header token.");
in.skipWhitespace();
value = in.getTokenExclude("\r\n");
if(!in.ifNext("\r\n"))
- throw core::Exception("Expected CRLF.");
+ throw coreutils::Exception("Expected CRLF.");
}
IMFHeader::IMFHeader(std::string key, std::string value) {
diff --git a/IMFMessage.cpp b/IMFMessage.cpp
index b1f85ec..ff1facd 100644
--- a/IMFMessage.cpp
+++ b/IMFMessage.cpp
@@ -12,6 +12,9 @@ namespace coreutils {
}
void IMFMessage::parse(PString &in) {
+ if(in.size() == 0)
+ return;
+
while(!in.ifNext("\r\n"))
headers.emplace_back(in);
@@ -55,16 +58,26 @@ namespace coreutils {
}
std::string IMFMessage::getHeaderKeyPairValue(std::string headerKey, std::string key) {
+ std::string value;
coreutils::PString psource(getHeader(headerKey, false));
std::vector sourcep = psource.split(";");
for(PString work: sourcep) {
work.skipWhitespace();
std::string token = work.getTokenExclude("=");
if(work.ifNext("=")) {
- if(token == key)
- return work.str();
+ if(token == key) {
+ if(work.ifNext("\"")) {
+ value = work.getTokenExclude("\"");
+ return value;
+ }
+ else {
+ value = work.str();
+ return value;
+ }
+ }
else
- continue;
+ continue;
+
} else if (work.ifNext(";") || work.ifNext(" ")) {
if(token == key)
diff --git a/IMFMultipart.cpp b/IMFMultipart.cpp
index 7b8f41a..1936e6c 100644
--- a/IMFMultipart.cpp
+++ b/IMFMultipart.cpp
@@ -1,4 +1,5 @@
#include "IMFMultipart.h"
+#include "PString.h"
namespace coreutils {
@@ -10,7 +11,12 @@ namespace coreutils {
buffer = in.str();
in.cursor -= 2;
sections = in.split("\r\n--" + boundary);
-
+ for(int ix = 0; ix < sections.size(); ++ix) {
+ if(sections[ix].str() == "--\r\n")
+ sections[ix] = PString("");
+ if(sections[ix].str().substr(0, 2) == "\r\n")
+ sections[ix].cursor += 2;
+ }
}
std::string IMFMultipart::toString() {
diff --git a/IMFRequest.cpp b/IMFRequest.cpp
index 7336ec3..705b957 100644
--- a/IMFRequest.cpp
+++ b/IMFRequest.cpp
@@ -8,13 +8,13 @@ namespace coreutils {
IMFRequest::IMFRequest(PString &in) {
method = in.getTokenExclude(" ");
if(!in.ifNext(" "))
- throw core::Exception("Expecting space after method.");
+ throw coreutils::Exception("Expecting space after method.");
uri = in.getTokenExclude(" ");
if(!in.ifNext(" "))
- throw core::Exception("Expecting space after URI.");
+ throw coreutils::Exception("Expecting space after URI.");
protocol = in.getTokenExclude("\r\n");
if(!in.ifNext("\r\n"))
- throw core::Exception("Expecting CRLF after protocol.");
+ throw coreutils::Exception("Expecting CRLF after protocol.");
}
std::string IMFRequest::getMethod() {
diff --git a/Log.cpp b/Log.cpp
new file mode 100644
index 0000000..b7a9404
--- /dev/null
+++ b/Log.cpp
@@ -0,0 +1,81 @@
+#include "ConsoleSession.h"
+#include "Log.h"
+#include "LogListener.h"
+#include "ConsoleServer.h"
+
+namespace coreutils {
+
+ LogListener *Log::logListener = NULL;
+ File *Log::logFile = NULL;
+ int Log::seq = 0;
+
+ Log::Log(LogListener *logListener) {
+ this->logListener = logListener;
+ }
+
+ Log::Log(File *logFile) {
+ this->logFile = logFile;
+ }
+
+ Log::Log(int level) {
+
+ output = true;
+
+ auto clock = std::chrono::system_clock::now();
+ time_t theTime = std::chrono::system_clock::to_time_t(clock);
+ std::string timeOut = std::string(ctime(&theTime));
+ timeOut = timeOut.substr(0, timeOut.length() - 1);
+
+ *this << timeOut;
+ *this << " ";
+
+ switch(level) {
+ case LOG_NONE:
+ *this << "[NONE] :";
+ break;
+ case LOG_INFO:
+ *this << "[INFO] :";
+ break;
+ case LOG_WARN:
+ *this << "[WARN] :";
+ break;
+ case LOG_EXCEPT:
+ *this << "[EXCEPT]: ";
+ break;
+ case LOG_DEBUG_1:
+ *this << "[DEBUG1]: ";
+ break;
+ case LOG_DEBUG_2:
+ *this << "[DEBUG2]: ";
+ break;
+ case LOG_DEBUG_3:
+ *this << "[DEBUG3]: ";
+ break;
+ case LOG_DEBUG_4:
+ *this << "[DEBUG4]: ";
+ break;
+ default:
+ *this << "[?] ?";
+ break;
+ };
+ }
+
+ Log::~Log() {
+
+ if(output) {
+
+ std::stringstream out;
+ out << seq << "." << this->str() << std::endl;;
+
+ if(logListener)
+ logListener->logSend(out.str());
+
+ if(logFile)
+ logFile->write(out.str());
+
+ std::cout << out.str();
+ ++seq;
+ }
+ }
+
+}
diff --git a/Log.h b/Log.h
new file mode 100644
index 0000000..8b19879
--- /dev/null
+++ b/Log.h
@@ -0,0 +1,95 @@
+#ifndef __Log_h__
+#define __Log_h__
+
+#include "includes"
+#include "File.h"
+#include "Object.h"
+#include "LogListener.h"
+
+namespace coreutils {
+
+ class ConsoleServer;
+
+ static const int LOG_NONE = 0;
+ static const int LOG_INFO = 1;
+ static const int LOG_WARN = 2;
+ static const int LOG_EXCEPT = 4;
+ static const int LOG_DEBUG_1 = 8;
+ static const int LOG_DEBUG_2 = 16;
+ static const int LOG_DEBUG_3 = 32;
+ static const int LOG_DEBUG_4 = 64;
+
+ ///
+ /// Log
+ ///
+ /// Provides easy to access and use logging features to maintain a
+ /// history of activity and provide information for activity debugging.
+ ///
+
+ class Log : public std::ostringstream {
+
+ public:
+
+ ///
+ /// Constructor method that accepts a pointer to a log listener
+ /// This enables the Log object to send new log
+ /// messages to the connected listener.
+ ///
+ /// @param consoleServer a pointer to the console server that will
+ /// be used to echo log entries.
+ ///
+
+ Log(LogListener *logListener);
+
+ ///
+ /// Constructor method accepts a file object that will be used to
+ /// echo all log entries. This provides a permanent disk file record
+ /// of all logged activity.
+ ///
+
+ Log(File *logFile);
+
+ ///
+ /// Constructor method that is used to send a message to the log.
+ ///
+ /// @param level the logging level to associate with this message.
+ ///
+ /// To send log message: Log(LOG_INFO) << "This is a log message.";
+ ///
+
+ Log(int level);
+
+ ///
+ /// The destructor for the log object.
+ ///
+
+ ~Log();
+
+ bool output = false;
+
+ ///
+ /// Set the logListener to point to the instantiated LogListener
+ /// object for the application.
+ ///
+
+ static LogListener *logListener;
+
+ ///
+ /// Specify a File object where the log entries will be written as
+ /// a permanent record to disk.
+ ///
+
+ static File *logFile;
+
+ ///
+ /// A meaningless sequenctial number that starts from - at the
+ /// beginning of the logging process.
+ ///
+
+ static int seq;
+
+ };
+
+}
+
+#endif
diff --git a/LogListener.h b/LogListener.h
new file mode 100644
index 0000000..98409ac
--- /dev/null
+++ b/LogListener.h
@@ -0,0 +1,15 @@
+#ifndef __LogListener_h__
+#define __LogListener_h__
+
+namespace coreutils {
+
+ class LogListener {
+
+ public:
+ virtual void logSend(std::string entry) {}
+
+ };
+
+}
+
+#endif
diff --git a/PString.cpp b/PString.cpp
index 6dea212..3c5e8cd 100644
--- a/PString.cpp
+++ b/PString.cpp
@@ -61,4 +61,8 @@ namespace coreutils {
cursor = pstring.find_first_not_of(" \t", cursor);
}
+ int PString::size() {
+ return pstring.size() - cursor;
+ }
+
}
\ No newline at end of file
diff --git a/PString.h b/PString.h
index b9d0aa5..67b8574 100644
--- a/PString.h
+++ b/PString.h
@@ -18,6 +18,7 @@ namespace coreutils {
bool ifNext(std::string value);
void skipWhitespace();
int cursor = 0;
+ int size();
private:
std::string pstring;