From 0cb94cd0c167ab0bf7940de10ba0075a20eac064 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 12 Oct 2010 09:58:07 +0200 Subject: implement optional deep copy for CssPropertyList --- src/css.hh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/css.hh') diff --git a/src/css.hh b/src/css.hh index 1ed8c39b..4ed854d1 100644 --- a/src/css.hh +++ b/src/css.hh @@ -304,10 +304,25 @@ class CssPropertyList : public lout::misc::SimpleVector { refCount = 0; this->ownerOfStrings = ownerOfStrings; }; - inline CssPropertyList(const CssPropertyList &p) : + inline CssPropertyList(const CssPropertyList &p, bool deep = false) : lout::misc::SimpleVector (p) { refCount = 0; - ownerOfStrings = false; + if (deep) { + for (int i = 0; i < size (); i++) { + CssProperty *p = getRef(i); + switch (p->type) { + case CSS_TYPE_STRING: + case CSS_TYPE_SYMBOL: + p->value.strVal = dStrdup (p->value.strVal); + break; + default: + break; + } + } + ownerOfStrings = true; + } else { + ownerOfStrings = false; + } }; ~CssPropertyList (); -- cgit v1.2.3