#include "rewrite_options.h"
Public Member Functions | |
virtual bool | was_set () const |
void | set (const T &val) |
void | set_default (const T &val) |
const T & | value () const |
virtual void | Merge (const OptionBase *src) |
void | MergeHelper (const OptionTemplateBase *src) |
Helper class to represent an Option, whose value is held in some class T. An option is explicitly initialized with its default value, although the default value can be altered later. It keeps track of whether a value has been explicitly set (independent of whether that happens to coincide with the default value).
It can use this knowledge to intelligently merge a 'base' option value into a 'new' option value, allowing explicitly set values from 'base' to override default values from 'new'.
virtual void net_instaweb::RewriteOptions::OptionTemplateBase< T >::Merge | ( | const OptionBase * | src | ) | [inline, virtual] |
The signature of the Merge implementation must match the base-class. The caller is responsible for ensuring that only the same typed Options are compared. In RewriteOptions::Merge this is guaranteed because the vector<OptionBase*> all_options_ is sorted on option_enum(). We DCHECK that the option_enum of this and src are the same.
Implements net_instaweb::RewriteOptions::OptionBase.
Reimplemented in net_instaweb::RewriteOptions::MutexedOptionInt64MergeWithMax.
void net_instaweb::RewriteOptions::OptionTemplateBase< T >::MergeHelper | ( | const OptionTemplateBase< T > * | src | ) | [inline] |
Even if !src->was_set, the default value needs to be transferred over in case it was changed with set_default or SetDefaultRewriteLevel.