Many additions and changes.
This commit is contained in:
parent
50f6e972de
commit
08169b1c3d
73
CoreUtils.mk
73
CoreUtils.mk
@ -5,22 +5,22 @@
|
|||||||
## Debug
|
## Debug
|
||||||
ProjectName :=CoreUtils
|
ProjectName :=CoreUtils
|
||||||
ConfigurationName :=Debug
|
ConfigurationName :=Debug
|
||||||
WorkspacePath :=/home/barant/Development/BMA/server_core
|
WorkspacePath :=/home/bradarant/barant
|
||||||
ProjectPath :=/home/barant/Development/BMA/server_core/CoreUtils
|
ProjectPath :=/home/bradarant/barant/CoreUtils
|
||||||
IntermediateDirectory :=./Debug
|
IntermediateDirectory :=./Debug
|
||||||
OutDir := $(IntermediateDirectory)
|
OutDir := $(IntermediateDirectory)
|
||||||
CurrentFileName :=
|
CurrentFileName :=
|
||||||
CurrentFilePath :=
|
CurrentFilePath :=
|
||||||
CurrentFileFullPath :=
|
CurrentFileFullPath :=
|
||||||
User :=Brad Arant
|
User :=Brad Arant
|
||||||
Date :=02/08/19
|
Date :=12/09/19
|
||||||
CodeLitePath :=/home/barant/.codelite
|
CodeLitePath :=/home/bradarant/.codelite
|
||||||
LinkerName :=g++
|
LinkerName :=/usr/bin/x86_64-linux-gnu-g++
|
||||||
SharedObjectLinkerName :=g++ -shared -fPIC
|
SharedObjectLinkerName :=/usr/bin/x86_64-linux-gnu-g++ -shared -fPIC
|
||||||
ObjectSuffix :=.o
|
ObjectSuffix :=.o
|
||||||
DependSuffix :=.o.d
|
DependSuffix :=.o.d
|
||||||
PreprocessSuffix :=.o.i
|
PreprocessSuffix :=.i
|
||||||
DebugSwitch :=-gstab
|
DebugSwitch :=-g
|
||||||
IncludeSwitch :=-I
|
IncludeSwitch :=-I
|
||||||
LibrarySwitch :=-l
|
LibrarySwitch :=-l
|
||||||
OutputSwitch :=-o
|
OutputSwitch :=-o
|
||||||
@ -31,7 +31,7 @@ OutputFile :=$(IntermediateDirectory)/lib$(ProjectName).a
|
|||||||
Preprocessors :=
|
Preprocessors :=
|
||||||
ObjectSwitch :=-o
|
ObjectSwitch :=-o
|
||||||
ArchiveOutputSwitch :=
|
ArchiveOutputSwitch :=
|
||||||
PreprocessOnlySwitch :=-E
|
PreprocessOnlySwitch :=-E
|
||||||
ObjectsFileList :="CoreUtils.txt"
|
ObjectsFileList :="CoreUtils.txt"
|
||||||
PCHCompileFlags :=
|
PCHCompileFlags :=
|
||||||
MakeDirCommand :=mkdir -p
|
MakeDirCommand :=mkdir -p
|
||||||
@ -47,20 +47,21 @@ LibPath := $(LibraryPathSwitch).
|
|||||||
## Common variables
|
## Common variables
|
||||||
## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables
|
## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables
|
||||||
##
|
##
|
||||||
AR := ar rcus
|
AR := /usr/bin/x86_64-linux-gnu-ar rcu
|
||||||
CXX := g++
|
CXX := /usr/bin/x86_64-linux-gnu-g++
|
||||||
CC := gcc
|
CC := /usr/bin/x86_64-linux-gnu-gcc
|
||||||
CXXFLAGS := -g $(Preprocessors)
|
CXXFLAGS := -g $(Preprocessors)
|
||||||
CFLAGS := -g $(Preprocessors)
|
CFLAGS := -g $(Preprocessors)
|
||||||
ASFLAGS :=
|
ASFLAGS :=
|
||||||
AS := as
|
AS := /usr/bin/x86_64-linux-gnu-as
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## User defined environment variables
|
## User defined environment variables
|
||||||
##
|
##
|
||||||
CodeLiteDir:=/usr/share/codelite
|
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 "" > $(IntermediateDirectory)/.d
|
||||||
@echo $(Objects0) > $(ObjectsFileList)
|
@echo $(Objects0) > $(ObjectsFileList)
|
||||||
$(AR) $(ArchiveOutputSwitch)$(OutputFile) @$(ObjectsFileList) $(ArLibs)
|
$(AR) $(ArchiveOutputSwitch)$(OutputFile) @$(ObjectsFileList) $(ArLibs)
|
||||||
@$(MakeDirCommand) "/home/barant/Development/BMA/server_core/.build-debug"
|
@$(MakeDirCommand) "/home/bradarant/barant/.build-debug"
|
||||||
@echo rebuilt > "/home/barant/Development/BMA/server_core/.build-debug/CoreUtils"
|
@echo rebuilt > "/home/bradarant/barant/.build-debug/CoreUtils"
|
||||||
|
|
||||||
MakeIntermediateDirs:
|
MakeIntermediateDirs:
|
||||||
@test -d ./Debug || $(MakeDirCommand) ./Debug
|
@test -d ./Debug || $(MakeDirCommand) ./Debug
|
||||||
@ -94,7 +95,7 @@ PreBuild:
|
|||||||
## Objects
|
## Objects
|
||||||
##
|
##
|
||||||
$(IntermediateDirectory)/IMFHeader.cpp$(ObjectSuffix): IMFHeader.cpp $(IntermediateDirectory)/IMFHeader.cpp$(DependSuffix)
|
$(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
|
$(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
|
@$(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
|
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFHeader.cpp$(PreprocessSuffix) IMFHeader.cpp
|
||||||
|
|
||||||
$(IntermediateDirectory)/PString.cpp$(ObjectSuffix): PString.cpp $(IntermediateDirectory)/PString.cpp$(DependSuffix)
|
$(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
|
$(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
|
@$(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
|
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PString.cpp$(PreprocessSuffix) PString.cpp
|
||||||
|
|
||||||
$(IntermediateDirectory)/IMFMultipart.cpp$(ObjectSuffix): IMFMultipart.cpp $(IntermediateDirectory)/IMFMultipart.cpp$(DependSuffix)
|
$(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
|
$(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
|
@$(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
|
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFMultipart.cpp$(PreprocessSuffix) IMFMultipart.cpp
|
||||||
|
|
||||||
$(IntermediateDirectory)/IMFMessage.cpp$(ObjectSuffix): IMFMessage.cpp $(IntermediateDirectory)/IMFMessage.cpp$(DependSuffix)
|
$(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
|
$(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
|
@$(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
|
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFMessage.cpp$(PreprocessSuffix) IMFMessage.cpp
|
||||||
|
|
||||||
$(IntermediateDirectory)/IMFRequest.cpp$(ObjectSuffix): IMFRequest.cpp $(IntermediateDirectory)/IMFRequest.cpp$(DependSuffix)
|
$(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
|
$(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
|
@$(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
|
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFRequest.cpp$(PreprocessSuffix) IMFRequest.cpp
|
||||||
|
|
||||||
$(IntermediateDirectory)/IMFResponse.cpp$(ObjectSuffix): IMFResponse.cpp $(IntermediateDirectory)/IMFResponse.cpp$(DependSuffix)
|
$(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
|
$(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
|
@$(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
|
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFResponse.cpp$(PreprocessSuffix) IMFResponse.cpp
|
||||||
|
|
||||||
$(IntermediateDirectory)/IMFFormData.cpp$(ObjectSuffix): IMFFormData.cpp $(IntermediateDirectory)/IMFFormData.cpp$(DependSuffix)
|
$(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
|
$(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
|
@$(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
|
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/IMFFormData.cpp$(PreprocessSuffix) IMFFormData.cpp
|
||||||
|
|
||||||
$(IntermediateDirectory)/IMFPlainText.cpp$(ObjectSuffix): IMFPlainText.cpp $(IntermediateDirectory)/IMFPlainText.cpp$(DependSuffix)
|
$(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
|
$(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
|
@$(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
|
$(IntermediateDirectory)/IMFPlainText.cpp$(PreprocessSuffix): IMFPlainText.cpp
|
||||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(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)
|
-include $(IntermediateDirectory)/*$(DependSuffix)
|
||||||
##
|
##
|
||||||
|
@ -23,6 +23,13 @@
|
|||||||
<File Name="IMFFormData.cpp"/>
|
<File Name="IMFFormData.cpp"/>
|
||||||
<File Name="IMFPlainText.h"/>
|
<File Name="IMFPlainText.h"/>
|
||||||
<File Name="IMFPlainText.cpp"/>
|
<File Name="IMFPlainText.cpp"/>
|
||||||
|
<File Name="File.cpp"/>
|
||||||
|
<File Name="File.h"/>
|
||||||
|
<File Name="Log.cpp"/>
|
||||||
|
<File Name="Log.h"/>
|
||||||
|
<File Name="Exception.cpp"/>
|
||||||
|
<File Name="Exception.h"/>
|
||||||
|
<File Name="LogListener.h"/>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
<Settings Type="Static Library">
|
<Settings Type="Static Library">
|
||||||
<GlobalSettings>
|
<GlobalSettings>
|
||||||
|
@ -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
|
||||||
|
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
Debug/IMFHeader.cpp.o: IMFHeader.cpp IMFHeader.h PString.h includes \
|
Debug/IMFHeader.cpp.o: IMFHeader.cpp IMFHeader.h PString.h includes \
|
||||||
../ServerCore/Exception.h ../ServerCore/includes
|
Exception.h
|
||||||
|
|
||||||
IMFHeader.h:
|
IMFHeader.h:
|
||||||
|
|
||||||
@ -7,6 +7,4 @@ PString.h:
|
|||||||
|
|
||||||
includes:
|
includes:
|
||||||
|
|
||||||
../ServerCore/Exception.h:
|
Exception.h:
|
||||||
|
|
||||||
../ServerCore/includes:
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
Debug/IMFRequest.cpp.o: IMFRequest.cpp IMFRequest.h PString.h includes \
|
Debug/IMFRequest.cpp.o: IMFRequest.cpp IMFRequest.h PString.h includes \
|
||||||
../ServerCore/Exception.h ../ServerCore/includes
|
Exception.h
|
||||||
|
|
||||||
IMFRequest.h:
|
IMFRequest.h:
|
||||||
|
|
||||||
@ -7,6 +7,4 @@ PString.h:
|
|||||||
|
|
||||||
includes:
|
includes:
|
||||||
|
|
||||||
../ServerCore/Exception.h:
|
Exception.h:
|
||||||
|
|
||||||
../ServerCore/includes:
|
|
||||||
|
Binary file not shown.
@ -1,7 +1,6 @@
|
|||||||
Debug/IMFResponse.cpp.o: IMFResponse.cpp IMFResponse.h includes \
|
Debug/IMFResponse.cpp.o: IMFResponse.cpp IMFResponse.h includes \
|
||||||
IMFMessage.h PString.h IMFHeader.h IMFRequest.h IMFBody.h \
|
IMFMessage.h PString.h IMFHeader.h IMFRequest.h IMFBody.h Log.h File.h \
|
||||||
../ServerCore/Log.h ../ServerCore/includes ../ServerCore/File.h \
|
../ServerCore/Object.h ../ServerCore/includes LogListener.h
|
||||||
../ServerCore/Object.h
|
|
||||||
|
|
||||||
IMFResponse.h:
|
IMFResponse.h:
|
||||||
|
|
||||||
@ -17,10 +16,12 @@ IMFRequest.h:
|
|||||||
|
|
||||||
IMFBody.h:
|
IMFBody.h:
|
||||||
|
|
||||||
../ServerCore/Log.h:
|
Log.h:
|
||||||
|
|
||||||
|
File.h:
|
||||||
|
|
||||||
|
../ServerCore/Object.h:
|
||||||
|
|
||||||
../ServerCore/includes:
|
../ServerCore/includes:
|
||||||
|
|
||||||
../ServerCore/File.h:
|
LogListener.h:
|
||||||
|
|
||||||
../ServerCore/Object.h:
|
|
||||||
|
Binary file not shown.
@ -1,14 +1,16 @@
|
|||||||
Debug/PString.cpp.o: PString.cpp PString.h includes ../ServerCore/Log.h \
|
Debug/PString.cpp.o: PString.cpp PString.h includes Log.h File.h \
|
||||||
../ServerCore/includes ../ServerCore/File.h ../ServerCore/Object.h
|
../ServerCore/Object.h ../ServerCore/includes LogListener.h
|
||||||
|
|
||||||
PString.h:
|
PString.h:
|
||||||
|
|
||||||
includes:
|
includes:
|
||||||
|
|
||||||
../ServerCore/Log.h:
|
Log.h:
|
||||||
|
|
||||||
|
File.h:
|
||||||
|
|
||||||
|
../ServerCore/Object.h:
|
||||||
|
|
||||||
../ServerCore/includes:
|
../ServerCore/includes:
|
||||||
|
|
||||||
../ServerCore/File.h:
|
LogListener.h:
|
||||||
|
|
||||||
../ServerCore/Object.h:
|
|
||||||
|
Binary file not shown.
23
Directory.h
23
Directory.h
@ -10,21 +10,38 @@ namespace coreutils {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Directory(std::string path) {
|
Directory(std::string path) {
|
||||||
dir = opendir(path);
|
dir = opendir(path.c_str());
|
||||||
if(dir) {
|
if(dir) {
|
||||||
struct dirent entry = readdir(dir);
|
struct dirent *entry = readdir(dir);
|
||||||
while(entry) {
|
while(entry) {
|
||||||
directory.emplace(std::string(entry->d_name), entry);
|
directory.emplace(std::string(entry->d_name), entry);
|
||||||
entry = readdir(dir)
|
entry = readdir(dir);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(directory.size() > 0)
|
||||||
|
cursor = directory.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
~Directory() {}
|
~Directory() {}
|
||||||
|
|
||||||
|
bool eod() {
|
||||||
|
return cursor == directory.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
DirectoryEntry get() {
|
||||||
|
if(cursor == directory.end())
|
||||||
|
return NULL;
|
||||||
|
return cursor->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
void next() {
|
||||||
|
++cursor;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
std::map<std::string, DirectoryEntry> directory;
|
std::map<std::string, DirectoryEntry> directory;
|
||||||
|
std::map<std::string, DirectoryEntry>::iterator cursor;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@ namespace coreutils {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DirectoryEntry(struct dirent *entry) {
|
DirectoryEntry(struct dirent *entry) {
|
||||||
memcpy(this->entry, entry, sizeof(struct dirent));
|
memcpy(&this->entry, entry, sizeof(struct dirent));
|
||||||
}
|
}
|
||||||
|
|
||||||
~DirectoryEntry() {}
|
~DirectoryEntry() {}
|
||||||
|
|
||||||
std::string getName() {
|
std::string getName() {
|
||||||
return std::string(entry->d_name);
|
return std::string(entry.d_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
20
Exception.cpp
Normal file
20
Exception.cpp
Normal file
@ -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() {}
|
||||||
|
|
||||||
|
}
|
24
Exception.h
Normal file
24
Exception.h
Normal file
@ -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
|
43
File.cpp
Normal file
43
File.cpp
Normal file
@ -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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
35
File.h
Normal file
35
File.h
Normal file
@ -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
|
@ -12,10 +12,13 @@ namespace coreutils {
|
|||||||
std::string value;
|
std::string value;
|
||||||
for(PString section: sections) {
|
for(PString section: sections) {
|
||||||
IMFMessage message(section);
|
IMFMessage message(section);
|
||||||
IMFPlainText *text = (IMFPlainText *)message.getBody();
|
if(message.getHeaderKeyPairValue("Content-Disposition", "name") == name) {
|
||||||
std::cout << text->toString();
|
IMFPlainText *text = (IMFPlainText *)message.getBody();
|
||||||
|
return text->toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return value;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,11 @@ namespace coreutils {
|
|||||||
IMFHeader::IMFHeader(PString &in) {
|
IMFHeader::IMFHeader(PString &in) {
|
||||||
key = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-");
|
key = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-");
|
||||||
if(!in.ifNext(":"))
|
if(!in.ifNext(":"))
|
||||||
throw core::Exception("Invalid character in expected header token.");
|
throw coreutils::Exception("Invalid character in expected header token.");
|
||||||
in.skipWhitespace();
|
in.skipWhitespace();
|
||||||
value = in.getTokenExclude("\r\n");
|
value = in.getTokenExclude("\r\n");
|
||||||
if(!in.ifNext("\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) {
|
IMFHeader::IMFHeader(std::string key, std::string value) {
|
||||||
|
@ -12,6 +12,9 @@ namespace coreutils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IMFMessage::parse(PString &in) {
|
void IMFMessage::parse(PString &in) {
|
||||||
|
if(in.size() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
while(!in.ifNext("\r\n"))
|
while(!in.ifNext("\r\n"))
|
||||||
headers.emplace_back(in);
|
headers.emplace_back(in);
|
||||||
|
|
||||||
@ -55,16 +58,26 @@ namespace coreutils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string IMFMessage::getHeaderKeyPairValue(std::string headerKey, std::string key) {
|
std::string IMFMessage::getHeaderKeyPairValue(std::string headerKey, std::string key) {
|
||||||
|
std::string value;
|
||||||
coreutils::PString psource(getHeader(headerKey, false));
|
coreutils::PString psource(getHeader(headerKey, false));
|
||||||
std::vector<PString> sourcep = psource.split(";");
|
std::vector<PString> sourcep = psource.split(";");
|
||||||
for(PString work: sourcep) {
|
for(PString work: sourcep) {
|
||||||
work.skipWhitespace();
|
work.skipWhitespace();
|
||||||
std::string token = work.getTokenExclude("=");
|
std::string token = work.getTokenExclude("=");
|
||||||
if(work.ifNext("=")) {
|
if(work.ifNext("=")) {
|
||||||
if(token == key)
|
if(token == key) {
|
||||||
return work.str();
|
if(work.ifNext("\"")) {
|
||||||
|
value = work.getTokenExclude("\"");
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
value = work.str();
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
} else if (work.ifNext(";") || work.ifNext(" ")) {
|
} else if (work.ifNext(";") || work.ifNext(" ")) {
|
||||||
if(token == key)
|
if(token == key)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "IMFMultipart.h"
|
#include "IMFMultipart.h"
|
||||||
|
#include "PString.h"
|
||||||
|
|
||||||
namespace coreutils {
|
namespace coreutils {
|
||||||
|
|
||||||
@ -10,7 +11,12 @@ namespace coreutils {
|
|||||||
buffer = in.str();
|
buffer = in.str();
|
||||||
in.cursor -= 2;
|
in.cursor -= 2;
|
||||||
sections = in.split("\r\n--" + boundary);
|
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() {
|
std::string IMFMultipart::toString() {
|
||||||
|
@ -8,13 +8,13 @@ namespace coreutils {
|
|||||||
IMFRequest::IMFRequest(PString &in) {
|
IMFRequest::IMFRequest(PString &in) {
|
||||||
method = in.getTokenExclude(" ");
|
method = in.getTokenExclude(" ");
|
||||||
if(!in.ifNext(" "))
|
if(!in.ifNext(" "))
|
||||||
throw core::Exception("Expecting space after method.");
|
throw coreutils::Exception("Expecting space after method.");
|
||||||
uri = in.getTokenExclude(" ");
|
uri = in.getTokenExclude(" ");
|
||||||
if(!in.ifNext(" "))
|
if(!in.ifNext(" "))
|
||||||
throw core::Exception("Expecting space after URI.");
|
throw coreutils::Exception("Expecting space after URI.");
|
||||||
protocol = in.getTokenExclude("\r\n");
|
protocol = in.getTokenExclude("\r\n");
|
||||||
if(!in.ifNext("\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() {
|
std::string IMFRequest::getMethod() {
|
||||||
|
81
Log.cpp
Normal file
81
Log.cpp
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
95
Log.h
Normal file
95
Log.h
Normal file
@ -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
|
15
LogListener.h
Normal file
15
LogListener.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef __LogListener_h__
|
||||||
|
#define __LogListener_h__
|
||||||
|
|
||||||
|
namespace coreutils {
|
||||||
|
|
||||||
|
class LogListener {
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void logSend(std::string entry) {}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -61,4 +61,8 @@ namespace coreutils {
|
|||||||
cursor = pstring.find_first_not_of(" \t", cursor);
|
cursor = pstring.find_first_not_of(" \t", cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PString::size() {
|
||||||
|
return pstring.size() - cursor;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user