1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
5 #include "cmConfigure.h" // IWYU pragma: keep
11 #include <cm/optional>
12 #include <cm/string_view>
14 #if !defined(CMake_USE_XCOFF_PARSER)
15 # error "This file may be included only if CMake_USE_XCOFF_PARSER is enabled."
18 class cmXCOFFInternal;
21 * \brief XCOFF parser.
32 /** Construct with the name of the XCOFF input file to parse. */
33 cmXCOFF(const char* fname, Mode = Mode::ReadOnly);
38 cmXCOFF(cmXCOFF&&) noexcept;
39 cmXCOFF(cmXCOFF const&) = delete;
40 cmXCOFF& operator=(cmXCOFF&&) noexcept;
41 cmXCOFF& operator=(cmXCOFF const&) = delete;
43 /** Get the error message if any. */
44 std::string const& GetErrorMessage() const { return this->ErrorMessage; }
46 /** Boolean conversion. True if the XCOFF file is valid. */
47 explicit operator bool() const { return this->Valid(); }
49 /** Get the LIBPATH (RPATH) parsed from the file, if any. */
50 cm::optional<cm::string_view> GetLibPath() const;
52 /** Set the LIBPATH (RPATH).
53 Works only if cmXCOFF was constructed with Mode::ReadWrite. */
54 bool SetLibPath(cm::string_view libPath);
56 /** Remove the LIBPATH (RPATH).
57 Works only if cmXCOFF was constructed with Mode::ReadWrite. */
61 friend class cmXCOFFInternal;
63 std::unique_ptr<cmXCOFFInternal> Internal;
64 std::string ErrorMessage;