Project

General

Profile

Feature #3217

Virtual functions to allow shared memory for WCssRule and WTemplate

Added by Saif Rehman about 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
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.

#1

Updated by Saif Rehman about 8 years ago

Or maybe an abstract class for WTemplate?

#2

Updated by Koen Deforche about 8 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.

#3

Updated by Saif Rehman about 8 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.

#4

Updated by Roel Standaert about 8 years ago

  • Status changed from InProgress to Resolved
#5

Updated by Koen Deforche about 8 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

#6

Updated by Saif Rehman about 8 years ago

Constructor without selector

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

Updated by Koen Deforche almost 8 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF