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//===----------------------------------------------------------------------===//
987f34658dec9097d987d254a990ea7f311bfc95fStephen Hines#ifndef MCLD_SUPPORT_REALPATH_H
1087f34658dec9097d987d254a990ea7f311bfc95fStephen Hines#define MCLD_SUPPORT_REALPATH_H
115460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao#include "mcld/Support/Path.h"
125460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao#include <string>
135460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
145460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaonamespace mcld {
155460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaonamespace sys  {
165460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaonamespace fs   {
175460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
185460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao/** \class RealPath
195460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao *  \brief The canonicalized absolute pathname.
205460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao *
215460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao */
225460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaoclass RealPath : public Path
235460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao{
245460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaopublic:
255460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef Path::ValueType  ValueType;
265460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef Path::StringType StringType;
275460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
285460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaopublic:
295460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  RealPath();
305460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  explicit RealPath(const ValueType* s );
315460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  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
385460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaoprotected:
395460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  void initialize();
405460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao};
415460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
425460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao} // namespace of fs
435460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao} // namespace of sys
445460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao} // namespace of mcld
455460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
465460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//-------------------------------------------------------------------------//
475460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//                              STL compatible functions                   //
485460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//-------------------------------------------------------------------------//
495460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaonamespace std {
505460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
515460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaotemplate<>
525460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaostruct less<mcld::sys::fs::RealPath> : public binary_function<
535460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao                                                     mcld::sys::fs::RealPath,
545460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao                                                     mcld::sys::fs::RealPath,
555460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao                                                     bool>
565460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao{
575460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  bool operator() (const mcld::sys::fs::RealPath& pX,
585460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao                   const mcld::sys::fs::RealPath& pY) const {
595460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    if (pX.native().size() < pY.native().size())
605460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao      return true;
615460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    return (pX.native() < pY.native());
625460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  }
635460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao};
645460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
655460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao} // namespace of std
665460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
675460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
685460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao#endif
695460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
70