hgeometry-ipe-0.13: Reading and Writing ipe7 files.
Safe HaskellNone
LanguageHaskell2010

Ipe.Reader

Synopsis

Reading ipe Files

readRawIpeFile :: (Coordinate r, Eq r) => FilePath -> IO (Either ConversionError (IpeFile r)) Source #

Given a file path, tries to read an ipe file

readIpeFile :: (Coordinate r, Eq r) => FilePath -> IO (Either ConversionError (IpeFile r)) Source #

Given a file path, tries to read an ipe file.

This function applies all matrices to objects.

readSinglePageFile :: (Coordinate r, Eq r) => FilePath -> IO (Either ConversionError (IpePage r)) Source #

Since most Ipe file contain only one page, we provide a shortcut for that as well.

This function applies all matrices, and it makes sure there is at least one layer and view in the page.

readSinglePageFileThrow :: (Coordinate r, Eq r) => FilePath -> IO (IpePage r) Source #

Tries to read a single page file, throws an error when this fails. See readSinglePageFile for further details.

Readiing ipe style files

readIpeStylesheet :: FilePath -> IO (Either ConversionError IpeStyle) Source #

Reads an Ipe stylesheet from Disk.

addStyleSheetFrom :: FilePath -> IpeFile r -> IO (IpeFile r) Source #

Given a path to a stylesheet, add it to the ipe file with the highest priority. Throws an error when this fails.

Reading XML directly

fromIpeXML :: IpeRead (t r) => ByteString -> Either ConversionError (t r) Source #

Given a Bytestring, try to parse the bytestring into anything that is IpeReadable, i.e. any of the Ipe elements.

readXML :: ByteString -> Either ConversionError (Node Text Text) Source #

Reads the data from a Bytestring into a proper Node

Read classes

class IpeReadText t where Source #

Reading an ipe elemtn from a Text value

Instances

Instances details
IpeReadText Int Source # 
Instance details

Defined in Ipe.Reader

IpeReadText Text Source # 
Instance details

Defined in Ipe.Reader

IpeReadText LayerName Source # 
Instance details

Defined in Ipe.Reader

IpeReadText FillType Source # 
Instance details

Defined in Ipe.Reader

IpeReadText TransformationTypes Source # 
Instance details

Defined in Ipe.Reader

IpeReadText PinType Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeReadText [Operation r] Source # 
Instance details

Defined in Ipe.Reader

(Coordinate r, Fractional r, Eq r) => IpeReadText (NonEmpty (PathSegment r)) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeReadText (RGB r) Source # 
Instance details

Defined in Ipe.Reader

(Coordinate r, Fractional r, Eq r) => IpeReadText (Path r) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeReadText (IpeColor r) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeReadText (IpeArrow r) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeReadText (IpeDash r) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeReadText (IpePen r) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeReadText (IpeSize r) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeReadText (Rectangle () r) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeReadText (Point 2 r) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeReadText (Matrix 3 3 r) Source # 
Instance details

Defined in Ipe.Reader

class IpeRead t where Source #

Reading an ipe lement from Xml

Instances

Instances details
IpeRead LayerName Source # 
Instance details

Defined in Ipe.Reader

IpeRead View Source # 
Instance details

Defined in Ipe.Reader

IpeRead IpeStyle Source # 
Instance details

Defined in Ipe.Reader

(Coordinate r, Fractional r, Eq r) => IpeRead (Path r) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeRead (Image r) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeRead (IpeSymbol r) Source #

Ipe read instances

Instance details

Defined in Ipe.Reader

Coordinate r => IpeRead (MiniPage r) Source # 
Instance details

Defined in Ipe.Reader

Coordinate r => IpeRead (TextLabel r) Source # 
Instance details

Defined in Ipe.Reader

(Coordinate r, Fractional r, Eq r) => IpeRead (IpeObject r) Source # 
Instance details

Defined in Ipe.Reader

(Coordinate r, Eq r) => IpeRead (Group r) Source # 
Instance details

Defined in Ipe.Reader

(Coordinate r, Eq r) => IpeRead (IpePage r) Source # 
Instance details

Defined in Ipe.Reader

(Coordinate r, Eq r) => IpeRead (IpeFile r) Source # 
Instance details

Defined in Ipe.Reader

class IpeReadAttr t where Source #

Basically IpeReadText for attributes. This class is not really meant to be implemented directly. Just define an IpeReadText instance for the type (Apply f at), then the generic instance below takes care of looking up the name of the attribute, and calling the right ipeReadText value. This class is just so that reifyConstraint in ipeReadRec can select the right typeclass when building the rec.

Instances

Instances details
IpeReadText (Apply f at) => IpeReadAttr (Attr f at) Source # 
Instance details

Defined in Ipe.Reader

Some low level implementation functions

ipeReadObject :: (IpeRead (i r), f ~ AttrMapSym1 r, ats ~ AttributesOf i, RecApplicative ats, ReifyConstraint IpeReadAttr (Attr f) ats, RecAll (Attr f) ats IpeReadAttr, AllConstrained IpeAttrName ats) => Proxy i -> proxy r -> Node Text Text -> Either ConversionError (i r :+ IpeAttributes i r) Source #

If we can ipeRead an ipe element, and we can ipeReadAttrs its attributes we can properly read an ipe object using ipeReadObject

ipeReadAttrs :: forall proxy proxy' i r f ats. (f ~ AttrMapSym1 r, ats ~ AttributesOf i, ReifyConstraint IpeReadAttr (Attr f) ats, RecApplicative ats, RecAll (Attr f) ats IpeReadAttr, AllConstrained IpeAttrName ats) => proxy i -> proxy' r -> Node Text Text -> Either ConversionError (IpeAttributes i r) Source #

Reader for records. Given a proxy of some ipe type i, and a proxy of an coordinate type r, read the IpeAttributes for i from the xml node.

ipeReadRec :: forall f ats. (RecApplicative ats, ReifyConstraint IpeReadAttr (Attr f) ats, RecAll (Attr f) ats IpeReadAttr, AllConstrained IpeAttrName ats) => Proxy f -> Proxy ats -> Node Text Text -> Either ConversionError (Rec (Attr f) ats) Source #

Reading the Attributes into a Rec (Attr f), all based on the types of f (the type family mapping labels to types), and a list of labels (ats).

class Fractional r => Coordinate r where Source #

Represent stuff that can be used as a coordinate in ipe. (similar to show/read)

Minimal complete definition

Nothing

Methods

fromSeq :: Integer -> Maybe (Int, Integer) -> r Source #

default fromSeq :: (Ord r, Fractional r) => Integer -> Maybe (Int, Integer) -> r Source #

Instances

Instances details
Coordinate Double Source # 
Instance details

Defined in Ipe.PathParser

Coordinate Float Source # 
Instance details

Defined in Ipe.PathParser

Coordinate (Ratio Integer) Source # 
Instance details

Defined in Ipe.PathParser

Coordinate (RealNumber p) Source # 
Instance details

Defined in Ipe.PathParser