📄 usage_tool.h
字号:
#ifndef __GNU_USAGE_TOOL_H__
#define __GNU_USAGE_TOOL_H__
#include <time.h>
//#include <map>
#include <vector>
#include <string>
#include <cstdio>
namespace gnu
{
bool get_dso_file(std::vector<std::string>& vect_dso_file,
const std::string& str_dir,const char* p_file_prefix = NULL ) ;
/**
* get files in the directory
* you can set prefix and suffix to parse file
*
* vect_file -> return files in the dir, not include dir, only include filename
* str_dir -> directory
* p_file_prefix -> file prefix , you can use * like : 600*28*00, 002*,000*
* p_file_suffix -> file suffix , eg. .dat
*/
bool get_files_in_dir(std::vector<std::string>& vect_file,
const std::string& str_dir,const char* p_file_prefix = NULL,
const char* p_file_suffix = NULL);
int GetModuleFileName_Linux( char* sModuleName, char* sFileName, int nSize);
/**
* which you start a program , you want to know the full path
* this function used to get full path of program.
*/
std::string get_program_path_filename();
bool split_path_file(const std::string& str_path_file,std::string& str_path,std::string& str_filename);
void transform_path_to_unix(char* p_chr_path);
void file_copy(FILE* ifp,FILE* ofp);
int getline(std::string& str_line,FILE* fp);
std::string str_toupper(const std::string& str);
std::string& str_toupper(std::string& str);
std::string str_tolower(const std::string& str);
std::string& str_tolower(std::string& str);
std::string str_trim(const std::string& str);
std::string& str_trim(std::string& str);
char get_input_char();
std::string get_input_str();
std::string get_passwd(const char* p_ch_prompt = "*");
bool str_split(const char *SOURCE, const char *DELIMITERS, std::vector<std::string>& vect_str);
char* trim(char* str);
/** * Description : strip characters that you don't need at start&end of string. * Parameter : inptr is pointer to original string. * retptr is pointer to result string that character are deleted * retptr is pointer to content that you want to strip. * Return Value : 0 for successfully; -1 for failure */int space_strip(const char *inp, char *retptr, const char *rej_set);
std::string space_append(const unsigned int i_str_len,const unsigned int i_max_len);
std::string time_now(const char* p_ch_format = NULL);
bool get_tm(struct tm& tm_time,const char* p_ch_time);
// p_ch_time2 format : 20050912
bool diff_day(double& diff_time,const char* p_ch_time2,const char* p_ch_time1);
} // namespace gnu
#endif // #ifndef __GNU_USAGE_TOOL_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -