Add comprehensive IDataTree configuration system with advanced features

## Configuration System Implementation

### Core Interfaces Created:
- `IDataTree.h` - Root container with manual hot-reload capabilities
- `IDataNode.h` - Hierarchical nodes with data blobs and advanced querying
- `DataTreeFactory.h` - Factory pattern for flexible data source creation

### Key Features:
- **Hybrid Node Design**: Each node can have both children AND its own data blob
- **Pattern Matching**: Wildcard support (`component*`, `*heavy*`) for flexible searches
- **Property Queries**: Lambda predicate-based filtering by property values
- **Hash System**: SHA256 hashing for validation and synchronization (data-only and recursive)
- **Type-Safe Access**: Getters with default values for int/double/string/bool
- **Manual Hot-Reload**: Check for changes and reload on demand with callbacks

### Window Positioning Fixes:
- Fixed ImGuiUI window overlaps by using actual window edge calculations
- Eliminated infinite recursion in `calculateDockedPosition()`

### Code Standards:
- Added AUTO keyword prohibition to CLAUDE.md
- Explicit types required throughout codebase

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
StillHammer 2025-09-27 10:44:32 +08:00
parent f6c3b3430d
commit b3fe1000c0

102
auto_keyword_usage.txt Normal file
View File

@ -0,0 +1,102 @@
AUTO KEYWORD USAGE REPORT
==========================
This file lists all instances of the 'auto' keyword found in the codebase.
According to CLAUDE.md, the auto keyword is STRICTLY FORBIDDEN in this codebase.
TOTAL INSTANCES FOUND: 165
VIOLATIONS IN PROJECT CODE (NON-EXTERNAL):
===========================================
src/core/src/ImGuiUI.cpp:
Line 51: auto size_config = config["size"];
Line 67: auto min_config = config["min_size"];
Line 83: auto max_config = config["max_size"];
Line 116: auto it = windows.find(windowId);
Line 124: auto it = windows.find(windowId);
Line 143: for (const auto& [id, win] : windows) {
Line 158: for (const auto& [id, win_state] : state["windows"].items()) {
Line 159: auto it = windows.find(id);
Line 161: auto& win = it->second;
Line 165: auto size_state = win_state["size"];
Line 173: auto pos_state = win_state["position"];
Line 203: for (const auto& [item, price] : content["prices"].items()) {
Line 255: auto chunk = content["current_chunk"];
Line 325: for (const auto& item : content["items"]) {
Line 347: for (const auto& log : content["logs"]) {
Line 408: for (const auto& [company_name, company_data] : content.items()) {
Line 429: for (const auto& alert : content["urgent_alerts"]) {
Line 440: for (const auto& warning : content["warnings"]) {
Line 463: auto graphics = content["graphics"];
Line 480: auto audio = content["audio"];
Line 515: for (const auto& log_msg : log_messages) {
Line 516: auto duration = log_msg.timestamp.time_since_epoch();
Line 517: auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count() % 100000;
src/core/include/warfactory/ImGuiUI.h:
Line 132: auto window_size = config.value("window_size", json{{"width", 1400}, {"height", 900}});
Line 338: auto dock_it = docks.find(win.parent);
Line 372: for (auto& [dock_id, dock] : docks) {
Line 378: for (auto& [window_id, win] : windows) {
Line 424: for (auto& [window_id, win] : windows) {
Line 550: auto size_config = window_config["size"];
Line 553: auto width_val = size_config["width"];
Line 578: auto height_val = size_config["height"];
Line 597: auto min_config = window_config["min_size"];
Line 613: auto max_config = window_config["max_size"];
Line 645: auto pos = window_config["position"];
src/client/modules/client-ui/test_simulated_graphics_hot_reload.cpp:
Line 121: auto windows = saved_state["graphics_context"]["windows"];
Line 122: for (auto& [window_name, window_data] : windows.items()) {
Line 123: auto pos = window_data["pos"];
src/client/modules/client-ui/tests/ClientUITest.cpp:
Line 15: auto state = ui.getState();
Line 38: auto state = ui.getState();
Line 82: auto state1 = ui.getState();
Line 90: auto state2 = ui2.getState();
Line 111: auto state = ui.getState();
src/client/modules/client-ui/tests/ClientUISimulatedTest.cpp:
Line 77: auto final_state = clientUI.getState();
src/client/modules/client-ui/src/main.cpp:
Line 72: auto state = clientUI.getState();
src/client/modules/client-ui/src/ClientUIModuleSimulatedGL.cpp:
Line 106: auto now = std::chrono::steady_clock::now();
Line 107: auto delta = std::chrono::duration_cast<std::chrono::milliseconds>(now - last_render).count();
Line 163: auto windows = state["windows"];
Line 171: auto pos = state["positions"];
Line 228: for (auto it = window_state.log_messages.rbegin(); it != window_state.log_messages.rend() && shown < 3; ++it, ++shown) {
Line 271: for (const auto& [company_id, company_data] : window_state.macroentity_data.items()) {
test_imgui_ui.cpp:
Line 11: << " --headless Run in headless mode (auto-exit after 3s test)\n"
Line 13: << " --interactive Run interactively (no auto-exit) [DEFAULT]\n"
NOTE: These are in help text strings, not actual auto keyword usage
EXTERNAL LIBRARY USAGE (DO NOT MODIFY):
======================================
external/windows_deps/glfw-3.3.8.bin.WIN64/include/GLFW/glfw3.h:
Line 821: /*! @brief Window auto-iconification window hint and attribute
Line 823: * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and
NOTE: These are in comments/documentation, not actual auto keyword usage
external/nlohmann/json.hpp:
[127 instances of auto keyword - this is an external library and should not be modified]
SUMMARY:
========
- CRITICAL VIOLATIONS: 53 instances in project code that violate the auto keyword prohibition
- All violations are in UI-related files (ImGuiUI.cpp, ImGuiUI.h, and client-ui modules)
- External libraries (nlohmann/json.hpp, GLFW) contain auto usage but should not be modified
- Two instances in test_imgui_ui.cpp are false positives (in help text strings)
RECOMMENDATION:
===============
All 53 instances of auto keyword usage in project code must be replaced with explicit types
to comply with the CLAUDE.md coding standards.