From 591aacee97f4a6486631c38a6b418e20b2c4109c Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期四, 10 九月 2020 14:56:47 +0800 Subject: [PATCH] update --- common/include/usg_common.h | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/common/include/usg_common.h b/common/include/usg_common.h index d812eb3..358fbb3 100644 --- a/common/include/usg_common.h +++ b/common/include/usg_common.h @@ -27,6 +27,7 @@ #include <sys/stat.h> #include <sys/sem.h> #include <sys/shm.h> +#include <sys/file.h> #include <fcntl.h> #include <sys/mman.h> #include <errno.h> @@ -52,7 +53,9 @@ //c++ header #ifdef __cplusplus + #include <iostream> +#include <fstream> #include <string> #include <cstdlib> #include <atomic> @@ -76,6 +79,10 @@ void err_exit(int error, const char *fmt, ...); void err_msg(int error, const char *fmt, ...); +char *ltrim(char *str, const char *seps); +char *rtrim(char *str, const char *seps); +char *trim(char *str, const char *seps); + static inline int itoa(int num, char *str) { @@ -90,7 +97,34 @@ } + + #ifdef __cplusplus } #endif + + + +#ifdef __cplusplus + +// static inline std::string& ltrim(std::string& str, const std::string& chars = "\t\n\v\f\r ") +// { +// str.erase(0, str.find_first_not_of(chars)); +// return str; +// } + +// static inline std::string& rtrim(std::string& str, const std::string& chars = "\t\n\v\f\r ") +// { +// str.erase(str.find_last_not_of(chars) + 1); +// return str; +// } + +// static inline std::string& trim(std::string& str, const std::string& chars = "\t\n\v\f\r ") +// { +// return ltrim(rtrim(str, chars), chars); +// } + + +#endif + #endif -- Gitblit v1.8.0