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

#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:

Constructor & Destructor Documentation

ipe::Attribute::Attribute ( )
inlineexplicit

Default constructor.

Referenced by Attribute().

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

Create an attribute with string value.

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

Attribute::Attribute ( Fixed  value)
explicit

Create an absolute numeric attribute.

References ipe::Fixed::internal().

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.

ipe::Attribute::Attribute ( THorizontalAlignment  align)
inlineexplicit
ipe::Attribute::Attribute ( TVerticalAlignment  align)
inlineexplicit
ipe::Attribute::Attribute ( TLineJoin  join)
inlineexplicit
ipe::Attribute::Attribute ( TLineCap  cap)
inlineexplicit
ipe::Attribute::Attribute ( TFillRule  rule)
inlineexplicit
ipe::Attribute::Attribute ( TPinned  pin)
inlineexplicit
ipe::Attribute::Attribute ( TTransformations  trans)
inlineexplicit
ipe::Attribute::Attribute ( TPathMode  pm)
inlineexplicit

Member Function Documentation

static Attribute ipe::Attribute::Boolean ( bool  flag)
inlinestatic
bool ipe::Attribute::isSymbolic ( ) const
inline
bool ipe::Attribute::isString ( ) const
inline

Is it an absolute string value?

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

Is it a color?

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

bool ipe::Attribute::isNumber ( ) const
inline
bool ipe::Attribute::isEnum ( ) const
inline
bool ipe::Attribute::isBoolean ( ) const
inline

Is it a boolean?

bool ipe::Attribute::isNormal ( ) const
inline
int ipe::Attribute::index ( ) const
inline
int ipe::Attribute::internal ( ) const
inline
String Attribute::string ( ) const
Fixed Attribute::number ( ) const
Color Attribute::color ( ) const
bool ipe::Attribute::boolean ( ) const
inline
THorizontalAlignment ipe::Attribute::horizontalAlignment ( ) const
inline

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

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

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

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

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

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

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

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

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

TPinned ipe::Attribute::pinned ( ) const
inline
TTransformations ipe::Attribute::transformations ( ) const
inline
TPathMode ipe::Attribute::pathMode ( ) const
inline

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

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

Are two values equal (only compares index!)

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

Are two values different (only compares index!)

static Attribute ipe::Attribute::BLACK ( )
inlinestatic
static Attribute ipe::Attribute::WHITE ( )
inlinestatic

Create absolute white color.

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

static Attribute ipe::Attribute::ONE ( )
inlinestatic

Create absolute number one.

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

static Attribute ipe::Attribute::NORMAL ( )
inlinestatic
static Attribute ipe::Attribute::UNDEFINED ( )
inlinestatic

Create symbolic attribute "undefined".

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

static Attribute ipe::Attribute::BACKGROUND ( )
inlinestatic
static Attribute ipe::Attribute::SYM_STROKE ( )
inlinestatic
static Attribute ipe::Attribute::SYM_FILL ( )
inlinestatic
static Attribute ipe::Attribute::SYM_PEN ( )
inlinestatic

Create symbolic attribute "sym-pen".

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

static Attribute ipe::Attribute::ARROW_NORMAL ( )
inlinestatic

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

Referenced by normal().

static Attribute ipe::Attribute::OPAQUE ( )
inlinestatic

Create symbolic attribute "opaque".

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

static Attribute ipe::Attribute::ARROW_ARC ( )
inlinestatic

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

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

static Attribute ipe::Attribute::ARROW_FARC ( )
inlinestatic

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

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

static Attribute ipe::Attribute::ARROW_PTARC ( )
inlinestatic

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

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

static Attribute ipe::Attribute::ARROW_FPTARC ( )
inlinestatic

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

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

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().

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().

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().

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().

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().

Attribute Attribute::normal ( Kind  kind)
static

Friends And Related Function Documentation

friend class StyleSheet
friend

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