Home | History | Annotate | Download | only in Support

Lines Matching defs:Path

1 //===- Path.cpp -----------------------------------------------------------===//
9 #include "mcld/Support/Path.h"
34 const Path::StringType separator_str("/");
41 const Path::StringType separator_str("/");
47 // Path
49 Path::Path() : m_PathName() {
52 Path::Path(const Path::ValueType* s) : m_PathName(s) {
55 Path::Path(const Path::StringType& s) : m_PathName(s) {
58 Path::Path(const Path& pCopy) : m_PathName(pCopy.m_PathName) {
61 Path::~Path() {
64 bool Path::isFromRoot() const {
70 bool Path::isFromPWD() const {
76 Path& Path::assign(const Path::StringType& s) {
81 Path& Path::assign(const Path::ValueType* s, unsigned int length) {
83 assert(0 && "assign a null or empty string to Path");
89 Path& Path::append(const Path& pPath) {
90 // first path is a/,second path is /b
93 llvm::StringRef path(pPath.native());
94 m_PathName.append(path.begin() + 1, path.end());
97 // first path is a,second path is b
108 Path& Path::append(const StringType& pPath) {
109 Path path(pPath);
110 this->append(path);
114 bool Path::empty() const {
118 Path::StringType Path::generic_string() const {
124 bool Path::canonicalize() {
128 Path::StringType::size_type Path::m_append_separator_if_needed() {
130 // On Windows platform, path can not append separator.
143 void Path::m_erase_redundant_separator(Path::StringType::size_type pSepPos) {
158 Path Path::parent_path() const {
161 return Path(m_PathName.substr(0, end_pos));
162 return Path();
165 Path Path::filename() const {
169 return Path(m_PathName.substr(pos));
171 return Path(*this);
174 Path Path::stem() const {
177 Path result_path(m_PathName.substr(begin_pos, end_pos - begin_pos));
181 Path Path::extension() const {
184 return Path();
185 return Path(m_PathName.substr(pos));
191 bool operator==(const Path& pLHS, const Path& pRHS) {
195 bool operator!=(const Path& pLHS, const Path& pRHS) {
199 Path operator+(const Path& pLHS, const Path& pRHS) {
200 mcld::sys::fs::Path result = pLHS;