Mercurial > octave-nkf
comparison src/graphics.h.in @ 7850:56254a8d4d59
Smarter reference counting in base_property.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Fri, 29 Feb 2008 17:49:00 +0100 |
parents | 3249f64f69b2 |
children | 228858e69bd1 |
comparison
equal
deleted
inserted
replaced
7849:3249f64f69b2 | 7850:56254a8d4d59 |
---|---|
345 { | 345 { |
346 public: | 346 public: |
347 friend class property; | 347 friend class property; |
348 | 348 |
349 public: | 349 public: |
350 base_property (void) : count (0) { } | 350 base_property (void) : count (1) { } |
351 | 351 |
352 base_property (const std::string& s, const graphics_handle& h) | 352 base_property (const std::string& s, const graphics_handle& h) |
353 : count (0), name (s), parent (h), hidden (false) { } | 353 : count (1), name (s), parent (h), hidden (false) { } |
354 | 354 |
355 base_property (const base_property& p) | 355 base_property (const base_property& p) |
356 : count (0), name (p.name), parent (p.parent), hidden (p.hidden) { } | 356 : count (1), name (p.name), parent (p.parent), hidden (p.hidden) { } |
357 | 357 |
358 virtual ~base_property (void) { } | 358 virtual ~base_property (void) { } |
359 | 359 |
360 bool ok (void) const { return parent.ok (); } | 360 bool ok (void) const { return parent.ok (); } |
361 | 361 |
1087 | 1087 |
1088 class property | 1088 class property |
1089 { | 1089 { |
1090 public: | 1090 public: |
1091 property (void) : rep (new base_property ("", graphics_handle ())) | 1091 property (void) : rep (new base_property ("", graphics_handle ())) |
1092 { rep->count++; } | 1092 { } |
1093 | 1093 |
1094 property (base_property *bp, bool persist = false) : rep (bp) | 1094 property (base_property *bp, bool persist = false) : rep (bp) |
1095 { rep->count++; if (persist) rep->count++; } | 1095 { if (persist) rep->count++; } |
1096 | 1096 |
1097 property (const property& p) | 1097 property (const property& p) |
1098 { | 1098 { |
1099 rep = p.rep; | 1099 rep = p.rep; |
1100 rep->count++; | 1100 rep->count++; |