
Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`, now with "east const" enforcement. Use `clang-format` version 18. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit. Issue: #26123
66 lines
1.6 KiB
C++
66 lines
1.6 KiB
C++
/* 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 <iosfwd>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include <cm/optional>
|
|
#include <cm/string_view>
|
|
|
|
#if !defined(CMake_USE_XCOFF_PARSER)
|
|
# error "This file may be included only if CMake_USE_XCOFF_PARSER is enabled."
|
|
#endif
|
|
|
|
class cmXCOFFInternal;
|
|
|
|
/** \class cmXCOFF
|
|
* \brief XCOFF parser.
|
|
*/
|
|
class cmXCOFF
|
|
{
|
|
public:
|
|
enum class Mode
|
|
{
|
|
ReadOnly,
|
|
ReadWrite
|
|
};
|
|
|
|
/** Construct with the name of the XCOFF input file to parse. */
|
|
cmXCOFF(char const* fname, Mode = Mode::ReadOnly);
|
|
|
|
/** Destruct. */
|
|
~cmXCOFF();
|
|
|
|
cmXCOFF(cmXCOFF&&) noexcept;
|
|
cmXCOFF(cmXCOFF const&) = delete;
|
|
cmXCOFF& operator=(cmXCOFF&&) noexcept;
|
|
cmXCOFF& operator=(cmXCOFF const&) = delete;
|
|
|
|
/** Get the error message if any. */
|
|
std::string const& GetErrorMessage() const { return this->ErrorMessage; }
|
|
|
|
/** Boolean conversion. True if the XCOFF file is valid. */
|
|
explicit operator bool() const { return this->Valid(); }
|
|
|
|
/** Get the LIBPATH (RPATH) parsed from the file, if any. */
|
|
cm::optional<cm::string_view> GetLibPath() const;
|
|
|
|
/** Set the LIBPATH (RPATH).
|
|
Works only if cmXCOFF was constructed with Mode::ReadWrite. */
|
|
bool SetLibPath(cm::string_view libPath);
|
|
|
|
/** Remove the LIBPATH (RPATH).
|
|
Works only if cmXCOFF was constructed with Mode::ReadWrite. */
|
|
bool RemoveLibPath();
|
|
|
|
private:
|
|
friend class cmXCOFFInternal;
|
|
bool Valid() const;
|
|
std::unique_ptr<cmXCOFFInternal> Internal;
|
|
std::string ErrorMessage;
|
|
};
|