ServerPath.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. CString GetSafePath() const;
  27. const BOOL IsEmpty() const;
  28. CServerPath GetParent() const;
  29. BOOL HasParent() const;
  30. CString GetLastSegment() const;
  31. CServerPath();
  32. CServerPath(int nServerType);
  33. CServerPath(CString path);
  34. CServerPath(CString path, int nServerType);
  35. CServerPath(CString subdir, const CServerPath &parent); //If subdir is absolute, parent is ignored
  36. CServerPath(const CServerPath &path);
  37. virtual ~CServerPath();
  38. void SetServer(const t_server &server);
  39. BOOL SetPath(CString &newpath, BOOL bIsFile);
  40. BOOL SetPath(CString newpath);
  41. const CString GetPath() const;
  42. CServerPath& operator=(const CServerPath &op);
  43. const bool operator == (const CServerPath &op) const;
  44. const bool operator != (const CServerPath &op) const;
  45. CString FormatFilename(CString fn, bool omitPath = false) const;
  46. protected:
  47. BOOL m_bEmpty;
  48. std::list<CString> m_Segments;
  49. typedef std::list<CString>::iterator tIter;
  50. typedef std::list<CString>::const_iterator tConstIter;
  51. typedef std::list<CString>::const_iterator tConstIter;
  52. CString m_Prefix;
  53. int m_nServerType;
  54. };
  55. const BOOL operator == (const CServerPath &a, const CString &b);
  56. #endif // !defined(AFX_SERVERPATH_H__DF62E6B4_541A_4425_BA73_22B09A12DFE1__INCLUDED_)