Reformat Zeek in Spicy style

This largely copies over Spicy's `.clang-format` configuration file. The
one place where we deviate is header include order since Zeek depends on
headers being included in a certain order.
This commit is contained in:
Benjamin Bannier 2023-10-10 21:13:34 +02:00
parent 7b8e7ed72c
commit f5a76c1aed
786 changed files with 131714 additions and 153609 deletions

View file

@ -11,45 +11,41 @@
#include "zeek/logging/WriterBackend.h"
#include "zeek/threading/formatters/Ascii.h"
namespace zeek::logging::writer::detail
{
namespace zeek::logging::writer::detail {
class SQLite : public WriterBackend
{
class SQLite : public WriterBackend {
public:
explicit SQLite(WriterFrontend* frontend);
~SQLite() override;
explicit SQLite(WriterFrontend* frontend);
~SQLite() override;
static WriterBackend* Instantiate(WriterFrontend* frontend) { return new SQLite(frontend); }
static WriterBackend* Instantiate(WriterFrontend* frontend) { return new SQLite(frontend); }
protected:
bool DoInit(const WriterInfo& info, int arg_num_fields,
const threading::Field* const* arg_fields) override;
bool DoWrite(int num_fields, const threading::Field* const* fields,
threading::Value** vals) override;
bool DoSetBuf(bool enabled) override { return true; }
bool DoRotate(const char* rotated_path, double open, double close, bool terminating) override;
bool DoFlush(double network_time) override { return true; }
bool DoFinish(double network_time) override { return true; }
bool DoHeartbeat(double network_time, double current_time) override { return true; }
bool DoInit(const WriterInfo& info, int arg_num_fields, const threading::Field* const* arg_fields) override;
bool DoWrite(int num_fields, const threading::Field* const* fields, threading::Value** vals) override;
bool DoSetBuf(bool enabled) override { return true; }
bool DoRotate(const char* rotated_path, double open, double close, bool terminating) override;
bool DoFlush(double network_time) override { return true; }
bool DoFinish(double network_time) override { return true; }
bool DoHeartbeat(double network_time, double current_time) override { return true; }
private:
bool checkError(int code);
bool checkError(int code);
int AddParams(threading::Value* val, int pos);
std::string GetTableType(int, int);
int AddParams(threading::Value* val, int pos);
std::string GetTableType(int, int);
const threading::Field* const* fields; // raw mapping
unsigned int num_fields;
const threading::Field* const* fields; // raw mapping
unsigned int num_fields;
sqlite3* db;
sqlite3_stmt* st;
sqlite3* db;
sqlite3_stmt* st;
std::string set_separator;
std::string unset_field;
std::string empty_field;
std::string set_separator;
std::string unset_field;
std::string empty_field;
threading::formatter::Ascii* io;
};
threading::formatter::Ascii* io;
};
} // namespace zeek::logging::writer::detail
} // namespace zeek::logging::writer::detail