[Bf-blender-cvs] [ea6db832a06] functions: utility to print resource names

Jacques Lucke noreply at git.blender.org
Thu Sep 26 18:08:15 CEST 2019


Commit: ea6db832a06e52f1158c32759fb2353a4e94f22b
Author: Jacques Lucke
Date:   Thu Sep 26 18:07:59 2019 +0200
Branches: functions
https://developer.blender.org/rBea6db832a06e52f1158c32759fb2353a4e94f22b

utility to print resource names

===================================================================

M	source/blender/blenlib/BLI_owned_resources.h

===================================================================

diff --git a/source/blender/blenlib/BLI_owned_resources.h b/source/blender/blenlib/BLI_owned_resources.h
index efd226b7077..362f06227ed 100644
--- a/source/blender/blenlib/BLI_owned_resources.h
+++ b/source/blender/blenlib/BLI_owned_resources.h
@@ -3,6 +3,7 @@
 
 #include "BLI_vector.h"
 #include "BLI_utility_mixins.h"
+#include "BLI_string_ref.h"
 
 namespace BLI {
 
@@ -44,6 +45,20 @@ class OwnedResources : NonCopyable {
     };
     m_resources.append(data);
   }
+
+  void print(StringRef name) const
+  {
+    if (m_resources.size() == 0) {
+      std::cout << "\"" << name << "\" has no resources.\n";
+      return;
+    }
+    else {
+      std::cout << "Resources for \"" << name << "\":\n";
+      for (const ResourceData &data : m_resources) {
+        std::cout << "  " << data.data << ": " << data.name << '\n';
+      }
+    }
+  }
 };
 
 }  // namespace BLI



More information about the Bf-blender-cvs mailing list