libetonyek::KEYStyleContext Class Reference documentation

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Types | Private Attributes | List of all members
libetonyek::KEYStyleContext Class Reference

Representation of a dynamic inheritance of styles. More...

`#include <KEYStyleContext.h>`

## Public Member Functions
| KEYStyleContext ()
| Construct an empty context. More...
void | push (const KEYStylePtr_t &style)
| Push a style onto the active styles stack. More...
void | pop ()
| Pop a style from the active styles stack. More...
boost::any | find (const std::string &property, bool lookInParent=false) const
| Find the current value of property `property`. More...

## Private Types
typedef std::deque< KEYStylePtr_t > | Stack_t
| The internal type of style stack. More...

## Private Attributes
Stack_t | m_stack

## Detailed Description

Representation of a dynamic inheritance of styles.

A static inheritance of styles is represented by the "parent" relation of styles. A dynamic inheritance is defined by the way styles are applied on elements. One or more styles may be active at any given moment (e.g., a character style of a text span and a paragraph style of the paragraph) and a property can be inherited from the enclosing style.

The property getters in specific implementations of `KEYStyle` should take a pointer to a `KEYStyleContext`.

## Member Typedef Documentation

typedef std::deque<KEYStylePtr_t> libetonyek::KEYStyleContext::Stack_t
| private

The internal type of style stack.

`std::deque` is used instead of `std::stack` because `std::stack` does not allow iteration through the elements.

## Constructor & Destructor Documentation

libetonyek::KEYStyleContext::KEYStyleContext | ( |  | ) |

Construct an empty context.

## Member Function Documentation

boost::any libetonyek::KEYStyleContext::find | ( | const std::string & | property,
|  | bool | lookInParent = `false`
| ) |  | const

Find the current value of property `property`.

The search traverses the stack of active styles from top to bottom. The search ends if `property` is found or if bottom is reached.

- [in] property the property to look for
- [in] lookInParent should the parent styles of the active styles be included in the search too?
  Returns
    the found value or empty value
  KEYPropertyMap::get

Referenced by libetonyek::KEYStyleBase::lookup().

void libetonyek::KEYStyleContext::pop | ( |  | ) |

Pop a style from the active styles stack.

Referenced by libetonyek::KEYOutput::~KEYOutput().

void libetonyek::KEYStyleContext::push | ( | const KEYStylePtr_t & | style | ) |

Push a style onto the active styles stack.

The previous top style becomes a dynamic parent `style`.

- [in] style the style to push

Referenced by libetonyek::KEYOutput::KEYOutput().

## Member Data Documentation

Stack_t libetonyek::KEYStyleContext::m_stack
| private

Referenced by find(), pop(), and push().

The documentation for this class was generated from the following files:

- KEYStyleContext.h
- KEYStyleContext.cpp