1 Star 0 Fork 10

netgod/supervisor

forked from leo/supervisor 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
system.h 2.01 KB
一键复制 编辑 原始数据 按行查看 历史
leo 提交于 2016-12-12 17:29 . First edition
#ifndef __OMNI_SYSTEM_H_INCLUDED__
#define __OMNI_SYSTEM_H_INCLUDED__
#include <cstdint>
#include <ctime>
#include <functional>
#include <string>
struct DateTime {
int nYear;
int nMonth;
int nDay;
int nWeek;
int nHour;
int nMin;
int nSec;
int nMSec;
DateTime();
DateTime(uint64_t nHRTime);
DateTime(const DateTime & r);
DateTime(int nY, int nM, int nD, int nH, int nMin, int nS);
/**
* Return a high resolution time for serialize.
**/
uint64_t Time();
};
extern uint64_t Tick();
struct Path {
/**
* Check does gaven path exists.
*
* \param sPath Path to check.
* \return True for existing.
**/
static bool Exists(const std::string & sPath);
/**
* Create a path. Parent directory MUST exists!!!
*
* \param sPath Path to create.
* \return True for success.
**/
static bool Create(const std::string & sPath);
/**
* Get current working directory.
**/
static std::string Current();
/**
* Change current working directory.
*
* \param sPath Path to change to.
* \return True for success.
**/
static bool Change(const std::string & sPath);
/**
* Get full path.
*
* \param sPath Path to convert.
* \return Full path
**/
static std::string FullPath(const std::string & sPath);
/**
* Get directory part of a path.
*
* \param sPath Orignal path.
* \return Directory part of this path.
**/
static std::string PurePath(const std::string & sPath);
/**
* Get file name of a path.
*
* \param sPath Orignal path.
* \return file name of this path.
**/
static std::string PureFile(const std::string & sPath);
/**
* Traverse all files under gaven path.
*
* \param sPath Path to traverse.
* \param fOpt Action to do with this file.
* \param bRecursive Should we go into the sub directories.
**/
static void Traverse(const std::string & sPath, std::function<void (const std::string &)> fOpt, bool bRecursive = true);
};
#endif//! __OMNI_SYSTEM_H_INCLUDED__
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/netgod/supervisor.git
[email protected]:netgod/supervisor.git
netgod
supervisor
supervisor
master

搜索帮助