ServerPath.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //---------------------------------------------------------------------------
  2. #ifndef ServerPathH
  3. #define ServerPathH
  4. //---------------------------------------------------------------------------
  5. class CServerPath
  6. {
  7. public:
  8. BOOL AddSubdir(CString subdir);
  9. CString GetSafePath() const;
  10. const BOOL IsEmpty() const;
  11. CServerPath GetParent() const;
  12. BOOL HasParent() const;
  13. CString GetLastSegment() const;
  14. CServerPath();
  15. CServerPath(int nServerType);
  16. CServerPath(CString path, bool trim = true);
  17. CServerPath(CString path, int nServerType, bool trim = true);
  18. CServerPath(CString subdir, const CServerPath & parent); // If subdir is absolute, parent is ignored
  19. CServerPath(const CServerPath & path);
  20. virtual ~CServerPath();
  21. void SetServer(const t_server & server);
  22. BOOL SetPath(CString & newpath, BOOL bIsFile);
  23. BOOL SetPath(CString newpath);
  24. const CString GetPath() const;
  25. CServerPath & operator=(const CServerPath & op);
  26. const bool operator==(const CServerPath & op) const;
  27. const bool operator!=(const CServerPath & op) const;
  28. CString FormatFilename(CString fn, bool omitPath = false) const;
  29. protected:
  30. BOOL m_bEmpty;
  31. std::list<CString> m_Segments;
  32. typedef std::list<CString>::iterator tIter;
  33. typedef std::list<CString>::const_iterator tConstIter;
  34. typedef std::list<CString>::const_iterator tConstIter;
  35. CString m_Prefix;
  36. int m_nServerType;
  37. };
  38. //---------------------------------------------------------------------------
  39. const BOOL operator==(const CServerPath & a, const CString & b);
  40. //---------------------------------------------------------------------------
  41. #endif // ServerPathH