aboutsummaryrefslogtreecommitdiff
path: root/src/css.hh
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-01-12 22:41:02 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-01-12 22:41:02 +0100
commit267dceefa8e4d26469d8338f980f6ba6d5dce67b (patch)
treeb4c087ea4242601e12c065fbd9ced36913526d08 /src/css.hh
parent92234fa05419829744aca6a991413f55da4548e7 (diff)
add RuleList class to implement proper memory management
Diffstat (limited to 'src/css.hh')
-rw-r--r--src/css.hh20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/css.hh b/src/css.hh
index 333b8b3d..2d4f1658 100644
--- a/src/css.hh
+++ b/src/css.hh
@@ -273,18 +273,30 @@ class CssRule {
*/
class CssStyleSheet {
private:
- class RuleMap : public lout::container::typed::HashTable <lout::object::ConstString, lout::object::Pointer > {
+ class RuleList : public lout::misc::SimpleVector <CssRule*>, public lout::object::Object {
public:
- RuleMap () : lout::container::typed::HashTable <lout::object::ConstString, lout::object::Pointer > (true, true, 256) {
+ RuleList () : lout::misc::SimpleVector <CssRule*> (1) {};
+ ~RuleList () {
+ for (int i = 0; i < size (); i++)
+ delete get (i);
+ };
+
+ bool equals (lout::object::Object *other) { return this == other; };
+ int hashValue () { return (intptr_t) this; };
+ };
+
+ class RuleMap : public lout::container::typed::HashTable <lout::object::ConstString, RuleList > {
+ public:
+ RuleMap () : lout::container::typed::HashTable <lout::object::ConstString, RuleList > (true, true, 256) {
};
};
static const int ntags = 90; // \todo replace 90
- lout::misc::SimpleVector <CssRule*> *elementTable[ntags];
+ RuleList *elementTable[ntags];
RuleMap *idTable;
RuleMap *classTable;
- lout::misc::SimpleVector <CssRule*> *anyTable;
+ RuleList *anyTable;
public:
CssStyleSheet();