Sprint 2 Step 5: JSON serialization with nlohmann/json
toJson(ASTNode*) recursively serializes the AST to JSON with id, concept, properties, and children structure. Added childRoles() to ASTNode for enumeration. FetchContent pulls nlohmann/json v3.11.3. Test serializes the full Calculator model and verifies every node in the JSON output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,15 @@ public:
|
||||
return it != children_.end() ? it->second : empty;
|
||||
}
|
||||
|
||||
// Get all child role names
|
||||
std::vector<std::string> childRoles() const {
|
||||
std::vector<std::string> roles;
|
||||
for (const auto& [role, _] : children_) {
|
||||
roles.push_back(role);
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
|
||||
// Get all children across all roles
|
||||
std::vector<ASTNode*> allChildren() const {
|
||||
std::vector<ASTNode*> result;
|
||||
|
||||
Reference in New Issue
Block a user