fastdo  0.5.12
winux 命名空间参考

跨平台基础功能库 更多...

struct  Allocator
 构造分配器 更多...
 
class  ArrayAssigner
 Array赋值器 更多...
 
struct  Bin0
 二进制数,编译时计算, 0开头(基于8进制) 更多...
 
struct  Bin0< 0 >
 
class  BlockInFile
 分块输入文件 更多...
 
class  BlockOutFile
 分块输出文件 更多...
 
class  Buffer
 缓冲区,表示内存中一块2进制数据(利用malloc/realloc进行内存分配) 更多...
 
class  CommandLine
 命令行参数解析(OldVersion) 更多...
 
class  CommandLineVars
 命令行变量解析器 更多...
 
class  Condition
 条件变量 更多...
 
class  ConditionAttr
 条件变量属性 更多...
 
class  Configure
 配置文件类 更多...
 
class  ConsoleAttr
 
class  ConsoleAttrT
 
class  ConsoleOuputMutexScopeGuard
 
class  Conv
 字符串编码转换 更多...
 
class  ConvFrom
 指定编码转到本地编码 更多...
 
class  ConvTo
 本地编码转到指定编码 更多...
 
class  CsvReader
 CSV文件读取器 更多...
 
class  CsvWriter
 CSV文件写入器 更多...
 
class  DateTimeL
 本地日期时间。L意思'local',不包含时区信息 更多...
 
struct  Deallocator
 析构释放器 更多...
 
class  DirIterator
 目录文件枚举器 更多...
 
class  DllLoader
 DLL动态载入器 更多...
 
class  DllLoaderError
 Dll加载器错误 更多...
 
class  Error
 错误类 更多...
 
class  File
 文件操作类 更多...
 
class  FileSysError
 文件系统错误类 更多...
 
struct  FuncWrapper
 函数特征 更多...
 
class  GrowBuffer
 高效的可增长缓冲区,1.33倍冗余量 更多...
 
struct  IFile
 文件接口 更多...
 
class  ILockObj
 同步锁对象接口 更多...
 
struct  IndexSequence
 Tuple参数序列 更多...
 
struct  MakeIndexSequence
 
struct  MakeIndexSequence< 0, IndexSequence< _Index... > >
 
struct  MakeIndexSequence< _Num, IndexSequence< _Index... > >
 
class  MapAssigner
 MAP赋值器 更多...
 
class  MD5
 
class  MembersWrapper
 成员包装 更多...
 
class  Mixed
 混合体,能表示多种类型的值 更多...
 
class  MixedError
 混合体错误 更多...
 
class  MultiMatch
 KMP多项匹配/替换 更多...
 
class  Mutex
 互斥量 更多...
 
class  MutexAttr
 互斥量属性 更多...
 
class  MutexLockObj
 互斥锁 更多...
 
class  OutStringStreamWrapper
 用来使得String能够用operator<<来赋值 更多...
 
class  RefParam
 
class  ScopeGuard
 作用域范围保护 更多...
 
class  SetLocale
 设置locale信息 更多...
 
class  SharedCustomDeleterContext
 Shared自定义删除器场景 更多...
 
class  SharedDefaultDeleterContext
 Shared默认删除器场景 更多...
 
class  SharedDeleterContext
 Shared删除器场景基类 更多...
 
class  SharedHandle
 引用计数共享句柄,管理各种资源的自动释放 更多...
 
class  SharedPointer
 
class  SimpleCustomDeleterContext
 Simple自定义删除器场景 更多...
 
class  SimpleDefaultDeleterContext
 Simple默认删除器场景 更多...
 
class  SimpleDeleterContext
 Simple删除器场景基类 更多...
 
class  SimpleHandle
 简单句柄类,管理各种资源的自动释放,赋值相当于传递管理权。 更多...
 
class  SimplePointer
 简单指针 更多...
 
class  SZInput
 填充based-zero字符串缓冲区包装类 更多...
 
class  Task
 代表投递到线程池的一个任务,用于等待执行完毕获取返回值或者接着投递下一个任务 更多...
 
struct  TaskCtx
 任务数据场景 更多...
 
struct  TaskCtxT
 
struct  TaskCtxT< void >
 
class  Thread
 线程 更多...
 
class  ThreadAttr
 线程属性 更多...
 
class  ThreadGroup
 线程组 更多...
 
class  ThreadId
 线程ID 更多...
 
class  ThreadPool
 线程池,创建一组线程等待着从任务队列中获取任务执行 更多...
 
class  ThreadSysError
 线程相关错误 更多...
 
class  TlsKey
 TLS Key. 更多...
 
class  TlsVar
 TLS Var. 更多...
 
class  Unzip
 ZIP解压缩 更多...
 
class  WeakHandle
 弱句柄 更多...
 
class  WeakPointer
 弱指针 更多...
 
class  Zip
 ZIP压缩 更多...
 

类型定义

typedef winux::ulong ZRESULT
 
typedef int HPipe
 
typedef pid_t HProcess
 
typedef int int32
 
typedef unsigned int uint
 
typedef unsigned int uint32
 
typedef unsigned long ulong
 
typedef short int16
 
typedef unsigned short ushort
 
typedef unsigned short uint16
 
typedef char int8
 
typedef unsigned char uint8
 
typedef char16_t char16
 
typedef char32_t char32
 
typedef wchar_t wchar
 
typedef unsigned long long uint64
 
typedef unsigned long long ulonglong
 
typedef long long int64
 
typedef long long longlong
 
typedef char tchar
 
typedef unsigned char byte
 
typedef std::basic_string< tcharString
 
typedef std::basic_string< char > AnsiString
 
typedef AnsiString LocalString
 
typedef std::basic_string< wcharUnicodeString
 
typedef std::basic_string< char16UnicodeString16
 
typedef std::basic_string< char32UnicodeString32
 
typedef std::vector< StringStringArray
 
typedef std::map< String, StringStringStringMap
 
typedef std::pair< String, StringStringStringPair
 
typedef std::vector< MixedMixedArray
 
typedef std::map< String, MixedStringMixedMap
 
typedef std::pair< String, MixedStringMixedPair
 

枚举

enum  ConsoleColorAttrFlags : winux::ushort {
  fgBlack = 0, fgNavy = 1, fgAtrovirens = 2, fgTeal = 3,
  fgMaroon = 4, fgPurple = 5, fgOlive = 6, fgSilver = 7,
  fgGray = 8, fgIntensity = fgGray, fgBlue = 9, fgGreen = 10,
  fgAqua = 11, fgRed = 12, fgFuchsia = 13, fgYellow = 14,
  fgWhite = 15, bgNavy = 0x0100, bgAtrovirens = 0x0200, bgTeal = 0x0300,
  bgMaroon = 0x0400, bgPurple = 0x0500, bgOlive = 0x0600, bgSilver = 0x0700,
  bgBlack = 0x0800, bgWhite = 0x0000, bgGray = bgSilver, bgBlue = bgNavy,
  bgGreen = bgAtrovirens, bgAqua = bgTeal, bgRed = bgMaroon, bgFuchsia = bgPurple,
  bgYellow = bgOlive
}
 颜色属性标记 更多...
 
enum  EncryptErrorCode { ERR_SUCCEED, ERR_DATASIZE, ERR_BUFFSIZE }
 内容加密错误代码 更多...
 

函数

template<typename _VarType >
std::ostream & operator<< (std::ostream &o, ConsoleAttrT< _VarType > const &tr)
 
template<typename _VarType >
std::istream & operator>> (std::istream &in, ConsoleAttrT< _VarType > const &tr)
 
template<typename _VarType >
ConsoleAttrT< _VarType > ConsoleColor (winux::ushort attr, _VarType const &v, bool isSetBgColor=false)
 
static void OutputV ()
 
template<typename _Ty , typename... _ArgType>
static void OutputV (_Ty &&a, _ArgType &&...arg)
 
template<typename... _ArgType>
static void ColorOutput (winux::ConsoleAttr const &ca, _ArgType &&...arg)
 
String UrlEncode (String const &str)
 URL编码 更多...
 
String UrlDecode (String const &str)
 URL解码,与UrlEncode()配套 更多...
 
String UriComponentEncode (String const &str)
 URI组成部分编码,遵循RFC1738. 更多...
 
String UriComponentDecode (String const &str)
 URI组成部分解码,与UriComponentEncode()配套 更多...
 
String HtmlEncode (String const &str)
 HTML编码 作用字符:'&', '<', '>', ' '. 更多...
 
String HtmlDecode (String const &str)
 HTML解码,与HtmlEncode()配套 更多...
 
String Base64Encode (void const *buf, int size)
 Base64编码 更多...
 
String Base64Encode (AnsiString const &data)
 Base64编码 更多...
 
String Base64Encode (Buffer const &buf)
 Base64编码 更多...
 
AnsiString Base64Decode (String const &base64Str)
 Base64解码,与Base64Encode()配套 更多...
 
String Md5Hex (void const *buf, size_t size)
 将数据进行md5编码,返回16进制数字符串 更多...
 
String Md5Hex (Buffer const &buf)
 将数据进行md5编码,返回16进制数字符串 更多...
 
String Sha1Hex (void const *buf, size_t size)
 将数据进行sha1编码,返回16进制数字符串 更多...
 
String Sha1Hex (Buffer const &buf)
 将数据进行sha1编码,返回16进制数字符串 更多...
 
Buffer Sha1 (void const *buf, size_t size)
 将数据进行sha1编码,返回二进制数据 更多...
 
Buffer Sha1 (Buffer const &buf)
 将数据进行sha1编码,返回二进制数据 更多...
 
int RawEncrypt (unsigned char const *data, int data_size, unsigned char *buf, int buf_size, int *out_size)
 未进行C++包装的内容加密 更多...
 
int RawDecrypt (unsigned char const *encrypt_data, int data_size, unsigned char *buf, int buf_size, int *out_size)
 未进行C++包装的内容解密,与RawEncrypt()配套 更多...
 
AnsiString EncryptContent (AnsiString const &content)
 内容加密 更多...
 
AnsiString DecryptContent (AnsiString const &encryptContent)
 内容解密,与EncryptContent()配套 更多...
 
String GetExecutablePath (void)
 获取可执行文件的全路径 更多...
 
String FilePath (String const &fullPath, String *fileName=NULL)
 获取路径名(末尾不含目录分隔符) 更多...
 
String FileTitle (String const &fileName, String *extName=NULL)
 获取文件标题 更多...
 
bool IsAbsPath (String const &path)
 判断是否为绝对路径 更多...
 
String NormalizePath (String const &path)
 使路径规则化(末尾不带路径分割符) 更多...
 
String RealPath (String const &path)
 计算真实路径 更多...
 
String GetCurrentDir (void)
 返回当前工作目录(末尾不含目录分隔符) 更多...
 
bool SetCurrentDir (String const &path)
 设置当前工作目录 更多...
 
bool IsDir (String const &path)
 判断是否是一个目录 更多...
 
bool DetectPath (String const &path, bool *isDir=NULL)
 探测一个路径是存在还是不存在,是目录还是文件 更多...
 
ulong FileSize (String const &filename)
 获取文件大小 更多...
 
uint64 FileSize64 (String const &filename)
 获取文件大小(大于4GB的文件) 更多...
 
bool FileTime (String const &filename, ulong *ctime, ulong *mtime, ulong *atime)
 获取文件时间 更多...
 
ulong FileCTime (String const &filename)
 获取文件创建时间 更多...
 
ulong FileMTime (String const &filename)
 获取文件修改时间 更多...
 
ulong FileATime (String const &filename)
 获取文件访问时间 更多...
 
bool FileTouch (String const &filename, ulong time=(ulong)-1, ulong atime=(ulong)-1)
 更新文件修改时间,访问时间 更多...
 
String PathWithSep (String const &path)
 路径分隔符整理 更多...
 
String PathNoSep (String const &path)
 
StringPathWithSep (String *path)
 
StringPathNoSep (String *path)
 
String CombinePath (String const &dirPath, String const &fileName)
 把一个目录路径和一个文件名组合成一个新路径 更多...
 
void FolderData (String const &path, StringArray *fileArr, StringArray *subFolderArr, int sortType=0)
 获取文件夹中的文件和子文件夹,sortType:0结果不排序 1正序 2反序 更多...
 
ulong EnumFiles (String const &path, Mixed const &ext, StringArray *arrFiles, bool isRecursive=false)
 在指定路径下枚举指定扩展名的文件 更多...
 
ulong CommonDelete (String const &path)
 通用删除,删除文件夹和文件,返回删除的文件夹和文件数 更多...
 
bool MakeDirExists (String const &path, int mode=0755)
 确保目录路径的存在性,如果不存在则创建。 更多...
 
AnsiString FileGetContents (String const &filename, bool textMode=true)
 载入文件内容为一个AnsiString,textMode表示是否为文本模式 更多...
 
Buffer FileGetContentsEx (String const &filename, bool textMode)
 载入文件内容为一个Buffer,textMode表示是否为文本模式 更多...
 
bool FilePutContents (String const &filename, AnsiString const &content, bool textMode=true)
 把AnsiString内容写入文件,textMode表示是否为文本模式 更多...
 
bool FilePutContentsEx (String const &filename, Buffer const &content, bool textMode)
 把Buffer内容写入文件,textMode表示是否为文本模式 更多...
 
void WriteLog (String const &s)
 日志 更多...
 
void WriteBinLog (void const *data, int size)
 二进制日志 更多...
 
bool JsonParse (String const &json, Mixed *val)
 Json解析成Mixed. 更多...
 
AnsiString MixedToJsonA (Mixed const &v, bool autoKeyQuotes)
 Mixed输出成Json. 更多...
 
UnicodeString MixedToJsonW (Mixed const &v, bool autoKeyQuotes)
 
long LongAtomicIncrement (long volatile *p)
 原子化使一个Long型变量+1,返回值是+1后的*p值 更多...
 
long LongAtomicDecrement (long volatile *p)
 原子化使一个Long型变量-1,返回值是-1后的*p值 更多...
 
long LongAtomicCompareExchange (long volatile *p, long exchange, long comparand)
 原子化操作,*p若和comparand相等,就把*p赋成exchange,返回值是初始的*p值 更多...
 
template<typename _Ty >
SimplePointer< _Ty > MakeSimple (_Ty *newObj)
 
template<typename _Ty , typename _Dt >
SimplePointer< _Ty > MakeSimple (_Ty *newObj, _Dt dt)
 
template<typename _Ty >
SharedPointer< _Ty > MakeShared (_Ty *newObj)
 
template<typename _Ty , typename _Dt >
SharedPointer< _Ty > MakeShared (_Ty *newObj, _Dt dt)
 
int StrSplit (String const &str, String const &delimList, StringArray *arr, bool alwaysRetOneElem=false)
 字符串分割 更多...
 
int StrSplit2 (String const &str, String const &delim, StringArray *arr, bool alwaysRetOneElem=false)
 字符串分割2 更多...
 
String StrJoin (String const &delim, StringArray const &arr)
 字符串组合连接 更多...
 
String StrInsert (String const &str, int start, int end, String const &insert)
 在指定位置插入字符串 更多...
 
StringStrMakeReplace (String *str, String const &findText, String const &replaceText, String::size_type offset=0)
 使字符串全文替换 更多...
 
String StrTrim (String const &str)
 祛除字符串首尾出现的空白字符 更多...
 
StringStrMakeUpper (String *str)
 使字符串大写 更多...
 
String StrUpper (String const &str)
 
StringStrMakeLower (String *str)
 使字符串小写 更多...
 
String StrLower (String const &str)
 
AnsiString AddSlashesA (AnsiString const &str, AnsiString const &charlist)
 反斜杠操作 更多...
 
AnsiString AddCSlashesA (AnsiString const &str)
 
UnicodeString AddSlashesW (UnicodeString const &str, UnicodeString const &charlist)
 
UnicodeString AddCSlashesW (UnicodeString const &str)
 
AnsiString StripSlashes (AnsiString const &str, AnsiString const &charlist)
 反斜杠操作 更多...
 
AnsiString StripCSlashes (AnsiString const &str)
 
String AddQuotes (String const &str, tchar quote= '\"' )
 double引号 更多...
 
bool StrGetLine (String *line, String const &str, int *i, String *nl=NULL)
 获取字符串中的一行,支持unix,windows,mac平台的行分隔方式
line 不包含换行符,i 指示起始位置,并获得处理到哪个位置。 更多...
 
template<typename _ChTy , typename _IndexType >
static std::vector< _IndexType > _Templ_KmpCalcNext (_ChTy const *substr, int sublen)
 KMP匹配算法 求子串next值 更多...
 
template<typename _ChTy , typename _IndexType >
static int _Templ_KmpMatchEx (_ChTy const *str, int len, _ChTy const *substr, int sublen, int pos, std::vector< _IndexType > const &next)
 KMP匹配算法 传入已经求好的next进行匹配 更多...
 
template<typename _ChTy , typename _IndexType >
static int _Templ_KmpMatch (_ChTy const *str, int len, _ChTy const *substr, int sublen, int pos)
 KMP匹配算法 匹配 更多...
 
std::vector< int > KmpCalcNext (char const *substr, int sublen)
 KMP字符串匹配算法 求子串next值 更多...
 
int KmpMatchEx (char const *str, int len, char const *substr, int sublen, int pos, std::vector< int > const &next)
 KMP字符串匹配算法 传入已经求好的next进行匹配 更多...
 
int KmpMatch (char const *str, int len, char const *substr, int sublen, int pos)
 KMP字符串匹配算法 匹配 更多...
 
uint LocalCharsCount (LocalString const &local)
 返回一个本地字符串里有多少个实际的字符(by local CodePage),用于mbstowcs 更多...
 
uint UnicodeMinLength (UnicodeString const &unicode)
 返回一个unicode字符串转换为多字节字符串最少需要多少字节(by local CodePage),用于wcstombs 更多...
 
LocalString UnicodeToLocal (UnicodeString const &unicode)
 Unicode转换到本地Ansi. 更多...
 
UnicodeString LocalToUnicode (LocalString const &local)
 本地Ansi转到Unicode 更多...
 
String LocalToString (LocalString const &local)
 兼容字符串与Unicode,Local字符串相互转换 更多...
 
String UnicodeToString (UnicodeString const &unicode)
 
LocalString StringToLocal (String const &str)
 
UnicodeString StringToUnicode (String const &str)
 
WINUX_DLL String FormatExV (uint cch, tchar const *fmt, va_list args)
 格式化字符串 更多...
 
WINUX_DLL String FormatEx (uint cch, tchar const *fmt,...)
 
WINUX_DLL String Format (tchar const *fmt,...)
 
template<typename _CHAR , uint _N>
SZInput SZ (_CHAR(&sz)[_N])
 
AnsiString LocalFromUtf8 (AnsiString const &str)
 从utf-8转到本地编码 更多...
 
AnsiString LocalToUtf8 (AnsiString const &str)
 从本地编码转到utf-8 更多...
 
int CommandLineToArgv (winux::String const &cmd, winux::StringArray *argv)
 把命令行解析成Argv数组 更多...
 
HProcess ExecCommandEx (winux::String const &cmd, HPipe *hStdinWritePipe, HPipe *hStdoutReadPipe, HPipe *hStderrReadPipe=NULL, bool closeStdinIfStdinWritePipeIsNull=true)
 新建子进程执行指定命令,并用管道重定向了标准设备 更多...
 
int ExecCommand (winux::String const &cmd, winux::String const &stdinStr, winux::String *stdoutStr, winux::String *stderrStr=NULL, bool closeStdinIfStdinStrEmpty=true)
 新建子进程执行指定命令,等待子进程结束,并把字符串重定向了标准设备 更多...
 
winux::String GetExec (winux::String const &cmd, winux::String const &stdinStr="", winux::String *stderrStr=NULL, bool closeStdinIfStdinStrEmpty=true)
 
std::ostream & operator<< (std::ostream &o, DateTimeL const &dt)
 
uint64 GetUtcTimeMs ()
 获取UTC时间毫秒数,UTC秒数可以直接除以1000,或者调用CRT的time(NULL) 更多...
 
uint64 GetUtcTimeUs ()
 获取UTC时间微秒数,UTC秒数可以直接除以1000000,或者调用CRT的time(NULL) 更多...
 
ulong GetUtcTime ()
 获取UTC时间秒数,或者调用CRT的time(NULL) 更多...
 
template<typename _MAP , typename _KEY >
bool isset (_MAP const &m, _KEY const &k)
 检测map中是否有该键的值 更多...
 
template<typename _Ty >
std::vector< _Ty > ToArray (_Ty *arr, uint count)
 将C数组转换成vector 更多...
 
template<typename _Ty , uint _N>
std::vector< _Ty > ToArray (_Ty(&arr)[_N])
 
template<typename _Fx , typename... _ArgType>
int VoidReturnInt (_Fx fn, _ArgType &&...arg)
 调用一个返回void的函数或函数对象,返回一个数字 更多...
 
template<typename _Ty >
RefParam< _Ty > Ref (_Ty &r)
 向模板参数传递引用型参数 更多...
 
template<typename _KTy , typename _VTy >
MapAssigner< _KTy, _VTy > Assign (std::map< _KTy, _VTy > *m)
 给容器赋值 更多...
 
template<typename _Ty >
ArrayAssigner< _Ty > Assign (std::vector< _Ty > *a)
 给容器赋值 更多...
 
bool ValueIsInArray (StringArray const &arr, String const &val, bool caseInsensitive=false)
 判断一个字符串值是否在一个字符串数组里,默认大小写敏感 更多...
 
int Random (int n1, int n2)
 随机数,随机产生n1~n2的数字. 包括n1,n2本身 更多...
 
std::ostream & operator<< (std::ostream &o, Mixed const &m)
 扩展iostream的<< 更多...
 
std::wostream & operator<< (std::wostream &o, Mixed const &m)
 

变量

WINUX_DLL char const * __TerminalFgColorAttrs []
 
WINUX_DLL char const * __TerminalBgColorAttrs []
 
String const dirSep = "\\"
 目录分割符 更多...
 
String const lineSep = "\r\n"
 行分割符 更多...
 
String const pathEnvSep = ";"
 PATH环境变量路径分割符 更多...
 
String const DirSep = "\\"
 目录分割符 更多...
 
String const LineSep = "\r\n"
 行分割符 更多...
 
String const PathEnvSep = ";"
 PATH环境变量路径分割符 更多...
 

详细描述

跨平台基础功能库

文件系统相关封装

类型定义说明

typedef std::basic_string<char> winux::AnsiString

在文件 utilities.hpp165 行定义.

typedef unsigned char winux::byte

在文件 utilities.hpp159 行定义.

typedef char16_t winux::char16

在文件 utilities.hpp135 行定义.

typedef char32_t winux::char32

在文件 utilities.hpp136 行定义.

typedef int winux::HPipe

在文件 system.hpp10 行定义.

typedef pid_t winux::HProcess

在文件 system.hpp11 行定义.

typedef short winux::int16

在文件 utilities.hpp130 行定义.

typedef int winux::int32

在文件 utilities.hpp127 行定义.

typedef long long winux::int64

在文件 utilities.hpp148 行定义.

typedef char winux::int8

在文件 utilities.hpp132 行定义.

在文件 utilities.hpp166 行定义.

typedef long long winux::longlong

在文件 utilities.hpp149 行定义.

typedef std::vector<Mixed> winux::MixedArray

在文件 utilities.hpp175 行定义.

typedef std::basic_string<tchar> winux::String

在文件 utilities.hpp162 行定义.

typedef std::vector<String> winux::StringArray

在文件 utilities.hpp171 行定义.

typedef std::map<String, Mixed> winux::StringMixedMap

在文件 utilities.hpp176 行定义.

typedef std::pair<String, Mixed> winux::StringMixedPair

在文件 utilities.hpp177 行定义.

typedef std::map<String, String> winux::StringStringMap

在文件 utilities.hpp172 行定义.

typedef std::pair<String, String> winux::StringStringPair

在文件 utilities.hpp173 行定义.

typedef char winux::tchar

在文件 utilities.hpp155 行定义.

typedef unsigned int winux::uint

在文件 utilities.hpp128 行定义.

typedef unsigned short winux::uint16

在文件 utilities.hpp131 行定义.

typedef unsigned int winux::uint32

在文件 utilities.hpp128 行定义.

typedef unsigned long long winux::uint64

在文件 utilities.hpp146 行定义.

typedef unsigned char winux::uint8

在文件 utilities.hpp133 行定义.

typedef unsigned long winux::ulong

在文件 utilities.hpp129 行定义.

typedef unsigned long long winux::ulonglong

在文件 utilities.hpp147 行定义.

typedef std::basic_string<wchar> winux::UnicodeString

在文件 utilities.hpp167 行定义.

typedef std::basic_string<char16> winux::UnicodeString16

在文件 utilities.hpp168 行定义.

typedef std::basic_string<char32> winux::UnicodeString32

在文件 utilities.hpp169 行定义.

typedef unsigned short winux::ushort

在文件 utilities.hpp131 行定义.

typedef wchar_t winux::wchar

在文件 utilities.hpp145 行定义.

在文件 archives.hpp109 行定义.

枚举类型说明

颜色属性标记

枚举值
fgBlack 
fgNavy 
fgAtrovirens 
fgTeal 
fgMaroon 
fgPurple 
fgOlive 
fgSilver 
fgGray 
fgIntensity 
fgBlue 
fgGreen 
fgAqua 
fgRed 
fgFuchsia 
fgYellow 
fgWhite 
bgNavy 
bgAtrovirens 
bgTeal 
bgMaroon 
bgPurple 
bgOlive 
bgSilver 
bgBlack 
bgWhite 
bgGray 
bgBlue 
bgGreen 
bgAqua 
bgRed 
bgFuchsia 
bgYellow 

在文件 console.hpp10 行定义.

内容加密错误代码

枚举值
ERR_SUCCEED 
ERR_DATASIZE 
ERR_BUFFSIZE 

在文件 encoding.hpp59 行定义.

函数说明

template<typename _ChTy , typename _IndexType >
static std::vector<_IndexType> winux::_Templ_KmpCalcNext ( _ChTy const *  substr,
int  sublen 
)
inlinestatic

KMP匹配算法 求子串next值

在文件 strings.hpp83 行定义.

template<typename _ChTy , typename _IndexType >
static int winux::_Templ_KmpMatch ( _ChTy const *  str,
int  len,
_ChTy const *  substr,
int  sublen,
int  pos 
)
inlinestatic

KMP匹配算法 匹配

在文件 strings.hpp131 行定义.

函数调用图:

template<typename _ChTy , typename _IndexType >
static int winux::_Templ_KmpMatchEx ( _ChTy const *  str,
int  len,
_ChTy const *  substr,
int  sublen,
int  pos,
std::vector< _IndexType > const &  next 
)
inlinestatic

KMP匹配算法 传入已经求好的next进行匹配

在文件 strings.hpp109 行定义.

AnsiString winux::AddCSlashesA ( AnsiString const &  str)
inline

在文件 strings.hpp51 行定义.

函数调用图:

UnicodeString winux::AddCSlashesW ( UnicodeString const &  str)
inline

在文件 strings.hpp54 行定义.

函数调用图:

String winux::AddQuotes ( String const &  str,
tchar  quote = '\"' 
)

double引号

AnsiString winux::AddSlashesA ( AnsiString const &  str,
AnsiString const &  charlist 
)

反斜杠操作

UnicodeString winux::AddSlashesW ( UnicodeString const &  str,
UnicodeString const &  charlist 
)
template<typename _KTy , typename _VTy >
MapAssigner< _KTy, _VTy > winux::Assign ( std::map< _KTy, _VTy > *  m)

给容器赋值

在文件 utilities.hpp316 行定义.

template<typename _Ty >
ArrayAssigner<_Ty> winux::Assign ( std::vector< _Ty > *  a)

给容器赋值

在文件 utilities.hpp322 行定义.

AnsiString winux::Base64Decode ( String const &  base64Str)

Base64解码,与Base64Encode()配套

String winux::Base64Encode ( void const *  buf,
int  size 
)

Base64编码

String winux::Base64Encode ( AnsiString const &  data)

Base64编码

String winux::Base64Encode ( Buffer const &  buf)
inline

Base64编码

在文件 encoding.hpp39 行定义.

函数调用图:

template<typename... _ArgType>
static void winux::ColorOutput ( winux::ConsoleAttr const &  ca,
_ArgType &&...  arg 
)
inlinestatic

在文件 console.hpp178 行定义.

函数调用图:

String winux::CombinePath ( String const &  dirPath,
String const &  fileName 
)

把一个目录路径和一个文件名组合成一个新路径

int winux::CommandLineToArgv ( winux::String const &  cmd,
winux::StringArray argv 
)

把命令行解析成Argv数组

参数
cmdString const &
argvStringArray *
返回
int 解析到的参数个数
ulong winux::CommonDelete ( String const &  path)

通用删除,删除文件夹和文件,返回删除的文件夹和文件数

template<typename _VarType >
ConsoleAttrT<_VarType> winux::ConsoleColor ( winux::ushort  attr,
_VarType const &  v,
bool  isSetBgColor = false 
)
inline

在文件 console.hpp152 行定义.

AnsiString winux::DecryptContent ( AnsiString const &  encryptContent)

内容解密,与EncryptContent()配套

bool winux::DetectPath ( String const &  path,
bool *  isDir = NULL 
)

探测一个路径是存在还是不存在,是目录还是文件

返回true/false表示是否存在, *isDir返回true/false表示是否为目录

AnsiString winux::EncryptContent ( AnsiString const &  content)

内容加密

ulong winux::EnumFiles ( String const &  path,
Mixed const &  ext,
StringArray arrFiles,
bool  isRecursive = false 
)

在指定路径下枚举指定扩展名的文件

ext可以是扩展名串,也可以是一个数组。 当isRecursive=false时,arrFiles返回的结果不用区别目录,因此不包含目录部分的路径。

int winux::ExecCommand ( winux::String const &  cmd,
winux::String const &  stdinStr,
winux::String stdoutStr,
winux::String stderrStr = NULL,
bool  closeStdinIfStdinStrEmpty = true 
)

新建子进程执行指定命令,等待子进程结束,并把字符串重定向了标准设备

参数
cmdwinux::String const &
stdinStrwinux::String const &
stdoutStrwinux::String *
stderrStrwinux::String *
closeStdinIfStdinStrEmptybool
返回
int
HProcess winux::ExecCommandEx ( winux::String const &  cmd,
HPipe hStdinWritePipe,
HPipe hStdoutReadPipe,
HPipe hStderrReadPipe = NULL,
bool  closeStdinIfStdinWritePipeIsNull = true 
)

新建子进程执行指定命令,并用管道重定向了标准设备

参数
cmdwinux::String const &
hStdinWritePipeHPipe *
hStdoutReadPipeHPipe *
hStderrReadPipeHPipe *
closeStdinIfStdinWritePipeIsNullbool 指示当不准备重定向标准输入时是否关闭它,这样子进程就不会等待输入而卡死
返回
HProcess 子进程的进程句柄
ulong winux::FileATime ( String const &  filename)

获取文件访问时间

ulong winux::FileCTime ( String const &  filename)

获取文件创建时间

AnsiString winux::FileGetContents ( String const &  filename,
bool  textMode = true 
)

载入文件内容为一个AnsiString,textMode表示是否为文本模式

Buffer winux::FileGetContentsEx ( String const &  filename,
bool  textMode 
)

载入文件内容为一个Buffer,textMode表示是否为文本模式

ulong winux::FileMTime ( String const &  filename)

获取文件修改时间

String winux::FilePath ( String const &  fullPath,
String fileName = NULL 
)

获取路径名(末尾不含目录分隔符)

参数
fullPathString const&
fileNameString*
返回
String
bool winux::FilePutContents ( String const &  filename,
AnsiString const &  content,
bool  textMode = true 
)

把AnsiString内容写入文件,textMode表示是否为文本模式

bool winux::FilePutContentsEx ( String const &  filename,
Buffer const &  content,
bool  textMode 
)

把Buffer内容写入文件,textMode表示是否为文本模式

ulong winux::FileSize ( String const &  filename)

获取文件大小

uint64 winux::FileSize64 ( String const &  filename)

获取文件大小(大于4GB的文件)

bool winux::FileTime ( String const &  filename,
ulong ctime,
ulong mtime,
ulong atime 
)

获取文件时间

String winux::FileTitle ( String const &  fileName,
String extName = NULL 
)

获取文件标题

参数
fileNameString const&
extNameString*
返回
String
bool winux::FileTouch ( String const &  filename,
ulong  time = (ulong)-1,
ulong  atime = (ulong)-1 
)

更新文件修改时间,访问时间

void winux::FolderData ( String const &  path,
StringArray fileArr,
StringArray subFolderArr,
int  sortType = 0 
)

获取文件夹中的文件和子文件夹,sortType:0结果不排序 1正序 2反序

WINUX_DLL String winux::Format ( tchar const *  fmt,
  ... 
)
WINUX_DLL String winux::FormatEx ( uint  cch,
tchar const *  fmt,
  ... 
)
WINUX_DLL String winux::FormatExV ( uint  cch,
tchar const *  fmt,
va_list  args 
)

格式化字符串

String winux::GetCurrentDir ( void  )

返回当前工作目录(末尾不含目录分隔符)

winux::String winux::GetExec ( winux::String const &  cmd,
winux::String const &  stdinStr = "",
winux::String stderrStr = NULL,
bool  closeStdinIfStdinStrEmpty = true 
)
String winux::GetExecutablePath ( void  )

获取可执行文件的全路径

ulong winux::GetUtcTime ( )

获取UTC时间秒数,或者调用CRT的time(NULL)

uint64 winux::GetUtcTimeMs ( )

获取UTC时间毫秒数,UTC秒数可以直接除以1000,或者调用CRT的time(NULL)

uint64 winux::GetUtcTimeUs ( )

获取UTC时间微秒数,UTC秒数可以直接除以1000000,或者调用CRT的time(NULL)

String winux::HtmlDecode ( String const &  str)

HTML解码,与HtmlEncode()配套

String winux::HtmlEncode ( String const &  str)

HTML编码 作用字符:'&', '<', '>', ' '.

bool winux::IsAbsPath ( String const &  path)

判断是否为绝对路径

bool winux::IsDir ( String const &  path)

判断是否是一个目录

template<typename _MAP , typename _KEY >
bool winux::isset ( _MAP const &  m,
_KEY const &  k 
)
inline

检测map中是否有该键的值

在文件 utilities.hpp185 行定义.

bool winux::JsonParse ( String const &  json,
Mixed val 
)

Json解析成Mixed.

std::vector<int> winux::KmpCalcNext ( char const *  substr,
int  sublen 
)

KMP字符串匹配算法 求子串next值

int winux::KmpMatch ( char const *  str,
int  len,
char const *  substr,
int  sublen,
int  pos 
)

KMP字符串匹配算法 匹配

int winux::KmpMatchEx ( char const *  str,
int  len,
char const *  substr,
int  sublen,
int  pos,
std::vector< int > const &  next 
)

KMP字符串匹配算法 传入已经求好的next进行匹配

uint winux::LocalCharsCount ( LocalString const &  local)

返回一个本地字符串里有多少个实际的字符(by local CodePage),用于mbstowcs

AnsiString winux::LocalFromUtf8 ( AnsiString const &  str)

从utf-8转到本地编码

String winux::LocalToString ( LocalString const &  local)

兼容字符串与Unicode,Local字符串相互转换

UnicodeString winux::LocalToUnicode ( LocalString const &  local)

本地Ansi转到Unicode

AnsiString winux::LocalToUtf8 ( AnsiString const &  str)

从本地编码转到utf-8

long winux::LongAtomicCompareExchange ( long volatile *  p,
long  exchange,
long  comparand 
)

原子化操作,*p若和comparand相等,就把*p赋成exchange,返回值是初始的*p值

long winux::LongAtomicDecrement ( long volatile *  p)

原子化使一个Long型变量-1,返回值是-1后的*p值

long winux::LongAtomicIncrement ( long volatile *  p)

原子化使一个Long型变量+1,返回值是+1后的*p值

bool winux::MakeDirExists ( String const &  path,
int  mode = 0755 
)

确保目录路径的存在性,如果不存在则创建。

linux下需设置目录权限(8进制数),默认权限0755
owner - group - other
R W X - R W X - R W X
1 1 1 - 1 0 1 - 1 0 1
7 5 5

template<typename _Ty >
SharedPointer<_Ty> winux::MakeShared ( _Ty *  newObj)
inline

在文件 smartptr.hpp920 行定义.

template<typename _Ty , typename _Dt >
SharedPointer<_Ty> winux::MakeShared ( _Ty *  newObj,
_Dt  dt 
)
inline

在文件 smartptr.hpp926 行定义.

template<typename _Ty >
SimplePointer<_Ty> winux::MakeSimple ( _Ty *  newObj)
inline

在文件 smartptr.hpp908 行定义.

template<typename _Ty , typename _Dt >
SimplePointer<_Ty> winux::MakeSimple ( _Ty *  newObj,
_Dt  dt 
)
inline

在文件 smartptr.hpp914 行定义.

String winux::Md5Hex ( void const *  buf,
size_t  size 
)

将数据进行md5编码,返回16进制数字符串

String winux::Md5Hex ( Buffer const &  buf)
inline

将数据进行md5编码,返回16进制数字符串

在文件 encoding.hpp46 行定义.

函数调用图:

AnsiString winux::MixedToJsonA ( Mixed const &  v,
bool  autoKeyQuotes 
)

Mixed输出成Json.

UnicodeString winux::MixedToJsonW ( Mixed const &  v,
bool  autoKeyQuotes 
)
String winux::NormalizePath ( String const &  path)

使路径规则化(末尾不带路径分割符)

std::ostream& winux::operator<< ( std::ostream &  o,
DateTimeL const &  dt 
)
template<typename _VarType >
std::ostream& winux::operator<< ( std::ostream &  o,
ConsoleAttrT< _VarType > const &  tr 
)
inline

在文件 console.hpp134 行定义.

std::ostream& winux::operator<< ( std::ostream &  o,
Mixed const &  m 
)

扩展iostream的<<

std::wostream& winux::operator<< ( std::wostream &  o,
Mixed const &  m 
)
template<typename _VarType >
std::istream& winux::operator>> ( std::istream &  in,
ConsoleAttrT< _VarType > const &  tr 
)
inline

在文件 console.hpp143 行定义.

函数调用图:

static void winux::OutputV ( )
inlinestatic

在文件 console.hpp166 行定义.

template<typename _Ty , typename... _ArgType>
static void winux::OutputV ( _Ty &&  a,
_ArgType &&...  arg 
)
inlinestatic

在文件 console.hpp171 行定义.

函数调用图:

String winux::PathNoSep ( String const &  path)
String& winux::PathNoSep ( String path)
String winux::PathWithSep ( String const &  path)

路径分隔符整理

String& winux::PathWithSep ( String path)
int winux::Random ( int  n1,
int  n2 
)

随机数,随机产生n1~n2的数字. 包括n1,n2本身

int winux::RawDecrypt ( unsigned char const *  encrypt_data,
int  data_size,
unsigned char *  buf,
int  buf_size,
int *  out_size 
)

未进行C++包装的内容解密,与RawEncrypt()配套

int winux::RawEncrypt ( unsigned char const *  data,
int  data_size,
unsigned char *  buf,
int  buf_size,
int *  out_size 
)

未进行C++包装的内容加密

String winux::RealPath ( String const &  path)

计算真实路径

template<typename _Ty >
RefParam<_Ty> winux::Ref ( _Ty &  r)

向模板参数传递引用型参数

在文件 utilities.hpp241 行定义.

bool winux::SetCurrentDir ( String const &  path)

设置当前工作目录

Buffer winux::Sha1 ( void const *  buf,
size_t  size 
)

将数据进行sha1编码,返回二进制数据

Buffer winux::Sha1 ( Buffer const &  buf)
inline

将数据进行sha1编码,返回二进制数据

在文件 encoding.hpp55 行定义.

函数调用图:

String winux::Sha1Hex ( void const *  buf,
size_t  size 
)

将数据进行sha1编码,返回16进制数字符串

String winux::Sha1Hex ( Buffer const &  buf)
inline

将数据进行sha1编码,返回16进制数字符串

在文件 encoding.hpp51 行定义.

函数调用图:

bool winux::StrGetLine ( String line,
String const &  str,
int *  i,
String nl = NULL 
)

获取字符串中的一行,支持unix,windows,mac平台的行分隔方式
line 不包含换行符,i 指示起始位置,并获得处理到哪个位置。

如何统一处理3平台的文本文件: 最好的办法是在该平台用文本模式打开该平台产生的文本文件,然后操作。 然而,现实不像想象的那么美好,多数情况下是处理不同平台下的文本文件,譬如在unix系平台下处理windows或mac的文本文件。 由于行分隔不同,导致处理有一定困难。 此函数正为此而存在。首先,你需要用二进制模式打开文件,然后读取全部数据,调用此函数取行即可。

LocalString winux::StringToLocal ( String const &  str)
UnicodeString winux::StringToUnicode ( String const &  str)
String winux::StrInsert ( String const &  str,
int  start,
int  end,
String const &  insert 
)

在指定位置插入字符串

AnsiString winux::StripCSlashes ( AnsiString const &  str)
inline

在文件 strings.hpp66 行定义.

函数调用图:

AnsiString winux::StripSlashes ( AnsiString const &  str,
AnsiString const &  charlist 
)

反斜杠操作

String winux::StrJoin ( String const &  delim,
StringArray const &  arr 
)

字符串组合连接

String winux::StrLower ( String const &  str)
String& winux::StrMakeLower ( String str)

使字符串小写

String& winux::StrMakeReplace ( String str,
String const &  findText,
String const &  replaceText,
String::size_type  offset = 0 
)

使字符串全文替换

String& winux::StrMakeUpper ( String str)

使字符串大写

int winux::StrSplit ( String const &  str,
String const &  delimList,
StringArray arr,
bool  alwaysRetOneElem = false 
)

字符串分割

delimList指示出分割符列表,分割符只能是一个字符,函数会把str内分割符间的内容(即使是空串)添加到arr中,返回个数。
当alwaysRetOneElem==true时,即使str是空串时也会向arr返回一个数组元素,元素值是空串。

参数
strString const&
delimListString const&
arrstd::vector<String>*
返回
int
int winux::StrSplit2 ( String const &  str,
String const &  delim,
StringArray arr,
bool  alwaysRetOneElem = false 
)

字符串分割2

delim指示出分割字符串,函数会把str内分割字符串间的内容(即使是空串)添加到arr中,返回个数。
当alwaysRetOneElem==true时,即使str是空串时也会向arr返回一个数组元素,元素值是空串。

参数
strString const&
delimListString const&
arrstd::vector<String>*
返回
int
String winux::StrTrim ( String const &  str)

祛除字符串首尾出现的空白字符

参数
strString const&
返回
String
String winux::StrUpper ( String const &  str)
template<typename _CHAR , uint _N>
SZInput winux::SZ ( _CHAR(&)  sz[_N])

在文件 strings.hpp295 行定义.

template<typename _Ty >
std::vector<_Ty> winux::ToArray ( _Ty *  arr,
uint  count 
)

将C数组转换成vector

在文件 utilities.hpp192 行定义.

template<typename _Ty , uint _N>
std::vector<_Ty> winux::ToArray ( _Ty(&)  arr[_N])

在文件 utilities.hpp198 行定义.

uint winux::UnicodeMinLength ( UnicodeString const &  unicode)

返回一个unicode字符串转换为多字节字符串最少需要多少字节(by local CodePage),用于wcstombs

LocalString winux::UnicodeToLocal ( UnicodeString const &  unicode)

Unicode转换到本地Ansi.

String winux::UnicodeToString ( UnicodeString const &  unicode)
String winux::UriComponentDecode ( String const &  str)

URI组成部分解码,与UriComponentEncode()配套

String winux::UriComponentEncode ( String const &  str)

URI组成部分编码,遵循RFC1738.

除了-_.~之外的所有非字母数字字符都将被替换成百分号()后跟两位十六进制数。 这是在RFC1738中描述的编码。

String winux::UrlDecode ( String const &  str)

URL解码,与UrlEncode()配套

String winux::UrlEncode ( String const &  str)

URL编码

除了-_.之外的所有非字母数字字符都将被替换成百分号()后跟两位十六进制数,空格则编码为加号(+)。 此编码与WWW表单POST数据的编码方式是一样的,同时与application/x-www-form-urlencoded的媒体类型编码方式一样。 由于历史原因,此编码在将空格编码为加号(+)方面与RFC1738编码不同。 此函数便于将字符串编码并将其用于URL的请求部分,同时它还便于将变量传递给下一页。

bool winux::ValueIsInArray ( StringArray const &  arr,
String const &  val,
bool  caseInsensitive = false 
)

判断一个字符串值是否在一个字符串数组里,默认大小写敏感

template<typename _Fx , typename... _ArgType>
int winux::VoidReturnInt ( _Fx  fn,
_ArgType &&...  arg 
)

调用一个返回void的函数或函数对象,返回一个数字

通常是为了在初始化语句中方便调用返回void的函数

在文件 utilities.hpp207 行定义.

void winux::WriteBinLog ( void const *  data,
int  size 
)

二进制日志

void winux::WriteLog ( String const &  s)

日志

变量说明

WINUX_DLL char const* winux::__TerminalBgColorAttrs[]
WINUX_DLL char const* winux::__TerminalFgColorAttrs[]
String const winux::dirSep = "\\"

目录分割符

在文件 filesys.hpp16 行定义.

String const winux::DirSep = "\\"

目录分割符

在文件 filesys.hpp19 行定义.

String const winux::lineSep = "\r\n"

行分割符

在文件 filesys.hpp17 行定义.

String const winux::LineSep = "\r\n"

行分割符

在文件 filesys.hpp20 行定义.

String const winux::pathEnvSep = ";"

PATH环境变量路径分割符

在文件 filesys.hpp18 行定义.

String const winux::PathEnvSep = ";"

PATH环境变量路径分割符

在文件 filesys.hpp21 行定义.