25#ifndef TIMEMORY_UTILITY_UTILITY_CPP_
26#define TIMEMORY_UTILITY_UTILITY_CPP_ 1
32#if !defined(TIMEMORY_UTILITY_HEADER_MODE)
42#if defined(TIMEMORY_UNIX)
43 char* _cfname = realpath(_fname.c_str(),
nullptr);
47 while(_fname.find(
"\\\\") != std::string::npos)
48 _fname.replace(_fname.find(
"\\\\"), 2,
"/");
49 while(_fname.find(
'\\') != std::string::npos)
50 _fname.replace(_fname.find(
'\\'), 1,
"/");
52 return _fname.substr(0, _fname.find_last_of(
'/'));
53#elif defined(TIMEMORY_WINDOWS)
54 while(_fname.find(
'/') != std::string::npos)
55 _fname.replace(_fname.find(
'/'), 1,
"\\");
57 _fname = _fname.substr(0, _fname.find_last_of(
'\\'));
58 return (_fname.at(_fname.length() - 1) ==
'\\')
59 ? _fname.substr(0, _fname.length() - 1)
82 if(strbool.find_first_not_of(
"0123456789") == std::string::npos)
84 if(strbool.length() > 1 || strbool[0] !=
'0')
95 for(
const auto& itr : {
"off",
"false",
"no",
"n",
"f" })
102 for(
const auto& itr : {
"on",
"true",
"yes",
"y",
"t" })
113std::vector<std::string>
116 std::vector<std::string> _cmdline;
117#if defined(TIMEMORY_LINUX)
118 std::stringstream fcmdline;
119 fcmdline <<
"/proc/" << _pid <<
"/cmdline";
120 std::ifstream ifs(fcmdline.str().c_str());
136 _cmdline.push_back(sarg);
172 std::string::operator=(
osrepr(rhs));
180 std::string::operator=(
osrepr(rhs));
201#if defined(TIMEMORY_WINDOWS)
203#elif defined(TIMEMORY_UNIX)
211#if defined(TIMEMORY_WINDOWS)
213#elif defined(TIMEMORY_UNIX)
223#if defined(TIMEMORY_WINDOWS)
226#elif defined(TIMEMORY_UNIX)
TIMEMORY_UTILITY_INLINE path & insert(size_type __pos, const std::string &__s)
static TIMEMORY_UTILITY_INLINE std::string inverse()
static TIMEMORY_UTILITY_INLINE std::string osrepr(std::string _path)
static TIMEMORY_UTILITY_INLINE std::string canonical(std::string _path)
static TIMEMORY_UTILITY_INLINE std::string os()
TIMEMORY_UTILITY_INLINE path & operator=(const std::string &rhs)
TIMEMORY_UTILITY_INLINE path(const std::string &_path)
std::string::size_type size_type
int makedir(std::string _dir, int umask=0777)
std::string & replace(std::string &_path, char _c, const char *_v)
std::string canonical(std::string _path)
_reported insert(_hash_id)
const string_t const string_t & _dir
bool get_bool(const std::string &strbool, bool _default) noexcept
std::string dirname(std::string _fname)
std::vector< std::string > read_command_line(pid_t _pid)
tim::mpl::apply< std::string > string
int makedir(std::string _dir, int umask)
void consume_parameters(ArgsT &&...)