Skip to content

Commit

Permalink
Change getter names to follow naming conventions in command line parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Xrayez committed Aug 9, 2021
1 parent cc38de9 commit 4ecbbf6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
22 changes: 11 additions & 11 deletions core/command_line_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -842,7 +842,7 @@ String CommandLineParser::get_help_text(const Ref<CommandLineHelpFormat> &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);
Expand Down
10 changes: 5 additions & 5 deletions core/command_line_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion doc/CommandLineHelpFormat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<methods>
</methods>
<members>
<member name="autogenerate_usage" type="bool" setter="set_autogenerate_usage" getter="is_autogenerate_usage" default="true">
<member name="autogenerate_usage" type="bool" setter="set_autogenerate_usage" getter="is_usage_autogenerated" default="true">
If [code]true[/code], the usage text will be automatically generated according to passed options.
</member>
<member name="footer" type="String" setter="set_footer" getter="get_footer" default="&quot;&quot;">
Expand Down
8 changes: 4 additions & 4 deletions doc/CommandLineParser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,16 @@
</method>
</methods>
<members>
<member name="allow_adjacent" type="bool" setter="set_allow_adjacent" getter="is_allow_adjacent" default="true">
<member name="allow_adjacent" type="bool" setter="set_allow_adjacent" getter="is_adjacent_allowed" default="true">
If [code]true[/code], values for options can delimited by [code]=[/code] sign. Example: [code]--input=filename.png[/code].
</member>
<member name="allow_compound" type="bool" setter="set_allow_compound" getter="is_allow_compound" default="true">
<member name="allow_compound" type="bool" setter="set_allow_compound" getter="is_compound_allowed" default="true">
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].
</member>
<member name="allow_forwarding_args" type="bool" setter="set_allow_forwarding_args" getter="is_allow_forwarding_args" default="false">
<member name="allow_forwarding_args" type="bool" setter="set_allow_forwarding_args" getter="are_forwarding_args_allowed" default="false">
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.
</member>
<member name="allow_sticky" type="bool" setter="set_allow_sticky" getter="is_allow_sticky" default="true">
<member name="allow_sticky" type="bool" setter="set_allow_sticky" getter="is_sticky_allowed" default="true">
If [code]true[/code], values for short options can be specified without a space. Example: [code]-ifilename.png[/code].
</member>
<member name="long_prefixes" type="PoolStringArray" setter="set_long_prefixes" getter="get_long_prefixes" default="PoolStringArray( &quot;--&quot; )">
Expand Down

0 comments on commit 4ecbbf6

Please sign in to comment.