blob: 0369f259f4c9e151eb5645dab7c193f472704837 [file] [log] [blame]
//===- RealPath.h ---------------------------------------------------------===//
//
// The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef MCLD_SUPPORT_REALPATH_H
#define MCLD_SUPPORT_REALPATH_H
#ifdef ENABLE_UNITTEST
#include <gtest.h>
#endif
#include "mcld/Support/Path.h"
#include <string>
namespace mcld {
namespace sys {
namespace fs {
/** \class RealPath
* \brief The canonicalized absolute pathname.
*
*/
class RealPath : public Path
{
public:
typedef Path::ValueType ValueType;
typedef Path::StringType StringType;
public:
RealPath();
explicit RealPath(const ValueType* s );
explicit RealPath(const StringType &s );
explicit RealPath(const Path& pPath);
~RealPath();
RealPath& assign(const Path& pPath);
protected:
void initialize();
};
} // namespace of fs
} // namespace of sys
} // namespace of mcld
//-------------------------------------------------------------------------//
// STL compatible functions //
//-------------------------------------------------------------------------//
namespace std {
template<>
struct less<mcld::sys::fs::RealPath> : public binary_function<
mcld::sys::fs::RealPath,
mcld::sys::fs::RealPath,
bool>
{
bool operator() (const mcld::sys::fs::RealPath& pX,
const mcld::sys::fs::RealPath& pY) const {
if (pX.native().size() < pY.native().size())
return true;
return (pX.native() < pY.native());
}
};
} // namespace of std
#endif