1#ifndef PERSISTED_RULE_INCLUDED 
    2#define PERSISTED_RULE_INCLUDED 
   76    if (is_enabled_c != 
nullptr && is_enabled_c[0] == 
'Y')
 
   85    message = std::optional<std::string>(message_arg);
 
  122    if (value != 
nullptr) {
 
  132                      std::optional<std::string> value) {
 
  134    if (!value.has_value()) {
 
  135      cursor->
set(column, 
nullptr, 0);
 
  138    const std::string &s = value.value();
 
  139    cursor->
set(column, s.c_str(), s.length());
 
A rule as persisted on disk.
Definition: persisted_rule.h:42
 
void set_if_present(rts::Cursor *cursor, rts::Cursor::column_id column, std::optional< std::string > value)
Writes a string value to the cursor's column if it exists.
Definition: persisted_rule.h:131
 
void set_message(const std::string &message_arg)
Convenience function, may be called with a const char*.
Definition: persisted_rule.h:84
 
void copy_and_set(std::optional< std::string > *property, rts::Cursor *c, int colno)
Reads from a Cursor and writes to a property of type std::optional<string> after forcing a copy of th...
Definition: persisted_rule.h:119
 
void set_pattern_digest(const std::string &s)
Convenience function, may be called with a const char*.
Definition: persisted_rule.h:89
 
bool write_to(rts::Cursor *c)
Writes the values in this Persisted_rule to the table at the row pointed to by the cursor.
Definition: persisted_rule.h:103
 
std::optional< std::string > message
The plugin's message, write-only.
Definition: persisted_rule.h:57
 
std::optional< std::string > normalized_pattern
The normalized pattern, write-only.
Definition: persisted_rule.h:63
 
bool is_enabled
True if the rule is enabled.
Definition: persisted_rule.h:54
 
std::optional< std::string > pattern_digest
The pattern's digest, write-only.
Definition: persisted_rule.h:60
 
std::optional< std::string > replacement
The rewrite rule's replacement string.
Definition: persisted_rule.h:51
 
std::optional< std::string > pattern_db
The pattern's current database.
Definition: persisted_rule.h:48
 
void set_normalized_pattern(const std::string &s)
Convenience function, may be called with a const char*.
Definition: persisted_rule.h:94
 
std::optional< std::string > pattern
The rewrite rule's pattern string.
Definition: persisted_rule.h:45
 
Persisted_rule(rts::Cursor *c)
Constructs a Persisted_rule object that copies all data into the current heap.
Definition: persisted_rule.h:70
 
Writable cursor that allows reading and updating of rows in a persistent table.
Definition: service_rules_table.h:64
 
int write()
Writes the row in the write buffer to the table at the current row.
Definition: rules_table_service.cc:177
 
column_id pattern_digest_column() const
Definition: service_rules_table.h:88
 
column_id normalized_pattern_column() const
Definition: service_rules_table.h:89
 
column_id message_column() const
Definition: service_rules_table.h:87
 
column_id enabled_column() const
Definition: service_rules_table.h:86
 
void set(int colno, const char *str, size_t length)
Sets the value of column colno to a string value.
Definition: rules_table_service.cc:164
 
static const column_id ILLEGAL_COLUMN_ID
Definition: service_rules_table.h:68
 
const char * fetch_string(int fieldno)
Fetches the value of the column with the given number as a C string.
Definition: rules_table_service.cc:139
 
column_id pattern_column() const
Definition: service_rules_table.h:81
 
void make_writeable()
Prepares the write buffer for updating the current row.
Definition: rules_table_service.cc:159
 
column_id pattern_database_column() const
Definition: service_rules_table.h:82
 
column_id replacement_column() const
Definition: service_rules_table.h:85
 
int column_id
Definition: service_rules_table.h:66
 
Definition: service_rules_table.h:46
 
void free_string(const char *str)
Frees a const char pointer allocated in the server's dynamic library using new[].
Definition: rules_table_service.cc:68
 
Plugin service that provides access to the rewrite rules table that is used by the Rewriter plugin.