16std::filesystem::path
const nxroot(
"/");
18std::filesystem::path cleanup(std::string
const &s) {
19 std::filesystem::path ret(s);
22 }
else if (s.back() ==
'/') {
24 ret = s.substr(0, s.size() - 1);
26 if (s.starts_with(
"//")) {
30 return ret.lexically_normal();
33std::filesystem::path cleanup(std::filesystem::path
const &p) {
return cleanup(p.string()); }
38 : m_path(cleanup(path)), m_resolved_path(m_path.generic_string()) {}
99 std::vector<std::string> names;
100 for (
auto it =
m_path.begin(); it !=
m_path.end(); it++) {
102 names.push_back(it->generic_string());
116 if (child.size() < 2 || child[0] !=
'/' || child.find(
'/', 1) != std::string::npos)
123 if (child.size() <= parent_size + 1)
127 if (child[parent_size] !=
'/')
131 auto next_slash = child.find(
'/', parent_size + 1);
132 return next_slash == std::string::npos;
This simple class encapsulates some methods for working with paths inside a Nexus file.
std::string operator+(std::string const &s) const
bool operator==(NexusAddress const &p) const
std::vector< std::string > parts() const
std::filesystem::path m_path
standard filesystem path
bool hasChild(std::string const &p) const
NexusAddress & operator/=(std::string const &s)
NexusAddress parent_path() const
NexusAddress & operator=(NexusAddress const &nd)=default
NexusAddress operator/(std::string const &s) const
static NexusAddress root()
std::string m_resolved_path
NexusAddress fromRoot() const
NexusAddress stem() const
bool operator!=(NexusAddress const &p) const
std::string const & string() const
MANTID_API_DLL std::ostream & operator<<(std::ostream &, const AlgorithmHistory &)
Prints a text representation.
MatrixWorkspace_sptr MANTID_API_DLL operator+(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Adds two workspaces.
Header for a base Nexus::Exception.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator!=(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)