gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/rtmp r9724: add support for removing thing


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r9724: add support for removing things from the cache.
Date: Wed, 12 Nov 2008 19:08:11 -0700
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9724
committer: address@hidden
branch nick: rtmp
timestamp: Wed 2008-11-12 19:08:11 -0700
message:
  add support for removing things from the cache.
modified:
  libnet/cache.cpp
  libnet/cache.h
=== modified file 'libnet/cache.cpp'
--- a/libnet/cache.cpp  2008-11-13 01:13:57 +0000
+++ b/libnet/cache.cpp  2008-11-13 02:08:11 +0000
@@ -53,9 +53,50 @@
 }
 
 void
+Cache::removePath(const std::string &name)
+{
+//    GNASH_REPORT_FUNCTION;
+    map<string, string>::iterator it;
+    for (it = _pathnames.begin(); it != _pathnames.end(); it++) {
+        cerr << name << " : " << it->first << " : " << it->second << endl;
+       if (it->first == name) {
+            cerr << "Matched!" << endl;
+            _pathnames.erase(it);
+            break;
+       }
+    }
+}
+
+void
+Cache::removeResponse(const std::string &name)
+{
+//    GNASH_REPORT_FUNCTION;
+    map<string, string>::iterator it;
+    for (it = _responses.begin(); it != _responses.end(); it++) {
+       if (it->first == name) {
+            _responses.erase(it);
+            break;
+       }
+    }
+}
+
+void
+Cache::removeFile(const std::string &name)
+{
+//    GNASH_REPORT_FUNCTION;
+    map<string, DiskStream *>::iterator it;
+    for (it = _files.begin(); it != _files.end(); it++) {
+//        DiskStream *ds = it->second;
+       if (it->first == name) {
+            _files.erase(it);
+             break;
+       }
+    }
+}
+
+void
 Cache::dump(std::ostream& os) const
-{
-    
+{    
 //    GNASH_REPORT_FUNCTION;
     
 //    boost::mutex::scoped_lock lock(cache_mutex);

=== modified file 'libnet/cache.h'
--- a/libnet/cache.h    2008-11-13 01:13:57 +0000
+++ b/libnet/cache.h    2008-11-13 02:08:11 +0000
@@ -41,12 +41,17 @@
     ~Cache();
     
     void addPath(const std::string &name, const std::string &fullpath) { 
_pathnames[name] = fullpath; };
+    std::string &findPath(const std::string &name) { return _pathnames[name]; 
};
+    void removePath(const std::string &name);
+
     void addResponse(const std::string &name, const std::string &response) { 
_responses[name] = response; };
+    void removeResponse(const std::string &name);
+
+    std::string &findResponse(const std::string &name) { return 
_responses[name]; };
+
     void addFile(const std::string &name, DiskStream *file) { _files[name] = 
file; };
-
-    std::string &findPath(const std::string &name) { return _pathnames[name]; 
};
-    std::string &findResponse(const std::string &name) { return 
_responses[name]; };
     DiskStream *findFile(const std::string &name) { return _files[name]; };
+    void removeFile(const std::string &name);
 
     ///  \brief Dump the internal data of this class in a human readable form.
     /// @remarks This should only be used for debugging purposes.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]