ServerPath.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // FileZilla - a Windows ftp client
  2. // Copyright (C) 2002-2004 - Tim Kosse <[email protected]>
  3. // This program is free software; you can redistribute it and/or
  4. // modify it under the terms of the GNU General Public License
  5. // as published by the Free Software Foundation; either version 2
  6. // of the License, or (at your option) any later version.
  7. // This program is distributed in the hope that it will be useful,
  8. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. // GNU General Public License for more details.
  11. // You should have received a copy of the GNU General Public License
  12. // along with this program; if not, write to the Free Software
  13. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. // ServerPath.h: Schnittstelle für die Klasse CServerPath.
  15. //
  16. //////////////////////////////////////////////////////////////////////
  17. #if !defined(AFX_SERVERPATH_H__DF62E6B4_541A_4425_BA73_22B09A12DFE1__INCLUDED_)
  18. #define AFX_SERVERPATH_H__DF62E6B4_541A_4425_BA73_22B09A12DFE1__INCLUDED_
  19. #if _MSC_VER > 1000
  20. #pragma once
  21. #endif // _MSC_VER > 1000
  22. class CServerPath
  23. {
  24. public:
  25. BOOL AddSubdir(CString subdir);
  26. BOOL AddSubdirs(CString subdirs);
  27. CString GetSubdirsOf(const CServerPath &path) const;
  28. CString GetSafePath() const;
  29. BOOL SetSafePath(CString path);
  30. const BOOL IsEmpty() const;
  31. BOOL IsParentOf(const CServerPath &path, BOOL bCompareNoCase = FALSE) const;
  32. BOOL IsSubdirOf(const CServerPath &path, BOOL bCompareNoCase = FALSE) const;
  33. CServerPath GetParent() const;
  34. BOOL HasParent() const;
  35. CString GetLastSegment() const;
  36. CServerPath();
  37. CServerPath(int nServerType);
  38. CServerPath(CString path);
  39. CServerPath(CString path, int nServerType);
  40. CServerPath(CString subdir, const CServerPath &parent); //If subdir is absolute, parent is ignored
  41. CServerPath(const CServerPath &path);
  42. virtual ~CServerPath();
  43. void SetServer(const t_server &server);
  44. BOOL SetPath(CString &newpath, BOOL bIsFile);
  45. BOOL SetPath(CString newpath);
  46. BOOL ChangePath(CString &subdir, BOOL bIsFile = FALSE);
  47. const CString GetPath() const;
  48. const bool MatchNoCase(const CServerPath &op) const;
  49. CServerPath& operator=(const CServerPath &op);
  50. const bool operator == (const CServerPath &op) const;
  51. const bool operator != (const CServerPath &op) const;
  52. CString FormatFilename(CString fn, bool omitPath = false) const;
  53. protected:
  54. BOOL m_bEmpty;
  55. std::list<CString> m_Segments;
  56. typedef std::list<CString>::iterator tIter;
  57. typedef std::list<CString>::const_iterator tConstIter;
  58. typedef std::list<CString>::const_iterator tConstIter;
  59. CString m_Prefix;
  60. int m_nServerType;
  61. };
  62. const BOOL operator == (const CServerPath &a, const CString &b);
  63. #endif // !defined(AFX_SERVERPATH_H__DF62E6B4_541A_4425_BA73_22B09A12DFE1__INCLUDED_)