mergerfs/src/fs_path.hpp

88 lines
1.8 KiB
C++
Raw Normal View History

/*
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
2017-06-30 11:15:20 -04:00
#pragma once
#include <string>
#include <vector>
namespace fs
{
namespace path
{
using std::string;
2018-10-13 23:48:30 -04:00
string dirname(const char *path_);
string dirname(const string *path_);
string basename(const string &path);
2019-01-25 07:03:46 -05:00
static
inline
void
append(string &base,
const char *suffix)
{
base += suffix;
}
2019-01-25 07:03:46 -05:00
static
inline
void
append(string &base,
const string &suffix)
{
base += suffix;
}
2019-01-25 07:03:46 -05:00
static
inline
2019-01-25 07:03:46 -05:00
string
make(const string &base_,
2019-01-25 07:03:46 -05:00
const char *suffix_)
{
2019-01-25 07:03:46 -05:00
return (base_ + suffix_);
}
2018-10-13 23:48:30 -04:00
2019-01-25 07:03:46 -05:00
static
2018-10-13 23:48:30 -04:00
inline
string
make(const string *base_,
const char *suffix_)
{
return (*base_ + suffix_);
}
static
inline
string
make(const string *base_,
const string *suffix_)
{
return (*base_ + *suffix_);
}
2019-01-25 07:03:46 -05:00
static
inline
string
make(const string &base_,
const string &suffix_)
{
return (base_ + suffix_);
}
}
};