]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/partcache.h
Use RAII to ensure consistent PartCache state
[libs/gltk.git] / source / partcache.h
index 969912431271d501b68267f9f09bb7b05f0427b6..4eef1166d1d9e75f0bc39bd27b087350e8cbf3c1 100644 (file)
@@ -22,6 +22,16 @@ struct CachedPart
 class PartCache
 {
 public:
+       class Rebuild
+       {
+       private:
+               PartCache &cache;
+
+       public:
+               Rebuild(PartCache &c): cache(c) { cache.begin_rebuild(); }
+               ~Rebuild() { cache.end_rebuild(); }
+       };
+
        typedef std::list<CachedPart> PartList;
 
 private: