From 7139370990fdefcdc83c160918b0cbae93cd773a Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 23 Mar 2021 21:57:38 +0100 Subject: [PATCH] move belonging stuff into cs_ident --- src/cs_ident.cc | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/cubescript.cc | 45 --------------------------------------------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/cs_ident.cc b/src/cs_ident.cc index a3025ed..3e24206 100644 --- a/src/cs_ident.cc +++ b/src/cs_ident.cc @@ -203,6 +203,29 @@ bool ident_is_used_arg(cs_ident *id, cs_state &cs) { /* public interface */ +LIBCUBESCRIPT_EXPORT int cs_ident::get_raw_type() const { + return p_impl->p_type; +} + +LIBCUBESCRIPT_EXPORT cs_ident_type cs_ident::get_type() const { + if (p_impl->p_type > ID_ALIAS) { + return cs_ident_type::SPECIAL; + } + return cs_ident_type(p_impl->p_type); +} + +LIBCUBESCRIPT_EXPORT std::string_view cs_ident::get_name() const { + return p_impl->p_name; +} + +LIBCUBESCRIPT_EXPORT int cs_ident::get_flags() const { + return p_impl->p_flags; +} + +LIBCUBESCRIPT_EXPORT int cs_ident::get_index() const { + return p_impl->p_index; +} + LIBCUBESCRIPT_EXPORT bool cs_ident::is_alias() const { return get_type() == cs_ident_type::ALIAS; } @@ -363,6 +386,28 @@ LIBCUBESCRIPT_EXPORT void cs_svar::set_value(cs_strref val) { static_cast(this)->p_storage = val; } +LIBCUBESCRIPT_EXPORT cs_value cs_alias::get_value() const { + return static_cast(this)->p_val; +} + +void cs_alias::get_cval(cs_value &v) const { + auto *imp = static_cast(this); + switch (imp->p_val.get_type()) { + case cs_value_type::STRING: + v = imp->p_val; + break; + case cs_value_type::INT: + v.set_int(imp->p_val.get_int()); + break; + case cs_value_type::FLOAT: + v.set_float(imp->p_val.get_float()); + break; + default: + v.set_none(); + break; + } +} + LIBCUBESCRIPT_EXPORT std::string_view cs_command::get_args() const { return static_cast(this)->p_cargs; } diff --git a/src/cubescript.cc b/src/cubescript.cc index 423d19c..898d71a 100644 --- a/src/cubescript.cc +++ b/src/cubescript.cc @@ -231,51 +231,6 @@ LIBCUBESCRIPT_EXPORT void cs_state::print_var(cs_var const &v) const { } } -LIBCUBESCRIPT_EXPORT cs_value cs_alias::get_value() const { - return static_cast(this)->p_val; -} - -void cs_alias::get_cval(cs_value &v) const { - auto *imp = static_cast(this); - switch (imp->p_val.get_type()) { - case cs_value_type::STRING: - v = imp->p_val; - break; - case cs_value_type::INT: - v.set_int(imp->p_val.get_int()); - break; - case cs_value_type::FLOAT: - v.set_float(imp->p_val.get_float()); - break; - default: - v.set_none(); - break; - } -} - -int cs_ident::get_raw_type() const { - return p_impl->p_type; -} - -cs_ident_type cs_ident::get_type() const { - if (p_impl->p_type > ID_ALIAS) { - return cs_ident_type::SPECIAL; - } - return cs_ident_type(p_impl->p_type); -} - -std::string_view cs_ident::get_name() const { - return p_impl->p_name; -} - -int cs_ident::get_flags() const { - return p_impl->p_flags; -} - -int cs_ident::get_index() const { - return p_impl->p_index; -} - LIBCUBESCRIPT_EXPORT cs_command *cs_state::new_command( std::string_view name, std::string_view args, cs_command_cb func ) {