diff --git a/src/Makefile b/src/Makefile index a752e9e..ec7cd9b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,8 +5,8 @@ AR := ar rc INCS := -I. -I./cppcommon -DEBUG_CXXFLAGS := -g -DDEBUG -RELEASE_CXXFLAGS := -Wall +DEBUG_CXXFLAGS := -g -Wall -DDEBUG +RELEASE_CXXFLAGS := -Wall -O3 ifeq (YES, ${DEBUG}) CXXFLAGS := ${DEBUG_CXXFLAGS} diff --git a/src/cppcommon/Makefile b/src/cppcommon/Makefile index 469af92..0efc89e 100644 --- a/src/cppcommon/Makefile +++ b/src/cppcommon/Makefile @@ -23,7 +23,7 @@ $(CMLIB): $(OBJS) $(DOPACK) -file_functs.test: file_functs.cpp file_functs.h +file_functs.ut: file_functs.cpp file_functs.h g++ -o $@ $< -DTEST_FILE_FUNCTS io_functs.test: io_functs.cpp io_functs.h g++ -o $@ $< -DTEST_IO_FUNCTS diff --git a/src/cppcommon/file_functs.cpp b/src/cppcommon/file_functs.cpp index d08e62f..8c6002f 100644 --- a/src/cppcommon/file_functs.cpp +++ b/src/cppcommon/file_functs.cpp @@ -6,18 +6,17 @@ namespace CPPCOMMON { - using namespace std; - bool checkFileExist(const char * filepath) + bool checkFileExist(const string& filePath) { fstream _file; - _file.open(filepath, ios::in); + _file.open(filePath.c_str(), ios::in); if(_file) return true; return false; } - bool createDir(const char * dir_path, bool p) + bool createDir(const string& dirPath, bool p) { - string dir_str(dir_path); + string dir_str(dirPath); string cmd = "mkdir"; if(p) { @@ -27,9 +26,9 @@ namespace CPPCOMMON int res = system(cmd.c_str()); return res; } - bool checkDirExist(const char * dir_path) + bool checkDirExist(const string& dirPath) { - return checkFileExist(dir_path); + return checkFileExist(dirPath); } } diff --git a/src/cppcommon/file_functs.h b/src/cppcommon/file_functs.h index f167b8c..946c58c 100644 --- a/src/cppcommon/file_functs.h +++ b/src/cppcommon/file_functs.h @@ -11,9 +11,10 @@ #include namespace CPPCOMMON { - bool checkFileExist(const char * filepath); - bool createDir(const char * dir_path, bool p = true); - bool checkDirExist(const char * dir_path); + using namespace std; + bool checkFileExist(const string& filePath); + bool createDir(const string& dirPath, bool p = true); + bool checkDirExist(const string& dirPath); } diff --git a/src/cppcommon/headers.h b/src/cppcommon/headers.h new file mode 100644 index 0000000..a242a9d --- /dev/null +++ b/src/cppcommon/headers.h @@ -0,0 +1,13 @@ +#ifndef CPPCOMMON_HEADERS_H +#define CPPCOMMON_HEADERS_H + +#include "logger.h" +#include "file_functs.h" +#include "vec_functs.h" +#include "io_functs.h" +#include "encoding.h" +#include "config.h" +#include "typedefs.h" +#include "str_functs.h" + +#endif