1//===- RealPath.h ---------------------------------------------------------===// 2// 3// The MCLinker Project 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9#ifndef MCLD_SUPPORT_REALPATH_H 10#define MCLD_SUPPORT_REALPATH_H 11#include "mcld/Support/Path.h" 12#include <string> 13 14namespace mcld { 15namespace sys { 16namespace fs { 17 18/** \class RealPath 19 * \brief The canonicalized absolute pathname. 20 * 21 */ 22class RealPath : public Path 23{ 24public: 25 typedef Path::ValueType ValueType; 26 typedef Path::StringType StringType; 27 28public: 29 RealPath(); 30 explicit RealPath(const ValueType* s ); 31 explicit RealPath(const StringType &s ); 32 explicit RealPath(const Path& pPath); 33 34 ~RealPath(); 35 36 RealPath& assign(const Path& pPath); 37 38protected: 39 void initialize(); 40}; 41 42} // namespace of fs 43} // namespace of sys 44} // namespace of mcld 45 46//-------------------------------------------------------------------------// 47// STL compatible functions // 48//-------------------------------------------------------------------------// 49namespace std { 50 51template<> 52struct less<mcld::sys::fs::RealPath> : public binary_function< 53 mcld::sys::fs::RealPath, 54 mcld::sys::fs::RealPath, 55 bool> 56{ 57 bool operator() (const mcld::sys::fs::RealPath& pX, 58 const mcld::sys::fs::RealPath& pY) const { 59 if (pX.native().size() < pY.native().size()) 60 return true; 61 return (pX.native() < pY.native()); 62 } 63}; 64 65} // namespace of std 66 67 68#endif 69 70