mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-05 03:04:52 +00:00
Implement C++ daemon with CMake, Ninja build system
Created complete C++ implementation: - Core library (client, errors, capabilities) - Query engine (AST, builder, normalizer) - Utilities (UUID generation, exponential backoff) - SQLite adapter and connection pool - Daemon server with security manager - Unit, integration, and conformance tests Build system: - CMakeLists.txt with optional Conan dependencies - Renamed build assistant to .cjs for ES module compatibility - Fixed conanfile.txt format for Conan 2.x - All tests passing, daemon runs successfully Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace dbal {
|
||||
namespace query {
|
||||
|
||||
enum class NodeType {
|
||||
Select,
|
||||
Insert,
|
||||
Update,
|
||||
Delete,
|
||||
Where,
|
||||
Join,
|
||||
OrderBy,
|
||||
Limit
|
||||
};
|
||||
|
||||
class ASTNode {
|
||||
public:
|
||||
NodeType type;
|
||||
std::string value;
|
||||
std::vector<std::shared_ptr<ASTNode>> children;
|
||||
|
||||
ASTNode(NodeType t, const std::string& v = "") : type(t), value(v) {}
|
||||
|
||||
void addChild(std::shared_ptr<ASTNode> child) {
|
||||
children.push_back(child);
|
||||
}
|
||||
};
|
||||
|
||||
class AST {
|
||||
public:
|
||||
std::shared_ptr<ASTNode> root;
|
||||
|
||||
AST() : root(nullptr) {}
|
||||
explicit AST(std::shared_ptr<ASTNode> r) : root(r) {}
|
||||
|
||||
std::string toString() const {
|
||||
if (!root) return "";
|
||||
return nodeToString(root);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string nodeToString(const std::shared_ptr<ASTNode>& node) const {
|
||||
if (!node) return "";
|
||||
|
||||
std::string result = node->value;
|
||||
for (const auto& child : node->children) {
|
||||
result += " " + nodeToString(child);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user