From 4ecbbf673f342934b83a8de3187d40a8d3f175fa Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Mon, 9 Aug 2021 23:28:58 +0300 Subject: [PATCH] Change getter names to follow naming conventions in command line parser --- core/command_line_parser.cpp | 22 +++++++++++----------- core/command_line_parser.h | 10 +++++----- doc/CommandLineHelpFormat.xml | 2 +- doc/CommandLineParser.xml | 8 ++++---- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/command_line_parser.cpp b/core/command_line_parser.cpp index 543bdccb..698d15ac 100644 --- a/core/command_line_parser.cpp +++ b/core/command_line_parser.cpp @@ -89,7 +89,7 @@ void CommandLineHelpFormat::_bind_methods() { ClassDB::bind_method(D_METHOD("get_min_description_length"), &CommandLineHelpFormat::get_min_description_length); ClassDB::bind_method(D_METHOD("set_autogenerate_usage", "generate"), &CommandLineHelpFormat::set_autogenerate_usage); - ClassDB::bind_method(D_METHOD("is_autogenerate_usage"), &CommandLineHelpFormat::is_autogenerate_usage); + ClassDB::bind_method(D_METHOD("is_usage_autogenerated"), &CommandLineHelpFormat::is_usage_autogenerated); ADD_PROPERTY(PropertyInfo(Variant::STRING, "header"), "set_header", "get_header"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "footer"), "set_footer", "get_footer"); @@ -98,7 +98,7 @@ void CommandLineHelpFormat::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "right_pad"), "set_right_pad", "get_right_pad"); ADD_PROPERTY(PropertyInfo(Variant::INT, "line_length"), "set_line_length", "get_line_length"); ADD_PROPERTY(PropertyInfo(Variant::INT, "min_description_length"), "set_min_description_length", "get_min_description_length"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autogenerate_usage"), "set_autogenerate_usage", "is_autogenerate_usage"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autogenerate_usage"), "set_autogenerate_usage", "is_usage_autogenerated"); } // Represents detected option prefix. @@ -555,24 +555,24 @@ void CommandLineParser::_bind_methods() { ClassDB::bind_method(D_METHOD("get_similarity_bias"), &CommandLineParser::get_similarity_bias); ClassDB::bind_method(D_METHOD("set_allow_forwarding_args", "allow"), &CommandLineParser::set_allow_forwarding_args); - ClassDB::bind_method(D_METHOD("is_allow_forwarding_args"), &CommandLineParser::is_allow_forwarding_args); + ClassDB::bind_method(D_METHOD("are_forwarding_args_allowed"), &CommandLineParser::are_forwarding_args_allowed); ClassDB::bind_method(D_METHOD("set_allow_adjacent", "allow"), &CommandLineParser::set_allow_adjacent); - ClassDB::bind_method(D_METHOD("is_allow_adjacent"), &CommandLineParser::is_allow_adjacent); + ClassDB::bind_method(D_METHOD("is_adjacent_allowed"), &CommandLineParser::is_adjacent_allowed); ClassDB::bind_method(D_METHOD("set_allow_sticky", "allow"), &CommandLineParser::set_allow_sticky); - ClassDB::bind_method(D_METHOD("is_allow_sticky"), &CommandLineParser::is_allow_sticky); + ClassDB::bind_method(D_METHOD("is_sticky_allowed"), &CommandLineParser::is_sticky_allowed); ClassDB::bind_method(D_METHOD("set_allow_compound", "allow"), &CommandLineParser::set_allow_compound); - ClassDB::bind_method(D_METHOD("is_allow_compound"), &CommandLineParser::is_allow_compound); + ClassDB::bind_method(D_METHOD("is_compound_allowed"), &CommandLineParser::is_compound_allowed); ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "long_prefixes"), "set_long_prefixes", "get_long_prefixes"); ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "short_prefixes"), "set_short_prefixes", "get_short_prefixes"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "similarity_bias"), "set_similarity_bias", "get_similarity_bias"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_forwarding_args"), "set_allow_forwarding_args", "is_allow_forwarding_args"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_adjacent"), "set_allow_adjacent", "is_allow_adjacent"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_sticky"), "set_allow_sticky", "is_allow_sticky"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_compound"), "set_allow_compound", "is_allow_compound"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_forwarding_args"), "set_allow_forwarding_args", "are_forwarding_args_allowed"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_adjacent"), "set_allow_adjacent", "is_adjacent_allowed"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_sticky"), "set_allow_sticky", "is_sticky_allowed"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_compound"), "set_allow_compound", "is_compound_allowed"); } static int find_arg(const PoolStringArray &p_args, const String &p_arg) { @@ -842,7 +842,7 @@ String CommandLineParser::get_help_text(const Ref &p_form if (!format->get_header().empty()) { help_text += format->get_header(); } - if (format->is_autogenerate_usage()) { + if (format->is_usage_autogenerated()) { help_text += '\n' + _get_usage(printable_options, format->get_usage_title()); } help_text += _get_options_description(categories_data); diff --git a/core/command_line_parser.h b/core/command_line_parser.h index f3ed41fa..ac32559b 100644 --- a/core/command_line_parser.h +++ b/core/command_line_parser.h @@ -110,7 +110,7 @@ class CommandLineHelpFormat : public Reference { int get_min_description_length() const { return _min_description_length; } void set_autogenerate_usage(bool p_generate) { _autogenerate_usage = p_generate; } - bool is_autogenerate_usage() const { return _autogenerate_usage; } + bool is_usage_autogenerated() const { return _autogenerate_usage; } }; class CommandLineParser : public Reference { @@ -214,16 +214,16 @@ class CommandLineParser : public Reference { float get_similarity_bias() const { return _similarity_bias; } void set_allow_forwarding_args(bool p_allow) { _allow_forwarding_args = p_allow; } - bool is_allow_forwarding_args() const { return _allow_forwarding_args; } + bool are_forwarding_args_allowed() const { return _allow_forwarding_args; } void set_allow_adjacent(bool p_allow) { _allow_adjacent = p_allow; } - bool is_allow_adjacent() const { return _allow_adjacent; } + bool is_adjacent_allowed() const { return _allow_adjacent; } void set_allow_sticky(bool p_allow) { _allow_sticky = p_allow; } - bool is_allow_sticky() const { return _allow_sticky; } + bool is_sticky_allowed() const { return _allow_sticky; } void set_allow_compound(bool p_allow) { _allow_compound = p_allow; } - bool is_allow_compound() const { return _allow_compound; } + bool is_compound_allowed() const { return _allow_compound; } void clear(); diff --git a/doc/CommandLineHelpFormat.xml b/doc/CommandLineHelpFormat.xml index 6a6f3d85..42881b28 100644 --- a/doc/CommandLineHelpFormat.xml +++ b/doc/CommandLineHelpFormat.xml @@ -11,7 +11,7 @@ - + If [code]true[/code], the usage text will be automatically generated according to passed options. diff --git a/doc/CommandLineParser.xml b/doc/CommandLineParser.xml index 85520308..c93835e7 100644 --- a/doc/CommandLineParser.xml +++ b/doc/CommandLineParser.xml @@ -187,16 +187,16 @@ - + If [code]true[/code], values for options can delimited by [code]=[/code] sign. Example: [code]--input=filename.png[/code]. - + If [code]true[/code], short options can be specified without a space. Example: [code]-aux[/code] will be equivalent to [code]-a -u -x[/code]. - + If [code]true[/code], all arguments after [code]--[/code] will be treated as forwarding arguments and will be available using the [method get_forwarding_args]. Such arguments will not be parsed as options. - + If [code]true[/code], values for short options can be specified without a space. Example: [code]-ifilename.png[/code].