Ipelib
Public Types | Public Member Functions | List of all members
ipe::ImlParser Class Reference

#include <ipeiml.h>

Inherits ipe::XmlParser.

Inherited by PdfStreamParser.

Public Types

enum  Errors { ESuccess = 0 , EVersionTooOld , EVersionTooRecent , ESyntaxError }
 

Public Member Functions

 ImlParser (DataSource &source)
 
int parseDocument (Document &doc)
 
bool parsePage (Page &page)
 
bool parseView (Page &page, AttributeMap &map)
 
ObjectparseObject (String tag, Page *page=nullptr, int *currentLayer=nullptr)
 
ObjectparseObject (String tag, String &layer)
 
StyleSheetparseStyleSheet ()
 
bool parseStyle (StyleSheet &sheet)
 
PageparsePageSelection ()
 
virtual Buffer pdfStream (int objNum)
 
bool parseBitmap ()
 
- Public Member Functions inherited from ipe::XmlParser
 XmlParser (DataSource &source)
 
virtual ~XmlParser ()
 
int parsePosition () const
 
String parseToTag ()
 
bool parseAttributes (XmlAttributes &attr, bool qm=false)
 
bool parsePCDATA (String tag, String &pcdata)
 
bool isTagChar (int ch)
 
void getChar ()
 
bool eos ()
 
void skipWhitespace ()
 

Additional Inherited Members

- Protected Member Functions inherited from ipe::XmlParser
String parseToTagX ()
 
- Protected Attributes inherited from ipe::XmlParser
DataSourceiSource
 
String iTopElement
 
int iCh
 
int iPos
 

Detailed Description

XML Parser for Ipe documents and style sheets.

A recursive descent parser for the XML streams.

After experimenting with various XML parsing frameworks, this turned out to work best for Ipe.

Member Enumeration Documentation

◆ Errors

Enumerator
ESuccess 
EVersionTooOld 
EVersionTooRecent 
ESyntaxError 

Constructor & Destructor Documentation

◆ ImlParser()

ImlParser::ImlParser ( DataSource source)
explicit

Member Function Documentation

◆ parseDocument()

int ImlParser::parseDocument ( Document doc)

◆ parsePage()

bool ImlParser::parsePage ( Page page)

◆ parseView()

bool ImlParser::parseView ( Page page,
AttributeMap map 
)

◆ parseObject() [1/2]

Object * ImlParser::parseObject ( String  tag,
Page page = nullptr,
int *  currentLayer = nullptr 
)

parse an Object.

On calling, stream must be just past the tag.

References ipe::Page::countLayers(), ipe::String::empty(), and ipe::Page::layer().

Referenced by parseObject(), parsePage(), and parseStyle().

◆ parseObject() [2/2]

Object * ImlParser::parseObject ( String  tag,
String layer 
)

◆ parseStyleSheet()

StyleSheet * ImlParser::parseStyleSheet ( )

parse a complete style sheet.

On calling, stream must be before the 'ipestyle' tag. A <?xml> tag is allowed.

References ipe::XmlParser::parseAttributes(), parseStyle(), and ipe::XmlParser::parseToTag().

Referenced by ipe::StyleSheet::standard().

◆ parseStyle()

bool ImlParser::parseStyle ( StyleSheet sheet)

Parse a style sheet.

On calling, stream must be just past the style tag.

References ipe::StyleSheet::add(), ipe::StyleSheet::addEffect(), ipe::StyleSheet::addGradient(), ipe::StyleSheet::addSymbol(), ipe::StyleSheet::addTiling(), ipe::Attribute::BLACK(), ipe::Gradient::Stop::color, ipe::Angle::Degrees(), ipe::EAlignBaseline, ipe::EAlignLeft, ipe::EAngleSize, ipe::EArrowSize, ipe::Gradient::EAxial, ipe::EColor, ipe::EDashStyle, ipe::EEvenOddRule, ipe::EGridSize, ipe::Reference::EHasFill, ipe::Reference::EHasPen, ipe::Reference::EHasSize, ipe::Reference::EHasStroke, ipe::ELabelStyle, ipe::String::empty(), ipe::EOpacity, ipe::Lex::eos(), ipe::EPen, ipe::Gradient::ERadial, ipe::ESymbolSize, ipe::ETextSize, ipe::ETextStretch, ipe::ETextStyle, ipe::ETransformationsRigidMotions, ipe::ETransformationsTranslations, ipe::EWindRule, ipe::Reference::flagsFromName(), ipe::Lex::getDouble(), ipe::Lex::getInt(), ipe::XmlAttributes::has(), ipe::Tiling::iAngle, ipe::TextPadding::iBottom, ipe::StyleSheet::TitleStyle::iColor, ipe::StyleSheet::PageNumberStyle::iColor, ipe::Layout::iCrop, ipe::StyleSheet::TitleStyle::iDefined, ipe::StyleSheet::PageNumberStyle::iDefined, ipe::Effect::iDuration, ipe::Effect::iEffect, ipe::Gradient::iExtend, ipe::Layout::iFrameSize, ipe::StyleSheet::TitleStyle::iHorizontalAlignment, ipe::StyleSheet::PageNumberStyle::iHorizontalAlignment, ipe::TextPadding::iLeft, ipe::Gradient::iMatrix, ipe::Layout::iOrigin, ipe::Layout::iPaperSize, ipe::Layout::iParagraphSkip, ipe::StyleSheet::TitleStyle::iPos, ipe::StyleSheet::PageNumberStyle::iPos, ipe::Gradient::iRadius, ipe::TextPadding::iRight, ipe::Attribute::isColor(), ipe::Fixed::isInteger(), ipe::StyleSheet::TitleStyle::iSize, ipe::StyleSheet::PageNumberStyle::iSize, ipe::Symbol::iSnap, ipe::Attribute::isNumber(), ipe::Attribute::isSymbolic(), ipe::Tiling::iStep, ipe::Gradient::iStops, ipe::StyleSheet::PageNumberStyle::iText, ipe::TextPadding::iTop, ipe::Symbol::iTransformations, ipe::Effect::iTransitionTime, ipe::Gradient::iType, ipe::Gradient::iV, ipe::StyleSheet::TitleStyle::iVerticalAlignment, ipe::StyleSheet::PageNumberStyle::iVerticalAlignment, ipe::Tiling::iWidth, ipe::Symbol::iXForm, ipe::Attribute::makeColor(), ipe::Attribute::makeDashStyle(), ipe::Text::makeHAlign(), ipe::Attribute::makeScalar(), ipe::Attribute::makeTextSize(), ipe::Text::makeVAlign(), ipe::Attribute::NORMAL(), ipe::Attribute::number(), ipe::Gradient::Stop::offset, ipe::XmlParser::parseAttributes(), parseBitmap(), parseObject(), ipe::XmlParser::parsePCDATA(), ipe::XmlParser::parseToTag(), ipe::StyleSheet::setFillRule(), ipe::StyleSheet::setLayout(), ipe::StyleSheet::setLineCap(), ipe::StyleSheet::setLineJoin(), ipe::StyleSheet::setName(), ipe::StyleSheet::setPageNumberStyle(), ipe::StyleSheet::setPreamble(), ipe::StyleSheet::setTextPadding(), ipe::StyleSheet::setTitleStyle(), ipe::size(), ipe::Lex::skipWhitespace(), ipe::XmlAttributes::slash(), ipe::Vector::x, and ipe::Vector::y.

Referenced by parseDocument(), and parseStyleSheet().

◆ parsePageSelection()

Page * ImlParser::parsePageSelection ( )

parse an <ipepage> element (used on clipboard).

References ipe::XmlParser::parseAttributes(), parseBitmap(), parsePage(), and ipe::XmlParser::parseToTag().

◆ pdfStream()

Buffer ImlParser::pdfStream ( int  objNum)
virtual

XML contents can refer to data in PDF.

If the XML stream is embedded in a PDF file, XML contents can refer to PDF objects. A derived parser must implement this method to access PDF data.

It is assumed that PDF object objNum is a stream. Its contents (uncompressed!) is returned in a buffer.

Referenced by parseBitmap().

◆ parseBitmap()

bool ImlParser::parseBitmap ( )

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