query

struct mikrotik::api::query

A little utility class containing a query name and an optional value.

A simple utility class, mostly used by the DSL. Upon creation it formats the values into ?<name>[=<value>], where the part inside the brackets is omitted if the value is not provided.

A valid query matches the following EBNF grammar:

query ::= "?", [ query prefix ], [ query content ];

query prefix ::= "-" | "=" | "<" | ">" | "#";

query content ::= STRING, [ "=", [ STRING ] ]
                 | query operations, { query operations };

 query operations ::= DIGIT, { DIGIT }
                     | "!" | "&" | "|" | ".";

Warning

To get the equals sign in the query with no value one must provide the empty string as the value, otherwise the equals sign is omitted.

Since

v1.0.0

Public Functions

query(std::string_view name)

A construct valueless query.

Constructs an query with the specified name and the value part omitted The query will be in the form ?<name>.

Note

To create a negated (or any special) query just provide -message as the name for example. The given name string is copied verbatim when constructing the query.

Since

v1.0.0

Parameters
  • name: The name of the query to create

query(const char *name)

A construct valueless query.

Constructs an query with the specified name and the value part omitted The query will be in the form ?<name>.

Note

To create a negated (or any special) query just provide -message as the name for example. The given name string is copied verbatim when constructing the query.

Since

v1.0.0

Parameters
  • name: The name of the query to create

query(std::string_view name, std::string_view value)

A construct a query with a specified value.

Constructs a query with the specified name with the specified value. The query will be in the form ?<name>=<value>.

Note

To create a negated (or any special) query just provide -message as the name for example. The given name string is copied verbatim when constructing query.

Since

v1.0.0

Parameters
  • name: The name of the query to create

  • value: The value of the query to create

query(const char *name, const char *value)

A construct a query with a specified value.

Constructs a query with the specified name with the specified value. The query will be in the form ?<name>=<value>.

Note

To create a negated (or any special) query just provide -message as the name for example. The given name string is copied verbatim when constructing query.

Since

v1.0.0

Parameters
  • name: The name of the query to create

  • value: The value of the query to create

Public Members

std::string value

The vale of the query in the format for MikroTik.