See More

// Copyright (C) 2017-2018 Jonathan Müller // This file is subject to the license terms in the LICENSE file // found in the top-level directory of this distribution. #ifndef CPPAST_CPP_STATIC_ASSERT_HPP_INCLUDED #define CPPAST_CPP_STATIC_ASSERT_HPP_INCLUDED #include #include namespace cppast { class cpp_static_assert : public cpp_entity { public: static cpp_entity_kind kind() noexcept; /// \returns A newly created `static_assert()` entity. /// \notes It will not be registered as nothing can refer to it. static std::unique_ptr build(std::unique_ptr expr, std::string msg) { return std::unique_ptr( new cpp_static_assert(std::move(expr), std::move(msg))); } /// \returns A reference to the [cppast::cpp_expression]() that is being asserted. const cpp_expression& expression() const noexcept { return *expr_; } /// \returns A reference to the message of the assertion. const std::string& message() const noexcept { return msg_; } private: cpp_static_assert(std::unique_ptr expr, std::string msg) : cpp_entity(""), expr_(std::move(expr)), msg_(std::move(msg)) {} cpp_entity_kind do_get_entity_kind() const noexcept override; std::unique_ptr expr_; std::string msg_; }; } // namespace cppast #endif // CPPAST_CPP_STATIC_ASSERT_HPP_INCLUDED