path.pxd 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. from util.generic.string cimport TString, TStringBuf
  2. from util.generic.vector cimport TVector
  3. # NOTE (danila-eremin) Currently not possible to use `const` and `except +` at the same time, so some function not marked const
  4. cdef extern from "util/folder/path.h" nogil:
  5. cdef cppclass TFsPath:
  6. TFsPath() except +
  7. TFsPath(const TString&) except +
  8. TFsPath(const TStringBuf) except +
  9. TFsPath(const char*) except +
  10. void CheckDefined() except +
  11. bint IsDefined() const
  12. bint operator bool() const
  13. const char* c_str() const
  14. bint operator==(const TFsPath&) const
  15. bint operator!=(const TFsPath&) const
  16. # NOTE (danila-eremin) operator `/=` Not supported
  17. # TFsPath& operator/=(const TFsPath&) const
  18. TFsPath operator/(const TFsPath&, const TFsPath&) except +
  19. # NOTE (danila-eremin) TPathSplit needed
  20. # const TPathSplit& PathSplit() const
  21. TFsPath& Fix() except +
  22. const TString& GetPath() const
  23. TString GetName() const
  24. TString GetExtension() const
  25. bint IsAbsolute() const
  26. bint IsRelative() const
  27. bint IsSubpathOf(const TFsPath&) const
  28. bint IsNonStrictSubpathOf(const TFsPath&) const
  29. bint IsContainerOf(const TFsPath&) const
  30. TFsPath RelativeTo(const TFsPath&) except +
  31. TFsPath RelativePath(const TFsPath&) except +
  32. TFsPath Parent() const
  33. TString Basename() const
  34. TString Dirname() const
  35. TFsPath Child(const TString&) except +
  36. void MkDir() except +
  37. void MkDir(const int) except +
  38. void MkDirs() except +
  39. void MkDirs(const int) except +
  40. void List(TVector[TFsPath]&) except +
  41. void ListNames(TVector[TString]&) except +
  42. bint Contains(const TString&) const
  43. void DeleteIfExists() except +
  44. void ForceDelete() except +
  45. # NOTE (danila-eremin) TFileStat needed
  46. # bint Stat(TFileStat&) const
  47. bint Exists() const
  48. bint IsDirectory() const
  49. bint IsFile() const
  50. bint IsSymlink() const
  51. void CheckExists() except +
  52. void RenameTo(const TString&) except +
  53. void RenameTo(const char*) except +
  54. void RenameTo(const TFsPath&) except +
  55. void ForceRenameTo(const TString&) except +
  56. void CopyTo(const TString&, bint) except +
  57. void Touch() except +
  58. TFsPath RealPath() except +
  59. TFsPath RealLocation() except +
  60. TFsPath ReadLink() except +
  61. @staticmethod
  62. TFsPath Cwd() except +
  63. void Swap(TFsPath&)