| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768 | 
							- /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 
-    file Copyright.txt or https://cmake.org/licensing for details.  */
 
- #pragma once
 
- #include "cmConfigure.h" // IWYU pragma: keep
 
- #include <cstddef>
 
- #include <string>
 
- #include <utility>
 
- #include <cm/filesystem>
 
- #include <cm/string_view>
 
- #include <cm/type_traits>
 
- namespace cm {
 
- class static_string_view;
 
- }
 
- namespace detail {
 
- #if defined(__SUNPRO_CC) && defined(__sparc)
 
- // Oracle DeveloperStudio C++ compiler on Solaris/Sparc fails to compile
 
- // the full 'is_pathable' and 'is_move_pathable' checks.  We use it only to
 
- // improve error messages via 'enable_if' when calling methods with incorrect
 
- // types. Just pretend all types are allowed so we can at least compile valid
 
- // code.
 
- template <typename T>
 
- struct is_pathable : std::true_type
 
- {
 
- };
 
- template <typename T>
 
- struct is_move_pathable : std::true_type
 
- {
 
- };
 
- #else
 
- template <typename T, typename = void>
 
- struct is_pathable : std::false_type
 
- {
 
- };
 
- template <>
 
- struct is_pathable<cm::filesystem::path> : std::true_type
 
- {
 
- };
 
- template <>
 
- struct is_pathable<std::string> : std::true_type
 
- {
 
- };
 
- template <>
 
- struct is_pathable<cm::string_view> : std::true_type
 
- {
 
- };
 
- template <>
 
- struct is_pathable<cm::static_string_view> : std::true_type
 
- {
 
- };
 
- template <typename T>
 
- struct is_pathable<
 
-   T,
 
-   cm::enable_if_t<std::is_same<char*, typename std::decay<T>::type>::value,
 
-                   void>>
 
-   : cm::bool_constant<std::is_same<char*, typename std::decay<T>::type>::value>
 
- {
 
- };
 
- template <typename T>
 
- struct is_move_pathable : std::false_type
 
- {
 
- };
 
- template <>
 
- struct is_move_pathable<cm::filesystem::path> : std::true_type
 
- {
 
- };
 
- template <>
 
- struct is_move_pathable<std::string> : std::true_type
 
- {
 
- };
 
- #endif
 
- }
 
- class cmCMakePath
 
- {
 
- private:
 
-   template <typename Source>
 
-   using enable_if_move_pathable =
 
-     cm::enable_if_t<detail::is_move_pathable<Source>::value, cmCMakePath&>;
 
-   template <typename Source>
 
-   using enable_if_pathable =
 
-     cm::enable_if_t<detail::is_pathable<Source>::value, cmCMakePath&>;
 
- public:
 
-   using value_type = cm::filesystem::path::value_type;
 
-   using string_type = cm::filesystem::path::string_type;
 
-   enum format : unsigned char
 
-   {
 
-     auto_format =
 
-       static_cast<unsigned char>(cm::filesystem::path::format::auto_format),
 
-     native_format =
 
-       static_cast<unsigned char>(cm::filesystem::path::format::native_format),
 
-     generic_format =
 
-       static_cast<unsigned char>(cm::filesystem::path::format::generic_format)
 
-   };
 
-   class iterator;
 
-   using const_iterator = iterator;
 
-   cmCMakePath() noexcept = default;
 
-   cmCMakePath(const cmCMakePath&) = default;
 
-   cmCMakePath(cmCMakePath&& path) noexcept
 
-     : Path(std::forward<cm::filesystem::path>(path.Path))
 
-   {
 
-   }
 
-   cmCMakePath(cm::filesystem::path path) noexcept
 
-     : Path(std::move(path))
 
-   {
 
-   }
 
-   cmCMakePath(cm::string_view source, format fmt = generic_format) noexcept
 
-     : Path(FormatPath(source, fmt))
 
-   {
 
-   }
 
-   cmCMakePath(const char* source, format fmt = generic_format) noexcept
 
-     : Path(FormatPath(cm::string_view{ source }, fmt))
 
-   {
 
-   }
 
- #if defined(__SUNPRO_CC) && defined(__sparc)
 
-   // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
 
-   // standard methods and templates use the same name. The template is selected
 
-   // rather than the standard one regardless the arguments of the method.
 
-   cmCMakePath(const std::string& source, format fmt = generic_format)
 
-     : Path(FormatPath(source, fmt))
 
-   {
 
-   }
 
-   cmCMakePath(std::string&& source, format fmt = generic_format)
 
-     : Path(FormatPath(std::move(source), fmt))
 
-   {
 
-   }
 
- #else
 
-   template <typename Source, typename = enable_if_move_pathable<Source>>
 
-   cmCMakePath(Source source, format fmt = generic_format)
 
-     : Path(FormatPath(std::move(source), fmt))
 
-   {
 
-   }
 
- #endif
 
-   template <typename Source, typename = enable_if_move_pathable<Source>>
 
-   cmCMakePath& Assign(Source&& source)
 
-   {
 
-     this->Path = std::forward<Source>(source);
 
-     return *this;
 
-   }
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath& Assign(const Source& source)
 
-   {
 
-     this->Path = source;
 
-     return *this;
 
-   }
 
-   cmCMakePath& operator=(const cmCMakePath& path)
 
-   {
 
-     if (this != &path) {
 
-       this->Path = path.Path;
 
-     }
 
-     return *this;
 
-   }
 
-   cmCMakePath& operator=(cmCMakePath&& path) noexcept
 
-   {
 
-     if (this != &path) {
 
-       this->Path = std::move(path.Path);
 
-     }
 
-     return *this;
 
-   }
 
- #if defined(__SUNPRO_CC) && defined(__sparc)
 
-   // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
 
-   // standard methods and templates use the same name. The template is selected
 
-   // rather than the standard one regardless the arguments of the method.
 
-   cmCMakePath& operator=(cm::filesystem::path&& source)
 
-   {
 
-     this->Assign(std::forward<cm::filesystem::path>(source));
 
-     return *this;
 
-   }
 
-   cmCMakePath& operator=(std::string&& source)
 
-   {
 
-     this->Assign(std::forward<std::string>(source));
 
-     return *this;
 
-   }
 
-   cmCMakePath& operator=(const cm::filesystem::path& source)
 
-   {
 
-     this->Assign(source);
 
-     return *this;
 
-   }
 
-   cmCMakePath& operator=(const std::string& source)
 
-   {
 
-     this->Assign(source);
 
-     return *this;
 
-   }
 
-   cmCMakePath& operator=(const cm::string_view source)
 
-   {
 
-     this->Assign(source);
 
-     return *this;
 
-   }
 
-   cmCMakePath& operator=(const char* source)
 
-   {
 
-     this->Assign(cm::string_view{ source });
 
-     return *this;
 
-   }
 
- #else
 
-   template <typename Source, typename = enable_if_move_pathable<Source>>
 
-   cmCMakePath& operator=(Source&& source)
 
-   {
 
-     this->Assign(std::forward<Source>(source));
 
-     return *this;
 
-   }
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath& operator=(const Source& source)
 
-   {
 
-     this->Assign(source);
 
-     return *this;
 
-   }
 
- #endif
 
-   // Concatenation
 
-   cmCMakePath& Append(const cmCMakePath& path)
 
-   {
 
-     return this->Append(path.Path);
 
-   }
 
-   cmCMakePath& Append(const cm::filesystem::path& path)
 
-   {
 
-     this->Path /= path;
 
-     // filesystem::path::append use preferred_separator ('\' on Windows)
 
-     // so convert back to '/'
 
-     this->Path = this->Path.generic_string();
 
-     return *this;
 
-   }
 
- #if defined(__SUNPRO_CC) && defined(__sparc)
 
-   // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
 
-   // standard methods and templates use the same name. The template is selected
 
-   // rather than the standard one regardless the arguments of the method.
 
-   cmCMakePath& Append(const std::string& source)
 
-   {
 
-     return this->Append(cm::filesystem::path(source));
 
-   }
 
-   cmCMakePath& Append(cm::string_view source)
 
-   {
 
-     return this->Append(cm::filesystem::path(source));
 
-   }
 
-   cmCMakePath& Append(const char* source)
 
-   {
 
-     return this->Append(cm::filesystem::path(cm::string_view{ source }));
 
-   }
 
- #else
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath& Append(const Source& source)
 
-   {
 
-     return this->Append(cm::filesystem::path(source));
 
-   }
 
- #endif
 
-   cmCMakePath& operator/=(const cmCMakePath& path)
 
-   {
 
-     return this->Append(path);
 
-   }
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath& operator/=(const Source& source)
 
-   {
 
-     return this->Append(source);
 
-   }
 
-   cmCMakePath& Concat(const cmCMakePath& path)
 
-   {
 
-     this->Path += path.Path;
 
-     return *this;
 
-   }
 
-   cmCMakePath& Concat(cm::string_view source)
 
-   {
 
-     this->Path.operator+=(std::string(source));
 
-     return *this;
 
-   }
 
- #if defined(__SUNPRO_CC) && defined(__sparc)
 
-   // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
 
-   // standard methods and templates use the same name. The template is selected
 
-   // rather than the standard one regardless the arguments of the method.
 
-   cmCMakePath& Concat(const cm::filesystem::path& source)
 
-   {
 
-     this->Path.operator+=(source);
 
-     return *this;
 
-   }
 
-   cmCMakePath& Concat(const std::string& source)
 
-   {
 
-     this->Path.operator+=(source);
 
-     return *this;
 
-   }
 
-   cmCMakePath& Concat(const char* source)
 
-   {
 
-     this->Path.operator+=(source);
 
-     return *this;
 
-   }
 
- #else
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath& Concat(const Source& source)
 
-   {
 
-     this->Path.operator+=(source);
 
-     return *this;
 
-   }
 
- #endif
 
-   cmCMakePath& operator+=(const cmCMakePath& path)
 
-   {
 
-     return this->Concat(path);
 
-   }
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath& operator+=(const Source& source)
 
-   {
 
-     return this->Concat(source);
 
-   }
 
-   // Manipulation
 
-   void Clear() noexcept { this->Path.clear(); }
 
-   cmCMakePath& RemoveFileName()
 
-   {
 
-     this->Path.remove_filename();
 
-     return *this;
 
-   }
 
-   cmCMakePath& ReplaceFileName(const cmCMakePath& filename)
 
-   {
 
-     if (this->Path.has_filename()) {
 
-       this->Path.replace_filename(filename.Path);
 
-     }
 
-     return *this;
 
-   }
 
- #if defined(__SUNPRO_CC) && defined(__sparc)
 
-   // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
 
-   // standard methods and templates use the same name. The template is selected
 
-   // rather than the standard one regardless the arguments of the method.
 
-   cmCMakePath& ReplaceFileName(const cm::filesystem::path& filename)
 
-   {
 
-     if (this->Path.has_filename()) {
 
-       this->Path.replace_filename(filename);
 
-     }
 
-     return *this;
 
-   }
 
-   cmCMakePath& ReplaceFileName(const std::string& filename)
 
-   {
 
-     if (this->Path.has_filename()) {
 
-       this->Path.replace_filename(filename);
 
-     }
 
-     return *this;
 
-   }
 
-   cmCMakePath& ReplaceFileName(cm::string_view filename)
 
-   {
 
-     if (this->Path.has_filename()) {
 
-       this->Path.replace_filename(filename);
 
-     }
 
-     return *this;
 
-   }
 
- #else
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath& ReplaceFileName(const Source& filename)
 
-   {
 
-     if (this->Path.has_filename()) {
 
-       this->Path.replace_filename(filename);
 
-     }
 
-     return *this;
 
-   }
 
- #endif
 
-   cmCMakePath& ReplaceExtension(const cmCMakePath& extension = cmCMakePath())
 
-   {
 
-     this->Path.replace_extension(extension.Path);
 
-     return *this;
 
-   }
 
- #if defined(__SUNPRO_CC) && defined(__sparc)
 
-   // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
 
-   // standard methods and templates use the same name. The template is selected
 
-   // rather than the standard one regardless the arguments of the method.
 
-   cmCMakePath& ReplaceExtension(const cm::filesystem::path& extension)
 
-   {
 
-     this->Path.replace_extension(extension);
 
-     return *this;
 
-   }
 
-   cmCMakePath& ReplaceExtension(const std::string& extension)
 
-   {
 
-     this->Path.replace_extension(extension);
 
-     return *this;
 
-   }
 
-   cmCMakePath& ReplaceExtension(const cm::string_view extension)
 
-   {
 
-     this->Path.replace_extension(extension);
 
-     return *this;
 
-   }
 
- #else
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath& ReplaceExtension(const Source& extension)
 
-   {
 
-     this->Path.replace_extension(extension);
 
-     return *this;
 
-   }
 
- #endif
 
-   cmCMakePath& ReplaceWideExtension(
 
-     const cmCMakePath& extension = cmCMakePath())
 
-   {
 
-     return this->ReplaceWideExtension(
 
-       static_cast<cm::string_view>(extension.Path.string()));
 
-   }
 
-   cmCMakePath& ReplaceWideExtension(const cm::filesystem::path& extension)
 
-   {
 
-     return this->ReplaceWideExtension(
 
-       static_cast<cm::string_view>(extension.string()));
 
-   }
 
- #if defined(__SUNPRO_CC) && defined(__sparc)
 
-   // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
 
-   // standard methods and templates use the same name. The template is selected
 
-   // rather than the standard one regardless the arguments of the method.
 
-   cmCMakePath& ReplaceWideExtension(const std::string& extension)
 
-   {
 
-     return this->ReplaceWideExtension(cm::string_view{ extension });
 
-   }
 
- #else
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath& ReplaceWideExtension(const Source& extension)
 
-   {
 
-     return this->ReplaceWideExtension(extension);
 
-   }
 
- #endif
 
-   cmCMakePath& ReplaceWideExtension(cm::string_view extension);
 
-   cmCMakePath& RemoveExtension()
 
-   {
 
-     if (this->Path.has_extension()) {
 
-       this->ReplaceExtension(cm::string_view(""));
 
-     }
 
-     return *this;
 
-   }
 
-   cmCMakePath& RemoveWideExtension()
 
-   {
 
-     if (this->Path.has_extension()) {
 
-       this->ReplaceWideExtension(cm::string_view(""));
 
-     }
 
-     return *this;
 
-   }
 
-   void swap(cmCMakePath& other) noexcept { this->Path.swap(other.Path); }
 
-   // Observers
 
-   std::string String() const { return this->Path.string(); }
 
-   std::wstring WString() const { return this->Path.wstring(); }
 
-   string_type Native() const
 
-   {
 
-     string_type path;
 
-     this->GetNativePath(path);
 
-     return path;
 
-   }
 
-   std::string NativeString() const
 
-   {
 
-     std::string path;
 
-     this->GetNativePath(path);
 
-     return path;
 
-   }
 
-   std::wstring NativeWString() const
 
-   {
 
-     std::wstring path;
 
-     this->GetNativePath(path);
 
-     return path;
 
-   }
 
-   std::string GenericString() const { return this->Path.generic_string(); }
 
-   std::wstring GenericWString() const { return this->Path.generic_wstring(); }
 
-   // Decomposition
 
-   cmCMakePath GetRootName() const { return this->Path.root_name(); }
 
-   cmCMakePath GetRootDirectory() const { return this->Path.root_directory(); }
 
-   cmCMakePath GetRootPath() const { return this->Path.root_path(); }
 
-   cmCMakePath GetFileName() const { return this->Path.filename(); }
 
-   cmCMakePath GetExtension() const { return this->Path.extension(); }
 
-   cmCMakePath GetWideExtension() const;
 
-   cmCMakePath GetStem() const { return this->Path.stem(); }
 
-   cmCMakePath GetNarrowStem() const;
 
-   cmCMakePath GetRelativePath() const { return this->Path.relative_path(); }
 
-   cmCMakePath GetParentPath() const { return this->Path.parent_path(); }
 
-   // Generation
 
-   cmCMakePath Normal() const
 
-   {
 
-     auto path = this->Path.lexically_normal();
 
-     // filesystem::path:lexically_normal use preferred_separator ('\') on
 
-     // Windows) so convert back to '/'
 
-     return path.generic_string();
 
-   }
 
-   cmCMakePath Relative(const cmCMakePath& base) const
 
-   {
 
-     return this->Relative(base.Path);
 
-   }
 
-   cmCMakePath Relative(const cm::filesystem::path& base) const
 
-   {
 
-     auto path = this->Path.lexically_relative(base);
 
-     // filesystem::path:lexically_relative use preferred_separator ('\') on
 
-     // Windows) so convert back to '/'
 
-     return path.generic_string();
 
-   }
 
- #if defined(__SUNPRO_CC) && defined(__sparc)
 
-   // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
 
-   // standard methods and templates use the same name. The template is selected
 
-   // rather than the standard one regardless the arguments of the method.
 
-   cmCMakePath Relative(const std::string& base) const
 
-   {
 
-     return this->Relative(cm::filesystem::path(base));
 
-   }
 
-   cmCMakePath Relative(cm::string_view base) const
 
-   {
 
-     return this->Relative(cm::filesystem::path(base));
 
-   }
 
- #else
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath Relative(const Source& base) const
 
-   {
 
-     return this->Relative(cm::filesystem::path(base));
 
-   }
 
- #endif
 
-   cmCMakePath Proximate(const cmCMakePath& base) const
 
-   {
 
-     return this->Proximate(base.Path);
 
-   }
 
-   cmCMakePath Proximate(const cm::filesystem::path& base) const
 
-   {
 
-     auto path = this->Path.lexically_proximate(base);
 
-     // filesystem::path::lexically_proximate use preferred_separator ('\') on
 
-     // Windows) so convert back to '/'
 
-     return path.generic_string();
 
-   }
 
- #if defined(__SUNPRO_CC) && defined(__sparc)
 
-   // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
 
-   // standard methods and templates use the same name. The template is selected
 
-   // rather than the standard one regardless the arguments of the method.
 
-   cmCMakePath Proximate(const std::string& base) const
 
-   {
 
-     return this->Proximate(cm::filesystem::path(base));
 
-   }
 
-   cmCMakePath Proximate(cm::string_view base) const
 
-   {
 
-     return this->Proximate(cm::filesystem::path(base));
 
-   }
 
- #else
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath Proximate(const Source& base) const
 
-   {
 
-     return this->Proximate(cm::filesystem::path(base));
 
-   }
 
- #endif
 
-   cmCMakePath Absolute(const cmCMakePath& base) const
 
-   {
 
-     return this->Absolute(base.Path);
 
-   }
 
- #if defined(__SUNPRO_CC) && defined(__sparc)
 
-   // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when
 
-   // standard methods and templates use the same name. The template is selected
 
-   // rather than the standard one regardless the arguments of the method.
 
-   cmCMakePath Absolute(const std::string& base) const
 
-   {
 
-     return this->Absolute(cm::filesystem::path(base));
 
-   }
 
-   cmCMakePath Absolute(cm::string_view base) const
 
-   {
 
-     return this->Absolute(cm::filesystem::path(base));
 
-   }
 
- #else
 
-   template <typename Source, typename = enable_if_pathable<Source>>
 
-   cmCMakePath Absolute(const Source& base) const
 
-   {
 
-     return this->Absolute(cm::filesystem::path(base));
 
-   }
 
- #endif
 
-   cmCMakePath Absolute(const cm::filesystem::path& base) const;
 
-   // Comparison
 
-   int Compare(const cmCMakePath& path) const noexcept
 
-   {
 
-     return this->Path.compare(path.Path);
 
-   }
 
-   // Query
 
-   bool IsEmpty() const noexcept { return this->Path.empty(); }
 
-   bool HasRootPath() const { return this->Path.has_root_path(); }
 
-   bool HasRootName() const { return this->Path.has_root_name(); }
 
-   bool HasRootDirectory() const { return this->Path.has_root_directory(); }
 
-   bool HasRelativePath() const { return this->Path.has_relative_path(); }
 
-   bool HasParentPath() const { return this->Path.has_parent_path(); }
 
-   bool HasFileName() const { return this->Path.has_filename(); }
 
-   bool HasStem() const { return this->Path.has_stem(); }
 
-   bool HasExtension() const { return this->Path.has_extension(); }
 
-   bool IsAbsolute() const { return this->Path.is_absolute(); }
 
-   bool IsRelative() const { return this->Path.is_relative(); }
 
-   bool IsPrefix(const cmCMakePath& path) const;
 
-   // Iterators
 
-   // =========
 
-   inline iterator begin() const;
 
-   inline iterator end() const;
 
-   // Non-members
 
-   // ===========
 
-   friend bool operator==(const cmCMakePath& lhs,
 
-                          const cmCMakePath& rhs) noexcept
 
-   {
 
-     return lhs.Compare(rhs) == 0;
 
-   }
 
-   friend bool operator!=(const cmCMakePath& lhs,
 
-                          const cmCMakePath& rhs) noexcept
 
-   {
 
-     return lhs.Compare(rhs) != 0;
 
-   }
 
-   friend cmCMakePath operator/(const cmCMakePath& lhs, const cmCMakePath& rhs)
 
-   {
 
-     cmCMakePath result(lhs);
 
-     result /= rhs;
 
-     return result;
 
-   }
 
- private:
 
-   friend std::size_t hash_value(const cmCMakePath& path) noexcept;
 
-   static std::string FormatPath(std::string path, format fmt = generic_format);
 
-   static std::string FormatPath(cm::string_view path,
 
-                                 format fmt = generic_format)
 
-   {
 
-     return FormatPath(std::string(path), fmt);
 
-   }
 
-   void GetNativePath(std::string& path) const;
 
-   void GetNativePath(std::wstring& path) const;
 
-   cm::filesystem::path Path;
 
- };
 
- class cmCMakePath::iterator
 
- {
 
- public:
 
-   using iterator_category = cm::filesystem::path::iterator::iterator_category;
 
-   using value_type = cmCMakePath;
 
-   using difference_type = cm::filesystem::path::iterator::difference_type;
 
-   using pointer = const cmCMakePath*;
 
-   using reference = const cmCMakePath&;
 
-   iterator() = default;
 
-   iterator(const iterator& other)
 
-     : Iterator(other.Iterator)
 
-     , Path(other.Path)
 
-     , PathElement(*this->Iterator)
 
-   {
 
-   }
 
-   ~iterator() = default;
 
-   iterator& operator=(const iterator& other)
 
-   {
 
-     if (this != &other) {
 
-       this->Iterator = other.Iterator;
 
-       this->Path = other.Path;
 
-       this->PathElement = *this->Iterator;
 
-     }
 
-     return *this;
 
-   }
 
-   reference operator*() const { return this->PathElement; }
 
-   pointer operator->() const { return &this->PathElement; }
 
-   iterator& operator++()
 
-   {
 
-     ++this->Iterator;
 
-     this->PathElement = *this->Iterator;
 
-     return *this;
 
-   }
 
-   iterator operator++(int)
 
-   {
 
-     iterator it(*this);
 
-     this->operator++();
 
-     return it;
 
-   }
 
-   iterator& operator--()
 
-   {
 
-     --this->Iterator;
 
-     this->PathElement = *this->Iterator;
 
-     return *this;
 
-   }
 
-   iterator operator--(int)
 
-   {
 
-     iterator it(*this);
 
-     this->operator--();
 
-     return it;
 
-   }
 
- private:
 
-   friend class cmCMakePath;
 
-   friend bool operator==(const iterator&, const iterator&);
 
-   iterator(const cmCMakePath* path, const cm::filesystem::path::iterator& it)
 
-     : Iterator(it)
 
-     , Path(path)
 
-     , PathElement(*this->Iterator)
 
-   {
 
-   }
 
-   cm::filesystem::path::iterator Iterator;
 
-   const cmCMakePath* Path = nullptr;
 
-   cmCMakePath PathElement;
 
- };
 
- inline cmCMakePath::iterator cmCMakePath::begin() const
 
- {
 
-   return iterator(this, this->Path.begin());
 
- }
 
- inline cmCMakePath::iterator cmCMakePath::end() const
 
- {
 
-   return iterator(this, this->Path.end());
 
- }
 
- // Non-member functions
 
- // ====================
 
- inline bool operator==(const cmCMakePath::iterator& lhs,
 
-                        const cmCMakePath::iterator& rhs)
 
- {
 
-   return lhs.Path == rhs.Path && lhs.Path && lhs.Iterator == rhs.Iterator;
 
- }
 
- inline bool operator!=(const cmCMakePath::iterator& lhs,
 
-                        const cmCMakePath::iterator& rhs)
 
- {
 
-   return !(lhs == rhs);
 
- }
 
- inline void swap(cmCMakePath& lhs, cmCMakePath& rhs) noexcept
 
- {
 
-   lhs.swap(rhs);
 
- }
 
- inline std::size_t hash_value(const cmCMakePath& path) noexcept
 
- {
 
-   return cm::filesystem::hash_value(path.Path);
 
- }
 
 
  |