You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
4.9 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: platformstl/filesystem/path_functions.hpp
  3. *
  4. * Purpose: Path manipulation functions.
  5. *
  6. * Created: 12th June 2006
  7. * Updated: 10th August 2009
  8. *
  9. * Home: http://stlsoft.org/
  10. *
  11. * Copyright (c) 2005-2009, Matthew Wilson and Synesis Software
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions are met:
  16. *
  17. * - Redistributions of source code must retain the above copyright notice, this
  18. * list of conditions and the following disclaimer.
  19. * - Redistributions in binary form must reproduce the above copyright notice,
  20. * this list of conditions and the following disclaimer in the documentation
  21. * and/or other materials provided with the distribution.
  22. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
  23. * any contributors may be used to endorse or promote products derived from
  24. * this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  27. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  30. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  31. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  32. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  33. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  34. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  35. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  36. * POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. * ////////////////////////////////////////////////////////////////////// */
  39. /** \file platformstl/filesystem/path_functions.hpp
  40. *
  41. * \brief [C++ only] Path manipulation functions
  42. * (\ref group__library__filesystem "File System" Library).
  43. */
  44. #ifndef PLATFORMSTL_INCL_PLATFORMSTL_FILESYSTEM_HPP_PATH_FUNCTIONS
  45. #define PLATFORMSTL_INCL_PLATFORMSTL_FILESYSTEM_HPP_PATH_FUNCTIONS
  46. /* File version */
  47. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  48. # define PLATFORMSTL_VER_PLATFORMSTL_FILESYSTEM_HPP_PATH_FUNCTIONS_MAJOR 1
  49. # define PLATFORMSTL_VER_PLATFORMSTL_FILESYSTEM_HPP_PATH_FUNCTIONS_MINOR 1
  50. # define PLATFORMSTL_VER_PLATFORMSTL_FILESYSTEM_HPP_PATH_FUNCTIONS_REVISION 1
  51. # define PLATFORMSTL_VER_PLATFORMSTL_FILESYSTEM_HPP_PATH_FUNCTIONS_EDIT 8
  52. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  53. /* /////////////////////////////////////////////////////////////////////////
  54. * Includes
  55. */
  56. #ifndef PLATFORMSTL_INCL_PLATFORMSTL_FILESYSTEM_HPP_PLATFORMSTL
  57. # include <platformstl/platformstl.hpp>
  58. #endif /* !PLATFORMSTL_INCL_PLATFORMSTL_FILESYSTEM_HPP_PLATFORMSTL */
  59. #if defined(PLATFORMSTL_OS_IS_UNIX)
  60. # ifndef UNIXSTL_INCL_UNIXSTL_FILESYSTEM_HPP_PATH_FUNCTIONS
  61. # include <unixstl/filesystem/path_functions.hpp>
  62. # endif /* !UNIXSTL_INCL_UNIXSTL_FILESYSTEM_HPP_PATH_FUNCTIONS */
  63. #elif defined(PLATFORMSTL_OS_IS_WINDOWS)
  64. # ifndef WINSTL_INCL_WINSTL_FILESYSTEM_HPP_PATH_FUNCTIONS
  65. # include <winstl/filesystem/path_functions.hpp>
  66. # endif /* !WINSTL_INCL_WINSTL_FILESYSTEM_HPP_PATH_FUNCTIONS */
  67. #else /* ? operating system */
  68. # error Operating system not discriminated
  69. #endif /* operating system */
  70. /* /////////////////////////////////////////////////////////////////////////
  71. * Namespace
  72. */
  73. #if defined(_STLSOFT_NO_NAMESPACE) || \
  74. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  75. /* There is no stlsoft namespace, so must define ::platformstl */
  76. namespace platformstl
  77. {
  78. #else
  79. /* Define stlsoft::platformstl_project */
  80. namespace stlsoft
  81. {
  82. namespace platformstl_project
  83. {
  84. #endif /* _STLSOFT_NO_NAMESPACE */
  85. /* ////////////////////////////////////////////////////////////////////// */
  86. template< ss_typename_param_k S
  87. , ss_typename_param_k C
  88. >
  89. inline stlsoft_ns_qual(ss_size_t) path_squeeze(S const& path, C *buffer, stlsoft_ns_qual(ss_size_t) cchBuffer)
  90. {
  91. #if defined(PLATFORMSTL_OS_IS_UNIX)
  92. return unixstl_ns_qual(path_squeeze)(path, buffer, cchBuffer);
  93. #elif defined(PLATFORMSTL_OS_IS_WINDOWS)
  94. return winstl_ns_qual(path_squeeze)(path, buffer, cchBuffer);
  95. #else /* ? operating system */
  96. # error Operating system not discriminated
  97. #endif /* operating system */
  98. }
  99. /* ////////////////////////////////////////////////////////////////////// */
  100. #if defined(_STLSOFT_NO_NAMESPACE) || \
  101. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  102. } // namespace platformstl
  103. #else
  104. } // namespace platformstl_project
  105. } // namespace stlsoft
  106. #endif /* _STLSOFT_NO_NAMESPACE */
  107. /* ////////////////////////////////////////////////////////////////////// */
  108. #endif /* !PLATFORMSTL_INCL_PLATFORMSTL_FILESYSTEM_HPP_PATH_FUNCTIONS */
  109. /* ///////////////////////////// end of file //////////////////////////// */