Project

General

Profile

Actions

Feature #3217

closed

Virtual functions to allow shared memory for WCssRule and WTemplate

Added by Saif Rehman almost 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Roel Standaert
Target version:
Start date:
05/27/2014
Due date:
% Done:

0%

Estimated time:

Description

Hi,

To prevent WCssRule and WTemplate storing the same strings in every new application, I created a memory database to share the strings between sessions.

Although WCssRule has a virtual WCssRule::declarations(), I suggest making WCssRule::selector() and WTemplate::templateText() virtual too so that the developer can have complete control on how the strings are stored and retrieved.

Actions #1

Updated by Saif Rehman almost 10 years ago

Or maybe an abstract class for WTemplate?

Actions #2

Updated by Koen Deforche almost 10 years ago

  • Status changed from New to InProgress
  • Assignee set to Roel Standaert
  • Target version set to 3.3.4

Hey, I agree with the suggestion to make both methods virtual (and change the signature not to return a const ref, but return the string by value). Also make sure that the class itself uses the accessor method instead of the member variable directly.

Actions #3

Updated by Saif Rehman almost 10 years ago

Just a little more information.

The purpose of this feature request is to minimize memory overhead by storing all rules and templates in backend database tables(I'm using different tables for templates and rules). Instead of loading the selector/declarations strings for each rule in every session, I'm using a derived class called DboCssRule which stores a Dbo::ptr to that rule so the strings can be shared between sessions.

For minimizing template/language strings, I don't know how Wt's tr() function stores the strings so I can't suggest a solution for weather modifying tr() or WTemplate. Maybe there should be a way we can manage how tr() stores the strings. I want to store the strings using Dbo::ptr to share the strings between sessions.

Actions #4

Updated by Roel Standaert almost 10 years ago

  • Status changed from InProgress to Resolved
Actions #5

Updated by Koen Deforche almost 10 years ago

Hey Saif,

WString::tr() does not actually store the value --- the value itself is always requested from WLocalizedStrings which you can reimplement to cope with different trade-offs.

Regards,

koen

Actions #6

Updated by Saif Rehman almost 10 years ago

Constructor without selector

WCssRule::WCssRule(WObject* parent)
  : WObject(parent),
    sheet_(0)
{ }
Actions #7

Updated by Koen Deforche over 9 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF