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)
 
 Attribute (TSplineType st)
 
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
 
TSplineType splineType () const
 
bool operator== (const Attribute &rhs) const
 
bool operator!= (const Attribute &rhs) const
 
bool isArcArrow () const
 
bool isMidArrow () 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

◆ Attribute() [1/13]

ipe::Attribute::Attribute ( )
inlineexplicit

◆ Attribute() [2/13]

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

Create an attribute with string value.

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

◆ Attribute() [3/13]

Attribute::Attribute ( Fixed  value)
explicit

Create an absolute numeric attribute.

References ipe::Fixed::internal().

◆ Attribute() [4/13]

Attribute::Attribute ( Color  color)
explicit

Create an attribute with absolute color.

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

◆ Attribute() [5/13]

ipe::Attribute::Attribute ( THorizontalAlignment  align)
inlineexplicit

◆ Attribute() [6/13]

ipe::Attribute::Attribute ( TVerticalAlignment  align)
inlineexplicit

◆ Attribute() [7/13]

ipe::Attribute::Attribute ( TLineJoin  join)
inlineexplicit

◆ Attribute() [8/13]

ipe::Attribute::Attribute ( TLineCap  cap)
inlineexplicit

◆ Attribute() [9/13]

ipe::Attribute::Attribute ( TFillRule  rule)
inlineexplicit

◆ Attribute() [10/13]

ipe::Attribute::Attribute ( TPinned  pin)
inlineexplicit

◆ Attribute() [11/13]

ipe::Attribute::Attribute ( TTransformations  trans)
inlineexplicit

◆ Attribute() [12/13]

ipe::Attribute::Attribute ( TPathMode  pm)
inlineexplicit

◆ Attribute() [13/13]

ipe::Attribute::Attribute ( TSplineType  st)
inlineexplicit

Member Function Documentation

◆ Boolean()

static Attribute ipe::Attribute::Boolean ( bool  flag)
inlinestatic

◆ isSymbolic()

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

◆ isString()

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

Is it an absolute string value?

Referenced by ipe::Object::setCustom(), and string().

◆ isColor()

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

Is it a color?

Referenced by color(), ipe::ImlParser::parseStyle(), and string().

◆ isNumber()

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

◆ isEnum()

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

◆ isBoolean()

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

Is it a boolean?

References index(), and isEnum().

◆ isNormal()

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

◆ index()

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

◆ internal()

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

◆ string()

String Attribute::string ( ) const

◆ number()

Fixed Attribute::number ( ) const

◆ color()

Color Attribute::color ( ) const

◆ boolean()

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

◆ horizontalAlignment()

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

References index().

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

◆ verticalAlignment()

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

References index().

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

◆ lineJoin()

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

References index().

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

◆ lineCap()

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

References index().

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

◆ fillRule()

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

References index().

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

◆ pinned()

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

References index().

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

◆ transformations()

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

References index().

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

◆ pathMode()

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

References index().

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

◆ splineType()

TSplineType ipe::Attribute::splineType ( ) const
inline

References index().

◆ 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 ( )
inlinestatic

◆ WHITE()

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

Create absolute white color.

References Attribute().

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

◆ ONE()

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

Create absolute number one.

References Attribute().

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

◆ NORMAL()

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

◆ UNDEFINED()

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

◆ BACKGROUND()

static Attribute ipe::Attribute::BACKGROUND ( )
inlinestatic

Create symbolic attribute "Background".

References Attribute().

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

◆ SYM_STROKE()

static Attribute ipe::Attribute::SYM_STROKE ( )
inlinestatic

Create symbolic attribute "sym-stroke".

References Attribute().

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

◆ SYM_FILL()

static Attribute ipe::Attribute::SYM_FILL ( )
inlinestatic

Create symbolic attribute "sym-fill".

References Attribute().

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

◆ SYM_PEN()

static Attribute ipe::Attribute::SYM_PEN ( )
inlinestatic

Create symbolic attribute "sym-pen".

References Attribute().

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

◆ ARROW_NORMAL()

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

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

References Attribute().

Referenced by ipe::AllAttributes::AllAttributes().

◆ OPAQUE()

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

◆ ARROW_ARC()

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

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

References Attribute().

◆ ARROW_FARC()

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

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

References Attribute().

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

◆ ARROW_PTARC()

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

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

References Attribute().

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

◆ ARROW_FPTARC()

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

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

References Attribute().

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

◆ isMidArrow()

bool Attribute::isMidArrow ( ) const

Is it a symbolic arrow name of the form "arrow/mid-*"?

References ipe::String::hasPrefix(), isSymbolic(), and string().

Referenced by ipe::Path::setArrow(), ipe::Path::setAttribute(), and ipe::Path::setRarrow().

◆ 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 Attribute(), 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 Attribute(), and 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 Attribute(), 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 Attribute(), 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 Attribute(), BLACK(), ipe::EAngleSize, ipe::EArrowSize, ipe::EColor, ipe::EDashStyle, ipe::EGridSize, ipe::EOpacity, ipe::EPen, ipe::ESymbolSize, ipe::ETextSize, ipe::ETextStretch, ipe::ETextStyle, NORMAL(), and ONE().

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: