Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.7 KiB

  1. // FilePath.h: interface for the FilePath class.
  2. //
  3. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  4. // 2000. This computer program includes Confidential, Proprietary
  5. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  6. // use, disclosure, and/or reproduction is prohibited unless authorized
  7. // in writing. All Rights Reserved.
  8. //////////////////////////////////////////////////////////////////////
  9. #if !defined(AFX_FILEPATH_H__9C7FE273_F538_11D3_A5E0_00104BD32DA8__INCLUDED_)
  10. #define AFX_FILEPATH_H__9C7FE273_F538_11D3_A5E0_00104BD32DA8__INCLUDED_
  11. #include <string>
  12. #include <list>
  13. #include <iostream>
  14. #include <windows.h>
  15. #include "DllSymDefn.h"
  16. namespace iop
  17. {
  18. class IOPDLL_API FilePathComponent
  19. {
  20. public:
  21. FilePathComponent(unsigned short sFileID);
  22. FilePathComponent(std::string strFileID);
  23. virtual ~FilePathComponent();
  24. unsigned short GetShortID() { return m_usFileID; };
  25. std::string GetStringID();
  26. friend bool operator<(FilePathComponent const &lhs, FilePathComponent const &rhs); // Needed if you want these in a list
  27. friend bool operator>(FilePathComponent const &lhs, FilePathComponent const &rhs); // Needed if you want these in a list
  28. friend bool operator==(FilePathComponent const &lhs, FilePathComponent const &rhs);
  29. friend bool operator!=(FilePathComponent const &lhs, FilePathComponent const &rhs);
  30. friend std::ostream &operator<<(std::ostream &, FilePathComponent &);
  31. private:
  32. unsigned short m_usFileID;
  33. };
  34. #pragma warning(push)
  35. // Non-standard extension used: 'extern' before template explicit
  36. // instantiation
  37. #pragma warning(disable : 4231)
  38. IOPDLL_EXPIMP_TEMPLATE template class IOPDLL_API std::list<FilePathComponent>;
  39. #pragma warning(pop)
  40. class IOPDLL_API FilePath
  41. {
  42. public:
  43. FilePath();
  44. FilePath(const std::string strFilePath);
  45. FilePath(FilePath const &fp);
  46. virtual ~FilePath();
  47. FilePathComponent& operator[](unsigned int index);
  48. friend bool operator==(FilePath const &lhs, FilePath const &rhs);
  49. //operator +();
  50. const FilePath &operator +=(FilePathComponent);
  51. friend std::ostream &operator<<(std::ostream &, FilePath &);
  52. FilePathComponent Head();
  53. FilePathComponent Tail();
  54. void Clear();
  55. bool IsEmpty();
  56. FilePathComponent ChopTail();
  57. BYTE
  58. NumComponents();
  59. std::list<FilePathComponent> Components() { return m_FilePath; };
  60. FilePath GreatestCommonPrefix(FilePath &rPath);
  61. std::string GetStringPath();
  62. static FilePath Root();
  63. static bool IsValidPath(const std::string strFilePath);
  64. private:
  65. std::list<FilePathComponent> m_FilePath;
  66. };
  67. } // namespace iop
  68. #endif // !defined(AFX_FILEPATH_H__9C7FE273_F538_11D3_A5E0_00104BD32DA8__INCLUDED_)