Ipelib

Public Member Functions | Static Public Member Functions | Friends | List of all members
ipe::Attribute Class Reference
Ipe Attributes

`#include <ipeattributes.h>`

## Public Member Functions
| Attribute ()
| Attribute (bool symbolic, String name)
| Attribute (Fixed value)
| Attribute (Color color)
| Attribute (THorizontalAlignment align)
| Attribute (TVerticalAlignment align)
| Attribute (TLineJoin join)
| Attribute (TLineCap cap)
| Attribute (TFillRule rule)
| Attribute (TPinned pin)
| Attribute (TTransformations trans)
| Attribute (TPathMode pm)
bool | isSymbolic () const
bool | isString () const
bool | isColor () const
bool | isNumber () const
bool | isEnum () const
bool | isBoolean () const
bool | isNormal () const
int | index () const
int | internal () const
String | string () const
Fixed | number () const
Color | color () const
bool | boolean () const
THorizontalAlignment | horizontalAlignment () const
TVerticalAlignment | verticalAlignment () const
TLineJoin | lineJoin () const
TLineCap | lineCap () const
TFillRule | fillRule () const
TPinned | pinned () const
TTransformations | transformations () const
TPathMode | pathMode () const
bool | operator== (const Attribute &rhs) const
bool | operator!= (const Attribute &rhs) const
bool | isArcArrow () const

## Static Public Member Functions
static Attribute | Boolean (bool flag)
static Attribute | BLACK ()
static Attribute | WHITE ()
static Attribute | ONE ()
static Attribute | NORMAL ()
static Attribute | UNDEFINED ()
static Attribute | BACKGROUND ()
static Attribute | SYM_STROKE ()
static Attribute | SYM_FILL ()
static Attribute | SYM_PEN ()
static Attribute | ARROW_NORMAL ()
static Attribute | OPAQUE ()
static Attribute | ARROW_ARC ()
static Attribute | ARROW_FARC ()
static Attribute | ARROW_PTARC ()
static Attribute | ARROW_FPTARC ()
static Attribute | makeColor (String str, Attribute deflt)
static Attribute | makeScalar (String str, Attribute deflt)
static Attribute | makeDashStyle (String str)
static Attribute | makeTextSize (String str)
static Attribute | normal (Kind kind)

## Friends
class | StyleSheet

## Detailed Description

An attribute of an Ipe Object.

An attribute is either an absolute value or a symbolic name that has to be looked up in a StyleSheet.

All string values are replaced by indices into a Repository (that applies both to symbolic names and to absolute values that are strings). All other values are stored directly inside the attribute, either as a Fixed or a Color.

There are five different kinds of Attribute objects:

- if isSymbolic() is true, index() returns the index into the repository, and string() returns the symbolic name.
- if isColor() is true, color() returns an absolute RGB color.
- if isNumeric() is true, number() returns an absolute scalar value.
- if isEnum() is true, the attribute represents an enumeration value.
- otherwise, isString() is true, and index() returns the index into the repository (for a string expressing the absolute value of the attribute), and string() returns the string itself.

## Constructor & Destructor Documentation

## ◆ Attribute() [1/12]

ipe::Attribute::Attribute | ( |  | ) |
| inline explicit

Default constructor.

Referenced by Attribute().

## ◆ Attribute() [2/12]

Attribute::Attribute | ( | bool | symbolic,
|  | String | name
| ) |  |
| explicit

Create an attribute with string value.

References ipe::Repository::get(), and ipe::Repository::toIndex().

## ◆ Attribute() [3/12]

Attribute::Attribute | ( | Fixed | value | ) |
| explicit

Create an absolute numeric attribute.

References ipe::Fixed::internal().

## ◆ Attribute() [4/12]

Attribute::Attribute | ( | Color | color | ) |
| explicit

Create an attribute with absolute color.

References Attribute(), ipe::Color::iBlue, ipe::Color::iGreen, ipe::Fixed::internal(), and ipe::Color::iRed.

## ◆ Attribute() [5/12]

ipe::Attribute::Attribute | ( | THorizontalAlignment | align | ) |
| inline explicit

## ◆ Attribute() [6/12]

ipe::Attribute::Attribute | ( | TVerticalAlignment | align | ) |
| inline explicit

## ◆ Attribute() [7/12]

ipe::Attribute::Attribute | ( | TLineJoin | join | ) |
| inline explicit

## ◆ Attribute() [8/12]

ipe::Attribute::Attribute | ( | TLineCap | cap | ) |
| inline explicit

## ◆ Attribute() [9/12]

ipe::Attribute::Attribute | ( | TFillRule | rule | ) |
| inline explicit

## ◆ Attribute() [10/12]

ipe::Attribute::Attribute | ( | TPinned | pin | ) |
| inline explicit

## ◆ Attribute() [11/12]

ipe::Attribute::Attribute | ( | TTransformations | trans | ) |
| inline explicit

## ◆ Attribute() [12/12]

ipe::Attribute::Attribute | ( | TPathMode | pm | ) |
| inline explicit

## Member Function Documentation

## ◆ Boolean()

static Attribute ipe::Attribute::Boolean | ( | bool | flag | ) |
| inline static

Referenced by ipe::Text::getAttribute(), and ipe::Path::getAttribute().

## ◆ isSymbolic()

bool ipe::Attribute::isSymbolic | ( |  | ) | const
| inline

Is it symbolic?

Referenced by ipe::StyleSheet::add(), ipe::StyleSheet::addEffect(), ipe::StyleSheet::addGradient(), ipe::StyleSheet::addSymbol(), ipe::StyleSheet::addTiling(), ipe::Object::checkSymbol(), ipe::StyleSheet::find(), ipe::Cascade::findDefinition(), ipe::StyleSheet::findEffect(), ipe::StyleSheet::findGradient(), ipe::StyleSheet::findSymbol(), ipe::StyleSheet::findTiling(), ipe::StyleSheet::has(), ipe::ImlParser::parseStyle(), and ipe::Page::setEffect().

## ◆ isString()

bool ipe::Attribute::isString | ( |  | ) | const
| inline

Is it an absolute string value?

## ◆ isColor()

bool ipe::Attribute::isColor | ( |  | ) | const
| inline

Is it a color?

Referenced by ipe::ImlParser::parseStyle().

## ◆ isNumber()

bool ipe::Attribute::isNumber | ( |  | ) | const
| inline

Is it a number?

Referenced by ipe::Latex::createLatexSource(), ipe::PdfPainter::doDrawSymbol(), ipe::ImlParser::parseStyle(), and ipe::Text::setAttribute().

## ◆ isEnum()

bool ipe::Attribute::isEnum | ( |  | ) | const
| inline

Is it an enumeration?

Referenced by ipe::Text::setAttribute(), ipe::Object::setAttribute(), and ipe::Path::setAttribute().

## ◆ isBoolean()

bool ipe::Attribute::isBoolean | ( |  | ) | const
| inline

Is it a boolean?

## ◆ isNormal()

bool ipe::Attribute::isNormal | ( |  | ) | const
| inline

Is it the symbolic name "normal"?

Referenced by ipe::Path::checkStyle(), ipe::PdfWriter::createPageView(), ipe::PdfPainter::doDrawPath(), ipe::Path::draw(), ipe::PdfPainter::drawAttributes(), ipe::Reference::saveAsXml(), ipe::Group::saveAsXml(), ipe::Path::saveAsXml(), ipe::Painter::setGradient(), and ipe::Painter::setTiling().

## ◆ index()

int ipe::Attribute::index | ( |  | ) | const
| inline

Return index into Repository.

Referenced by ipe::StyleSheet::add(), ipe::StyleSheet::addEffect(), ipe::StyleSheet::addGradient(), ipe::StyleSheet::addSymbol(), ipe::StyleSheet::addTiling(), ipe::PdfPainter::doDrawPath(), ipe::PdfPainter::doDrawSymbol(), ipe::PdfPainter::drawAttributes(), ipe::StyleSheet::find(), ipe::StyleSheet::findEffect(), ipe::StyleSheet::findGradient(), ipe::StyleSheet::findSymbol(), ipe::StyleSheet::findTiling(), ipe::StyleSheet::has(), and ipe::StyleSheet::remove().

## ◆ internal()

int ipe::Attribute::internal | ( |  | ) | const
| inline

## ◆ string()

String Attribute::string | ( |  | ) | const

Return string representing the attribute.

References ipe::Repository::get(), and ipe::Repository::toString().

Referenced by ipe::Latex::createLatexSource(), ipe::Page::saveAsXml(), ipe::Image::saveAsXml(), ipe::Text::saveAsXml(), ipe::Reference::saveAsXml(), ipe::Group::saveAsXml(), ipe::Path::saveAsXml(), ipe::Painter::setDashStyle(), and ipe::Reference::setName().

## ◆ number()

Fixed Attribute::number | ( |  | ) | const

Return value of absolute numeric attribute.

References ipe::Fixed::fromInternal().

Referenced by ipe::Latex::createLatexSource(), ipe::PdfPainter::doDrawSymbol(), ipe::Reference::draw(), ipe::Path::drawArrow(), ipe::Reference::drawSimple(), ipe::Painter::Painter(), ipe::ImlParser::parseStyle(), ipe::Text::setAttribute(), ipe::Painter::setOpacity(), ipe::Painter::setPen(), ipe::Painter::setStrokeOpacity(), and ipe::Painter::setSymPen().

## ◆ color()

Color Attribute::color | ( |  | ) | const

Return absolute color.

References ipe::Fixed::fromInternal(), ipe::Color::iBlue, ipe::Color::iGreen, and ipe::Color::iRed.

Referenced by ipe::Painter::setFill(), ipe::Painter::setStroke(), ipe::Painter::setSymFill(), and ipe::Painter::setSymStroke().

## ◆ boolean()

bool ipe::Attribute::boolean | ( |  | ) | const
| inline

Referenced by ipe::Text::setAttribute(), and ipe::Path::setAttribute().

## ◆ horizontalAlignment()

THorizontalAlignment ipe::Attribute::horizontalAlignment | ( |  | ) | const
| inline

Referenced by ipe::Text::setAttribute().

## ◆ verticalAlignment()

TVerticalAlignment ipe::Attribute::verticalAlignment | ( |  | ) | const
| inline

Referenced by ipe::Text::setAttribute().

## ◆ lineJoin()

TLineJoin ipe::Attribute::lineJoin | ( |  | ) | const
| inline

Referenced by ipe::Path::setAttribute().

## ◆ lineCap()

TLineCap ipe::Attribute::lineCap | ( |  | ) | const
| inline

Referenced by ipe::Path::setAttribute().

## ◆ fillRule()

TFillRule ipe::Attribute::fillRule | ( |  | ) | const
| inline

Referenced by ipe::Path::setAttribute().

## ◆ pinned()

TPinned ipe::Attribute::pinned | ( |  | ) | const
| inline

Referenced by ipe::Object::setAttribute().

## ◆ transformations()

TTransformations ipe::Attribute::transformations | ( |  | ) | const
| inline

Referenced by ipe::Object::setAttribute().

## ◆ pathMode()

TPathMode ipe::Attribute::pathMode | ( |  | ) | const
| inline

Referenced by ipe::Path::setAttribute().

## ◆ operator==()

bool ipe::Attribute::operator== | ( | const Attribute & | rhs | ) | const
| inline

Are two values equal (only compares index!)

## ◆ operator!=()

bool ipe::Attribute::operator!= | ( | const Attribute & | rhs | ) | const
| inline

Are two values different (only compares index!)

## ◆ BLACK()

static Attribute ipe::Attribute::BLACK | ( |  | ) |
| inline static

Create absolute black color.

Referenced by normal(), ipe::ImlParser::parseStyle(), ipe::Reference::Reference(), ipe::Reference::saveAsXml(), and ipe::Text::Text().

## ◆ WHITE()

static Attribute ipe::Attribute::WHITE | ( |  | ) |
| inline static

Create absolute white color.

Referenced by ipe::Reference::Reference(), and ipe::Reference::saveAsXml().

## ◆ ONE()

static Attribute ipe::Attribute::ONE | ( |  | ) |
| inline static

Create absolute number one.

Referenced by normal(), ipe::Reference::Reference(), and ipe::Reference::saveAsXml().

## ◆ NORMAL()

static Attribute ipe::Attribute::NORMAL | ( |  | ) |
| inline static

Create symbolic attribute "normal".

Referenced by ipe::Cascade::allNames(), ipe::Group::Group(), makeDashStyle(), makeTextSize(), normal(), ipe::Painter::Painter(), ipe::ImlParser::parseStyle(), ipe::Reference::Reference(), ipe::Text::saveAsXml(), ipe::Text::setAttribute(), ipe::Path::setGradient(), ipe::Painter::setGradient(), ipe::Page::setLayerOf(), ipe::Text::setTextType(), ipe::Path::setTiling(), ipe::Painter::setTiling(), and ipe::Text::Text().

## ◆ UNDEFINED()

static Attribute ipe::Attribute::UNDEFINED | ( |  | ) |
| inline static

Create symbolic attribute "undefined".

Referenced by ipe::StyleSheet::find(), ipe::Cascade::find(), and ipe::Object::getAttribute().

## ◆ BACKGROUND()

static Attribute ipe::Attribute::BACKGROUND | ( |  | ) |
| inline static

Create symbolic attribute "Background".

Referenced by ipe::PdfWriter::createPageView(), ipe::CanvasBase::drawObjects(), ipe::Thumbnail::saveRender(), and ipe::PdfWriter::~PdfWriter().

## ◆ SYM_STROKE()

static Attribute ipe::Attribute::SYM_STROKE | ( |  | ) |
| inline static

Create symbolic attribute "sym-stroke".

Referenced by ipe::Painter::setFill(), ipe::Painter::setStroke(), ipe::Painter::setSymFill(), and ipe::Painter::setSymStroke().

## ◆ SYM_FILL()

static Attribute ipe::Attribute::SYM_FILL | ( |  | ) |
| inline static

Create symbolic attribute "sym-fill".

Referenced by ipe::Painter::setFill(), ipe::Painter::setStroke(), ipe::Painter::setSymFill(), and ipe::Painter::setSymStroke().

## ◆ SYM_PEN()

static Attribute ipe::Attribute::SYM_PEN | ( |  | ) |
| inline static

Create symbolic attribute "sym-pen".

Referenced by ipe::Painter::setPen(), and ipe::Painter::setSymPen().

## ◆ ARROW_NORMAL()

static Attribute ipe::Attribute::ARROW_NORMAL | ( |  | ) |
| inline static

Create symbolic attribute "arrow/normal(spx)".

Referenced by normal().

## ◆ OPAQUE()

static Attribute ipe::Attribute::OPAQUE | ( |  | ) |
| inline static

Create symbolic attribute "opaque".

Referenced by ipe::Image::Image(), normal(), ipe::Image::saveAsXml(), ipe::Text::saveAsXml(), ipe::Path::saveAsXml(), and ipe::Text::Text().

## ◆ ARROW_ARC()

static Attribute ipe::Attribute::ARROW_ARC | ( |  | ) |
| inline static

Create symbolic attribute "arrow/arc(spx)".

## ◆ ARROW_FARC()

static Attribute ipe::Attribute::ARROW_FARC | ( |  | ) |
| inline static

Create symbolic attribute "arrow/farc(spx)".

Referenced by ipe::Path::drawArrow().

## ◆ ARROW_PTARC()

static Attribute ipe::Attribute::ARROW_PTARC | ( |  | ) |
| inline static

Create symbolic attribute "arrow/ptarc(spx)".

Referenced by ipe::Path::drawArrow().

## ◆ ARROW_FPTARC()

static Attribute ipe::Attribute::ARROW_FPTARC | ( |  | ) |
| inline static

Create symbolic attribute "arrow/fptarc(spx)".

Referenced by ipe::Path::drawArrow().

## ◆ isArcArrow()

bool ipe::Attribute::isArcArrow | ( |  | ) | const
| inline

Is it one of the symbolic attributes "arrow/*arc(spc)"?

Referenced by ipe::Path::draw(), and ipe::Path::drawArrow().

## ◆ makeColor()

Attribute Attribute::makeColor | ( | String | str,
|  | Attribute | deflt
| ) |  |
| static

Make a color attribute.

If the string starts with a letter, make a symbolic attribute. Otherwise, it's either a single gray value (0.0 to 1.0), or the three red, green, and blue components, separated by spaces. If it's an empty string, return deflt.

References ipe::Color::Color(), and ipe::String::empty().

Referenced by ipe::ImlParser::parseStyle(), ipe::Reference::Reference(), and ipe::Text::Text().

## ◆ makeScalar()

Attribute Attribute::makeScalar | ( | String | str,
|  | Attribute | deflt
| ) |  |
| static

Make a scalar attribute.

If str is empty, simply return deflt. If str starts with a letter, make a symbolic attribute. Otherwise, must be a number.

References ipe::String::empty().

Referenced by ipe::ImlParser::parseStyle(), and ipe::Reference::Reference().

## ◆ makeDashStyle()

Attribute Attribute::makeDashStyle | ( | String | str | ) |
| static

Construct dash style attribute from string.

Strings starting with '[' create an absolute dash style. The empty string is equivalent to 'normal'. Any other string creates a symbolic dash style.

References ipe::String::empty(), and NORMAL().

Referenced by ipe::ImlParser::parseStyle().

## ◆ makeTextSize()

Attribute Attribute::makeTextSize | ( | String | str | ) |
| static

Construct text size attribute from string.

String starting with digit creates a numeric absolute value, string starting with letter creates symbolic text size, anything else creates absolute (string) text size. The empty string is treated like "normal".

References ipe::String::empty(), and NORMAL().

Referenced by ipe::ImlParser::parseStyle(), and ipe::Text::Text().

## ◆ normal()

Attribute Attribute::normal | ( | Kind | kind | ) |
| static

Return a standard value for attribute of kind.

The value is used if the stylesheet doesn't define a symbolic attribute used in the document.

References ipe::AllAttributes::AllAttributes(), ARROW_NORMAL(), BLACK(), ipe::EAlignBaseline, ipe::EAlignLeft, ipe::EAngleSize, ipe::EArrowSize, ipe::EColor, ipe::EDashStyle, ipe::EDefaultCap, ipe::EDefaultJoin, ipe::EDefaultRule, ipe::EGridSize, ipe::ENoPin, ipe::EOpacity, ipe::EPen, ipe::EStrokedOnly, ipe::ESymbolSize, ipe::ETextSize, ipe::ETextStretch, ipe::ETextStyle, ipe::ETransformationsAffine, NORMAL(), ONE(), and OPAQUE().

Referenced by ipe::Cascade::find().

## Friends And Related Function Documentation

## ◆ StyleSheet

friend class StyleSheet
| friend

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

- ipeattributes.h
- ipeattributes.cpp