Replace use of c++ reserved word operator.

Issue #353
This commit is contained in:
John McNamara 2021-08-09 19:04:50 +01:00
parent bfec97a226
commit b66c9bc95e
2 changed files with 13 additions and 14 deletions

View File

@ -3688,7 +3688,7 @@ lxw_error worksheet_filter_column(lxw_worksheet *worksheet, lxw_col_t col,
* @param col The column in the autofilter that the rules applies to.
* @param rule1 First lxw_filter_rule autofilter rule.
* @param rule2 Second lxw_filter_rule autofilter rule.
* @param operator A #lxw_filter_operator and/or operator.
* @param and_or A #lxw_filter_operator and/or operator.
*
* @return A #lxw_error code.
*
@ -3713,8 +3713,7 @@ lxw_error worksheet_filter_column(lxw_worksheet *worksheet, lxw_col_t col,
* The `col` parameter is a zero indexed column number and must refer to a
* column in an existing autofilter created with `worksheet_autofilter()`.
*
* The `operator` parameter is either "and (LXW_FILTER_AND)" or "or
* (LXW_FILTER_OR)".
* The `and_or` parameter is either "and (LXW_FILTER_AND)" or "or (LXW_FILTER_OR)".
*
* It isn't sufficient to just specify the filter condition. You must also
* hide any rows that don't match the filter condition. See @ref
@ -3722,7 +3721,7 @@ lxw_error worksheet_filter_column(lxw_worksheet *worksheet, lxw_col_t col,
*/
lxw_error worksheet_filter_column2(lxw_worksheet *worksheet, lxw_col_t col,
lxw_filter_rule *rule1,
lxw_filter_rule *rule2, uint8_t operator);
lxw_filter_rule *rule2, uint8_t and_or);
/**
* @brief Write multiple string filters to an autofilter column.
*

View File

@ -4538,12 +4538,12 @@ _worksheet_write_col_breaks(lxw_worksheet *self)
*/
STATIC void
_worksheet_write_filter(lxw_worksheet *self, const char *str, double num,
uint8_t operator)
uint8_t criteria)
{
struct xml_attribute_list attributes;
struct xml_attribute *attribute;
if (operator == LXW_FILTER_CRITERIA_BLANKS)
if (criteria == LXW_FILTER_CRITERIA_BLANKS)
return;
LXW_INIT_ATTRIBUTES();
@ -4605,22 +4605,22 @@ _worksheet_write_filter_standard(lxw_worksheet *self,
*/
STATIC void
_worksheet_write_custom_filter(lxw_worksheet *self, const char *str, double num,
uint8_t operator)
uint8_t criteria)
{
struct xml_attribute_list attributes;
struct xml_attribute *attribute;
LXW_INIT_ATTRIBUTES();
if (operator == LXW_FILTER_CRITERIA_NOT_EQUAL_TO)
if (criteria == LXW_FILTER_CRITERIA_NOT_EQUAL_TO)
LXW_PUSH_ATTRIBUTES_STR("operator", "notEqual");
if (operator == LXW_FILTER_CRITERIA_GREATER_THAN)
if (criteria == LXW_FILTER_CRITERIA_GREATER_THAN)
LXW_PUSH_ATTRIBUTES_STR("operator", "greaterThan");
else if (operator == LXW_FILTER_CRITERIA_GREATER_THAN_OR_EQUAL_TO)
else if (criteria == LXW_FILTER_CRITERIA_GREATER_THAN_OR_EQUAL_TO)
LXW_PUSH_ATTRIBUTES_STR("operator", "greaterThanOrEqual");
else if (operator == LXW_FILTER_CRITERIA_LESS_THAN)
else if (criteria == LXW_FILTER_CRITERIA_LESS_THAN)
LXW_PUSH_ATTRIBUTES_STR("operator", "lessThan");
else if (operator == LXW_FILTER_CRITERIA_LESS_THAN_OR_EQUAL_TO)
else if (criteria == LXW_FILTER_CRITERIA_LESS_THAN_OR_EQUAL_TO)
LXW_PUSH_ATTRIBUTES_STR("operator", "lessThanOrEqual");
if (str)
@ -8374,7 +8374,7 @@ worksheet_filter_column(lxw_worksheet *self, lxw_col_t col,
lxw_error
worksheet_filter_column2(lxw_worksheet *self, lxw_col_t col,
lxw_filter_rule *rule1, lxw_filter_rule *rule2,
uint8_t operator)
uint8_t and_or)
{
lxw_filter_rule_obj *rule_obj;
uint16_t rule_index;
@ -8408,7 +8408,7 @@ worksheet_filter_column2(lxw_worksheet *self, lxw_col_t col,
rule_obj = calloc(1, sizeof(lxw_filter_rule_obj));
RETURN_ON_MEM_ERROR(rule_obj, LXW_ERROR_MEMORY_MALLOC_FAILED);
if (operator == LXW_FILTER_AND)
if (and_or == LXW_FILTER_AND)
rule_obj->type = LXW_FILTER_TYPE_AND;
else
rule_obj->type = LXW_FILTER_TYPE_OR;