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
|
INCS := -I. -I./cppcommon
|
||||||
|
|
||||||
DEBUG_CXXFLAGS := -g -DDEBUG
|
DEBUG_CXXFLAGS := -g -Wall -DDEBUG
|
||||||
RELEASE_CXXFLAGS := -Wall
|
RELEASE_CXXFLAGS := -Wall -O3
|
||||||
|
|
||||||
ifeq (YES, ${DEBUG})
|
ifeq (YES, ${DEBUG})
|
||||||
CXXFLAGS := ${DEBUG_CXXFLAGS}
|
CXXFLAGS := ${DEBUG_CXXFLAGS}
|
||||||
|
@ -23,7 +23,7 @@ $(CMLIB): $(OBJS)
|
|||||||
$(DOPACK)
|
$(DOPACK)
|
||||||
|
|
||||||
|
|
||||||
file_functs.test: file_functs.cpp file_functs.h
|
file_functs.ut: file_functs.cpp file_functs.h
|
||||||
g++ -o $@ $< -DTEST_FILE_FUNCTS
|
g++ -o $@ $< -DTEST_FILE_FUNCTS
|
||||||
io_functs.test: io_functs.cpp io_functs.h
|
io_functs.test: io_functs.cpp io_functs.h
|
||||||
g++ -o $@ $< -DTEST_IO_FUNCTS
|
g++ -o $@ $< -DTEST_IO_FUNCTS
|
||||||
|
@ -6,18 +6,17 @@
|
|||||||
|
|
||||||
namespace CPPCOMMON
|
namespace CPPCOMMON
|
||||||
{
|
{
|
||||||
using namespace std;
|
bool checkFileExist(const string& filePath)
|
||||||
bool checkFileExist(const char * filepath)
|
|
||||||
{
|
{
|
||||||
fstream _file;
|
fstream _file;
|
||||||
_file.open(filepath, ios::in);
|
_file.open(filePath.c_str(), ios::in);
|
||||||
if(_file)
|
if(_file)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
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";
|
string cmd = "mkdir";
|
||||||
if(p)
|
if(p)
|
||||||
{
|
{
|
||||||
@ -27,9 +26,9 @@ namespace CPPCOMMON
|
|||||||
int res = system(cmd.c_str());
|
int res = system(cmd.c_str());
|
||||||
return res;
|
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>
|
#include <stdlib.h>
|
||||||
namespace CPPCOMMON
|
namespace CPPCOMMON
|
||||||
{
|
{
|
||||||
bool checkFileExist(const char * filepath);
|
using namespace std;
|
||||||
bool createDir(const char * dir_path, bool p = true);
|
bool checkFileExist(const string& filePath);
|
||||||
bool checkDirExist(const char * dir_path);
|
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