15460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//===- RealPath.h ---------------------------------------------------------===// 25460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// 35460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// The MCLinker Project 45460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// 55460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// This file is distributed under the University of Illinois Open Source 65460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// License. See LICENSE.TXT for details. 75460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// 85460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//===----------------------------------------------------------------------===// 937b74a387bb3993387029859c2d9d051c41c724eStephen Hines#ifndef MCLD_SUPPORT_REALPATH_H_ 1037b74a387bb3993387029859c2d9d051c41c724eStephen Hines#define MCLD_SUPPORT_REALPATH_H_ 115460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao#include "mcld/Support/Path.h" 1237b74a387bb3993387029859c2d9d051c41c724eStephen Hines 135460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao#include <string> 145460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 155460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaonamespace mcld { 1637b74a387bb3993387029859c2d9d051c41c724eStephen Hinesnamespace sys { 1737b74a387bb3993387029859c2d9d051c41c724eStephen Hinesnamespace fs { 185460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 195460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao/** \class RealPath 205460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao * \brief The canonicalized absolute pathname. 215460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao * 225460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao */ 2337b74a387bb3993387029859c2d9d051c41c724eStephen Hinesclass RealPath : public Path { 2437b74a387bb3993387029859c2d9d051c41c724eStephen Hines public: 2537b74a387bb3993387029859c2d9d051c41c724eStephen Hines typedef Path::ValueType ValueType; 265460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao typedef Path::StringType StringType; 275460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 2837b74a387bb3993387029859c2d9d051c41c724eStephen Hines public: 295460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao RealPath(); 3037b74a387bb3993387029859c2d9d051c41c724eStephen Hines explicit RealPath(const ValueType* s); 3137b74a387bb3993387029859c2d9d051c41c724eStephen Hines explicit RealPath(const StringType& s); 325460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao explicit RealPath(const Path& pPath); 335460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 345460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao ~RealPath(); 355460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 365460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao RealPath& assign(const Path& pPath); 375460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 3837b74a387bb3993387029859c2d9d051c41c724eStephen Hines protected: 395460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao void initialize(); 405460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}; 415460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 4237b74a387bb3993387029859c2d9d051c41c724eStephen Hines} // namespace fs 4337b74a387bb3993387029859c2d9d051c41c724eStephen Hines} // namespace sys 4437b74a387bb3993387029859c2d9d051c41c724eStephen Hines} // namespace mcld 455460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 4637b74a387bb3993387029859c2d9d051c41c724eStephen Hines//----------------------------------------------------------------------------// 4737b74a387bb3993387029859c2d9d051c41c724eStephen Hines// STL compatible functions // 4837b74a387bb3993387029859c2d9d051c41c724eStephen Hines//----------------------------------------------------------------------------// 495460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaonamespace std { 505460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 5137b74a387bb3993387029859c2d9d051c41c724eStephen Hinestemplate <> 5237b74a387bb3993387029859c2d9d051c41c724eStephen Hinesstruct less<mcld::sys::fs::RealPath> 5337b74a387bb3993387029859c2d9d051c41c724eStephen Hines : public binary_function<mcld::sys::fs::RealPath, 5437b74a387bb3993387029859c2d9d051c41c724eStephen Hines mcld::sys::fs::RealPath, 5537b74a387bb3993387029859c2d9d051c41c724eStephen Hines bool> { 5637b74a387bb3993387029859c2d9d051c41c724eStephen Hines bool operator()(const mcld::sys::fs::RealPath& pX, 5737b74a387bb3993387029859c2d9d051c41c724eStephen Hines const mcld::sys::fs::RealPath& pY) const { 585460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao if (pX.native().size() < pY.native().size()) 595460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao return true; 605460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao return (pX.native() < pY.native()); 615460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao } 625460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}; 635460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 6437b74a387bb3993387029859c2d9d051c41c724eStephen Hines} // namespace std 655460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 6637b74a387bb3993387029859c2d9d051c41c724eStephen Hines#endif // MCLD_SUPPORT_REALPATH_H_ 67