[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/PropertyList.cpp server/...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/PropertyList.cpp server/... |
Date: |
Fri, 08 Dec 2006 15:50:11 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/12/08 15:50:11
Modified files:
. : ChangeLog
server : PropertyList.cpp PropertyList.h
testsuite/server: PropertyListTest.cpp
Log message:
* server/PropertyList.{cpp,h}: added delProperty() member.
* testsuite/server/PropertyListTest.cpp: added test for
delProperty().
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1895&r2=1.1896
http://cvs.savannah.gnu.org/viewcvs/gnash/server/PropertyList.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/PropertyList.h?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/PropertyListTest.cpp?cvsroot=gnash&r1=1.8&r2=1.9
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1895
retrieving revision 1.1896
diff -u -b -r1.1895 -r1.1896
--- ChangeLog 8 Dec 2006 15:45:42 -0000 1.1895
+++ ChangeLog 8 Dec 2006 15:50:11 -0000 1.1896
@@ -1,5 +1,10 @@
2006-12-08 Sandro Santilli <address@hidden>
+ * server/PropertyList.{cpp,h}: added delProperty() member.
+ * testsuite/server/PropertyListTest.cpp: added test for delProperty().
+
+2006-12-08 Sandro Santilli <address@hidden>
+
* server/as_prop_flags.h: added methods for
clearing flags, encoded bit values in an enum,
better documentation and implementation cleanup.
Index: server/PropertyList.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/PropertyList.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/PropertyList.cpp 29 Oct 2006 18:34:11 -0000 1.5
+++ server/PropertyList.cpp 8 Dec 2006 15:50:11 -0000 1.6
@@ -132,6 +132,19 @@
return it->second;
}
+bool
+PropertyList::delProperty(const std::string& key)
+{
+ iterator it=find(key);
+ if ( it == end() ) return false;
+
+ // check if member is protected from deletion
+ if ( it->second->getFlags().get_dont_delete() ) return false;
+
+ _props.erase(it);
+ return true;
+}
+
std::pair<size_t,size_t>
PropertyList::setFlagsAll(const PropertyList& props,
int flagsSet, int flagsClear)
Index: server/PropertyList.h
===================================================================
RCS file: /sources/gnash/gnash/server/PropertyList.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/PropertyList.h 24 Nov 2006 15:41:14 -0000 1.7
+++ server/PropertyList.h 8 Dec 2006 15:50:11 -0000 1.8
@@ -171,6 +171,18 @@
///
Property* getProperty(const std::string& key);
+ /// Delete a propery, if exising and not protected from deletion.
+ //
+ ///
+ /// @param key
+ /// Name of the property. Search is case-*sensitive*
+ ///
+ /// @return true if the property was deleted, false otherwise.
+ /// A false return might mean either that the property
+ /// was not found or that it was protected from deletion.
+ ///
+ bool delProperty(const std::string& key);
+
/// \brief
/// Add a getter/setter property, if not already existing
/// (or should we allow override ?)
Index: testsuite/server/PropertyListTest.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/server/PropertyListTest.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- testsuite/server/PropertyListTest.cpp 6 Dec 2006 15:27:56 -0000
1.8
+++ testsuite/server/PropertyListTest.cpp 8 Dec 2006 15:50:11 -0000
1.9
@@ -26,6 +26,7 @@
#include "as_value.h"
#include "log.h"
#include "smart_ptr.h"
+#include "as_prop_flags.h"
#include <iostream>
#include <sstream>
@@ -85,5 +86,21 @@
check ( props.setValue("var3", val, obj) );
check_equals(props.size(), 5);
+ // Test deletion of properties
+
+ // this succeeds
+ check(props.delProperty("var3"));
+ check_equals(props.size(), 4);
+
+ // this fails (non existent property)
+ check(!props.delProperty("non-existent"));
+ check_equals(props.size(), 4);
+
+ // Set property var2 as protected from deletion!
+ check(props.setFlags("var2", as_prop_flags::dontDelete, 0));
+ // this fails (protected from deletion)
+ check(!props.delProperty("var2"));
+ check_equals(props.size(), 4);
+
}
- [Gnash-commit] gnash ChangeLog server/PropertyList.cpp server/...,
Sandro Santilli <=