mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
update cppcommon
This commit is contained in:
parent
0fd8c4bd56
commit
ff5677ef78
@ -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}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,10 @@
|
||||
#include <stdlib.h>
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
13
src/cppcommon/headers.h
Normal file
13
src/cppcommon/headers.h
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user