Renames collection::Variable to VariableValue

This commit is contained in:
Felipe Zimmerle
2018-02-02 18:50:04 -03:00
parent de7c5c89bb
commit eeec7efb68
137 changed files with 304 additions and 361 deletions

View File

@@ -26,7 +26,7 @@
#include <pthread.h>
#include "modsecurity/collection/variable.h"
#include "modsecurity/variable_value.h"
#include "src/utils/regex.h"
#include "src/utils/string.h"
@@ -86,35 +86,35 @@ void InMemoryPerProcess::del(const std::string& key) {
void InMemoryPerProcess::resolveSingleMatch(const std::string& var,
std::vector<const Variable *> *l) {
std::vector<const VariableValue *> *l) {
auto range = this->equal_range(var);
for (auto it = range.first; it != range.second; ++it) {
l->push_back(new Variable(&m_name, &it->first, &it->second));
l->push_back(new VariableValue(&m_name, &it->first, &it->second));
}
}
void InMemoryPerProcess::resolveMultiMatches(const std::string& var,
std::vector<const Variable *> *l) {
std::vector<const VariableValue *> *l) {
size_t keySize = var.size();
l->reserve(15);
if (keySize == 0) {
for (auto &i : *this) {
l->insert(l->begin(), new Variable(&m_name, &i.first, &i.second));
l->insert(l->begin(), new VariableValue(&m_name, &i.first, &i.second));
}
} else {
auto range = this->equal_range(var);
for (auto it = range.first; it != range.second; ++it) {
l->insert(l->begin(), new Variable(&m_name, &var, &it->second));
l->insert(l->begin(), new VariableValue(&m_name, &var, &it->second));
}
}
}
void InMemoryPerProcess::resolveRegularExpression(const std::string& var,
std::vector<const Variable *> *l) {
std::vector<const VariableValue *> *l) {
//if (var.find(":") == std::string::npos) {
@@ -146,7 +146,7 @@ void InMemoryPerProcess::resolveRegularExpression(const std::string& var,
continue;
}
l->insert(l->begin(), new Variable(&m_name, &x.first, &x.second));
l->insert(l->begin(), new VariableValue(&m_name, &x.first, &x.second));
}
}

View File

@@ -25,7 +25,7 @@
#endif
#include "modsecurity/collection/variable.h"
#include "modsecurity/variable_value.h"
#include "modsecurity/collection/collection.h"
#ifndef SRC_COLLECTION_BACKEND_IN_MEMORY_PER_PROCESS_H_
@@ -86,11 +86,11 @@ class InMemoryPerProcess :
std::unique_ptr<std::string> resolveFirst(const std::string& var) override;
void resolveSingleMatch(const std::string& var,
std::vector<const Variable *> *l) override;
std::vector<const VariableValue *> *l) override;
void resolveMultiMatches(const std::string& var,
std::vector<const Variable *> *l) override;
std::vector<const VariableValue *> *l) override;
void resolveRegularExpression(const std::string& var,
std::vector<const Variable *> *l) override;
std::vector<const VariableValue *> *l) override;
private:
pthread_mutex_t m_lock;

View File

@@ -22,7 +22,7 @@
#include <string>
#include <memory>
#include "modsecurity/collection/variable.h"
#include "modsecurity/variable_value.h"
#include "src/utils/regex.h"
#undef LMDB_STDOUT_COUT

View File

@@ -34,7 +34,7 @@
#include <fcntl.h>
#include <pthread.h>
#include "modsecurity/collection/variable.h"
#include "modsecurity/variable_value.h"
#include "modsecurity/collection/collection.h"
#ifndef SRC_COLLECTION_BACKEND_LMDB_H_

View File

@@ -24,7 +24,7 @@
#include <vector>
#endif
#include "modsecurity/collection/variable.h"
#include "modsecurity/variable_value.h"
#include "modsecurity/collection/collection.h"
#include "src/collection/backend/in_memory-per_process.h"
#include "src/utils/string.h"