path-docs.txt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /**
  2. Returns whether the segment is valid.
  3. @note
  4. The rules for valid segments are as follows:
  5. a) The empty string is not valid.
  6. b) Any string containing the slash character ('/') is not valid.
  7. c) Common notations for current ('.') and parent ('..') directory are forbidden.
  8. d) Any string containing segment or device separator characters on the local file system,
  9. such as the backslash ('\') and colon (':') on some file systems.
  10. (Thanks org.eclipse.core.runtime for the documentation ;D).
  11. @param segment
  12. The segment to be checked
  13. @return
  14. True if the segment is valid, false otherwise
  15. */
  16. static bool IsValidSegment(const Str& segment);
  17. /**
  18. Returns whether the path is valid.
  19. @note
  20. The rules for valid paths are as follows:
  21. a) The empty string is not valid.
  22. b) If the path is absolute, it mustn't contain any leading character.
  23. @param path
  24. The path to be checked
  25. @return
  26. True if the path is valid, false otherwise
  27. */
  28. static bool IsValidPath(const Str& path);
  29. /**
  30. Fills 'ret' with the same path but without the trailing directory separator.
  31. @note
  32. (e.g. /home/babbeo/texture.tga/ -> /home/babbeo/texture.tga).
  33. @param path
  34. The input path
  35. @param ret
  36. The ouput path
  37. @return
  38. True if success, false otherwise
  39. */
  40. static bool RemoveTrailingSeparator(const Str& path, Str& ret);
  41. /**
  42. Returns whether the path is absolute.
  43. @note
  44. (i.e. starts with Path::SEPARATOR or <a-Z><Path::DEVICE_SEPARATOR><Path::SEPARATOR>).
  45. @param path
  46. The path to be checked
  47. @return
  48. True if absolute, false otherwise
  49. */
  50. static bool IsAbsolutePath(const Str& path);
  51. /**
  52. Returns whether the path is a root path.
  53. @note
  54. (i.e. starts and ends with Path::SEPARATOR or <a-Z><Path::DEVICE_SEPARATOR><Path::SEPARATOR>).
  55. @param path
  56. The path to be checked
  57. @return
  58. True if root, false otherwise
  59. */
  60. static bool IsRootPath(const Str& path);
  61. /**
  62. Returns the pathname of the path.
  63. @note
  64. (e.g. /home/babbeo/texture.tga -> /home/babbeo).
  65. @param path
  66. The input path
  67. @param ret
  68. The output pathname
  69. @return
  70. True if success, false otherwise
  71. */
  72. static bool GetPathname(const Str& path, Str& ret);
  73. /**
  74. Returns the filename of the path.
  75. @note
  76. (e.g. /home/babbeo/texture.tga -> texture.tga).
  77. @param path
  78. The input path
  79. @param ret
  80. The output filename
  81. @return
  82. True if success, false otherwise
  83. */
  84. static bool GetFilename(const Str& path, Str& ret);
  85. /**
  86. Returns the basename of the path.
  87. @note
  88. (e.g. /home/babbeo/texture.tga -> texture).
  89. @param path
  90. The input path
  91. @param ret
  92. The output basename
  93. @return
  94. True if success, false otherwise
  95. */
  96. static bool GetBasename(const Str& path, Str& ret);
  97. /**
  98. Returns the extension of the path.
  99. @note
  100. (e.g. /home/babbeo/texture.tga -> tga).
  101. @param path
  102. The input path
  103. @param ret
  104. The output extension
  105. @return
  106. True if success, false otherwise
  107. */
  108. static bool GetFileExtension(const Str& path, Str& ret);
  109. /**
  110. Returns the segments contained in path.
  111. @param path
  112. The input path
  113. @param ret
  114. The output list containing path's segments
  115. @return
  116. True if success, false otherwise
  117. */