@@ -38,8 +38,8 @@ String version = appSettings.getProperty("version", "unknown");
3838bool debugMode = appSettings.getProperty("debug", false);
3939int maxConn = appSettings.getProperty("maxConnections", 50);
4040
41- DBG ("App version: " << version);
42- DBG ("Debug mode: " << (debugMode ? "enabled" : "disabled"));
41+ YUP_DBG ("App version: " << version);
42+ YUP_DBG ("Debug mode: " << (debugMode ? "enabled" : "disabled"));
4343```
4444
4545### Working with Child Nodes
@@ -68,8 +68,8 @@ if (foundServer.isValid())
6868// Iterate over children
6969for (const auto& child : appSettings)
7070{
71- DBG ("Child type: " << child.getType().toString());
72- DBG ("Properties: " << child.getNumProperties());
71+ YUP_DBG ("Child type: " << child.getType().toString());
72+ YUP_DBG ("Properties: " << child.getNumProperties());
7373}
7474```
7575
@@ -271,7 +271,7 @@ auto firstEnabledButton = DataTreeQuery::from(appRoot)
271271
272272if (firstEnabledButton.isValid())
273273{
274- DBG ("First enabled button: " << firstEnabledButton.getProperty("text").toString());
274+ YUP_DBG ("First enabled button: " << firstEnabledButton.getProperty("text").toString());
275275}
276276```
277277
@@ -316,7 +316,7 @@ if (firstButton.isValid())
316316 auto siblings = DataTreeQuery::from(firstButton)
317317 .siblings()
318318 .nodes();
319- DBG ("Button has " << siblings.size() << " siblings");
319+ YUP_DBG ("Button has " << siblings.size() << " siblings");
320320}
321321```
322322
@@ -377,7 +377,7 @@ auto buttonTexts = DataTreeQuery::from(appRoot)
377377
378378for (const String& text : buttonTexts)
379379{
380- DBG ("Button text: " << text);
380+ YUP_DBG ("Button text: " << text);
381381}
382382
383383// Extract multiple properties from windows
@@ -397,7 +397,7 @@ auto buttonInfo = DataTreeQuery::from(appRoot)
397397
398398for (const String& info : buttonInfo)
399399{
400- DBG ("Button info: " << info);
400+ YUP_DBG ("Button info: " << info);
401401}
402402```
403403
@@ -588,7 +588,7 @@ auto buttonsByState = DataTreeQuery::from(appRoot)
588588
589589for (const auto& [state, buttons] : buttonsByState)
590590{
591- DBG (state.toString() << ": " << buttons.size() << " buttons");
591+ YUP_DBG (state.toString() << ": " << buttons.size() << " buttons");
592592}
593593
594594// Group panels by width ranges
@@ -695,18 +695,18 @@ However, there are still important validation patterns to follow:
695695auto result = DataTreeQuery::xpath(appRoot, " //Invalid[Syntax" );
696696if (result.empty())
697697{
698- DBG ("Query returned no results (possibly due to syntax error)");
698+ YUP_DBG ("Query returned no results (possibly due to syntax error)");
699699}
700700
701701// Check for valid results
702702auto buttons = DataTreeQuery::from(appRoot).descendants(" Button" ).nodes();
703703if (buttons.empty())
704704{
705- DBG ("No buttons found");
705+ YUP_DBG ("No buttons found");
706706}
707707else
708708{
709- DBG ("Found " << buttons.size() << " buttons");
709+ YUP_DBG ("Found " << buttons.size() << " buttons");
710710}
711711
712712// Safe property access
@@ -811,7 +811,7 @@ String schemaJson = R"({
811811auto schema = DataTreeSchema::fromJsonSchemaString(schemaJson);
812812if (!schema)
813813{
814- DBG ("Failed to load schema");
814+ YUP_DBG ("Failed to load schema");
815815 return;
816816}
817817```
@@ -829,14 +829,14 @@ auto serverConfig = schema->createChildNode("AppSettings", "ServerConfig");
829829
830830// Query schema metadata
831831auto themeInfo = schema->getPropertyInfo("AppSettings", "theme");
832- DBG ("Theme type: " << themeInfo.type);
833- DBG ("Default theme: " << themeInfo.defaultValue.toString());
834- DBG ("Allowed values: " << themeInfo.enumValues.size());
832+ YUP_DBG ("Theme type: " << themeInfo.type);
833+ YUP_DBG ("Default theme: " << themeInfo.defaultValue.toString());
834+ YUP_DBG ("Allowed values: " << themeInfo.enumValues.size());
835835
836836// Check node type capabilities
837837auto childConstraints = schema->getChildConstraints("AppSettings");
838- DBG ("Max children: " << childConstraints.maxCount);
839- DBG ("Allowed child types: " << childConstraints.allowedTypes.size());
838+ YUP_DBG ("Max children: " << childConstraints.maxCount);
839+ YUP_DBG ("Allowed child types: " << childConstraints.allowedTypes.size());
840840```
841841
842842### Validated Transactions
@@ -879,12 +879,12 @@ if (childResult.wasOk())
879879auto validationResult = schema->validate (appSettings);
880880if (validationResult.failed())
881881{
882- DBG ("Validation failed: " << validationResult.getErrorMessage());
882+ YUP_DBG ("Validation failed: " << validationResult.getErrorMessage());
883883 // Handle validation errors
884884}
885885else
886886{
887- DBG ("Tree structure is valid");
887+ YUP_DBG ("Tree structure is valid");
888888 // Safe to proceed with application logic
889889}
890890```
@@ -911,13 +911,13 @@ public:
911911 {
912912 // Reading from CachedValue is fast (cached)
913913 String currentTheme = theme.get();
914- DBG ("Current theme: " << currentTheme);
914+ YUP_DBG ("Current theme: " << currentTheme);
915915
916916 // Setting triggers cache invalidation and change notifications
917917 theme.set("dark");
918918
919919 // Next read will be from cache again
920- DBG ("New theme: " << theme.get());
920+ YUP_DBG ("New theme: " << theme.get());
921921 }
922922
923923 void updateFontSize(int newSize)
@@ -999,12 +999,12 @@ public:
999999 , x(tree, "x", 0.0f)
10001000 , y(tree, "y", 0.0f)
10011001 {
1002- DBG ("Created component: " << getName());
1002+ YUP_DBG ("Created component: " << getName());
10031003 }
10041004
10051005 ~UIComponent()
10061006 {
1007- DBG ("Destroyed component: " << getName());
1007+ YUP_DBG ("Destroyed component: " << getName());
10081008 }
10091009
10101010 // Getters using CachedValue
@@ -1068,19 +1068,19 @@ protected:
10681068 // Optional: receive notifications
10691069 void newObjectAdded(UIComponent* object) override
10701070 {
1071- DBG ("UI Component added: " << object->getName());
1071+ YUP_DBG ("UI Component added: " << object->getName());
10721072 // Update UI, register callbacks, etc.
10731073 }
10741074
10751075 void objectRemoved(UIComponent* object) override
10761076 {
1077- DBG ("UI Component removed: " << object->getName());
1077+ YUP_DBG ("UI Component removed: " << object->getName());
10781078 // Clean up UI, unregister callbacks, etc.
10791079 }
10801080
10811081 void objectOrderChanged() override
10821082 {
1083- DBG ("UI Component order changed");
1083+ YUP_DBG ("UI Component order changed");
10841084 // Update rendering order, etc.
10851085 }
10861086};
@@ -1131,4 +1131,4 @@ EXPECT_EQ(200.0f, buttonObj->getX()); // CachedValue reflects change
11311131EXPECT_EQ(0, components.objects.size());
11321132```
11331133
1134- This tutorial provides a solid foundation for using the YUP DataTree system effectively. The combination of DataTree, DataTreeSchema, DataTreeQuery, DataTreeObjectList and CachedValue provides a powerful, type-safe, and efficient way to manage hierarchical data in your applications.
1134+ This tutorial provides a solid foundation for using the YUP DataTree system effectively. The combination of DataTree, DataTreeSchema, DataTreeQuery, DataTreeObjectList and CachedValue provides a powerful, type-safe, and efficient way to manage hierarchical data in your applications.
0 commit comments