Laxkit  0.0.7.1
Public Member Functions
LaxFiles::DumpUtility Class Reference

Class to provide do nothing place holders for dump_out, dump_in_atts, and a standard dump_in. More...

Inheritance diagram for LaxFiles::DumpUtility:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void dump_out (FILE *f, int indent, int what, Laxkit::anObject *savecontext)=0
 what==0 means write out an Attribute formatted file.
virtual Attributedump_out_atts (Attribute *att, int what, Laxkit::anObject *savecontext)
 Default is return NULL. what==0 means write out normal Attribute formatted things.
virtual void dump_in (FILE *f, int indent, int what, Laxkit::anObject *loadcontext, Attribute **att)
 Read in a file segment as an Attribute, and pass parsing duties to dump_in_atts.
virtual void dump_in_atts (Attribute *att, int flag, Laxkit::anObject *loadcontext)=0
 Read the Attribute and take away what it can.
virtual ~DumpUtility ()
 Empty virtual destructor.

Detailed Description

Class to provide do nothing place holders for dump_out, dump_in_atts, and a standard dump_in.

These functions are used with the style of file where an items related elements are listed on following lines with a certain indentation, similar to how things are grouped in the Python language. The amount of indentation for the classes elements is specified in indent.

It provides abstract place holders for dump_out() and dump_in_atts(), and provides a dump_in() that reads in an Attribute, and passes it to dump_in_atts().

Derived classes would inherit like:
class Blah : virtual public DumpUtility, public WhateverOtherClass, ...


Member Function Documentation

void LaxFiles::DumpUtility::dump_in ( FILE *  f,
int  indent,
int  what,
Laxkit::anObject loadcontext,
Attribute **  Att 
)
virtual

Read in a file segment as an Attribute, and pass parsing duties to dump_in_atts.

The default function here ignores what (assumes it is 0). Creates a new Attribute, does newatt->dump_in(f,indent), then calls dump_in_atts(newatt,loadcontext). Puts the plain att in Att if Att!=NULL. Otherwise deletes the nem att.

what==0 means f is an Attribute formatted file. Other values of what can be used by subclasses to read in from other file formats, like a PathsData reading in an SVG, for instance.

loadcontext, if not NULL, will typically be something like a LaxInterfaces::LoadContext object.

Reimplemented in Laxkit::Palette.

References LaxFiles::Attribute::dump_in().

Referenced by Laxkit::ShortcutManager::Load().

void LaxFiles::DumpUtility::dump_in_atts ( Attribute att,
int  flag,
Laxkit::anObject loadcontext 
)
pure virtual

Read the Attribute and take away what it can.

Todo:
in future might have a flag somehow to remove atts that are processed (flag=1).. this will have to play nice with dump_in().

Implemented in Laxkit::anXWindow, Laxkit::ShortcutManager, Laxkit::CurveWindow, LaxInterfaces::anInterface, Laxkit::RulerWindow, Laxkit::Scroller, LaxInterfaces::Path, Laxkit::MessageBar, Laxkit::DateSelector, Laxkit::Button, Laxkit::Palette, LaxInterfaces::LineStyle, and LaxInterfaces::FillStyle.

void LaxFiles::DumpUtility::dump_out ( FILE *  f,
int  indent,
int  what,
Laxkit::anObject savecontext 
)
pure virtual

what==0 means write out an Attribute formatted file.

what==-1 should mean write out a definition snippet that represents what attributes can be passed in to this object.

Implemented in Laxkit::anXWindow, Laxkit::ShortcutManager, LaxInterfaces::anInterface, LaxInterfaces::Path, Laxkit::Palette, LaxInterfaces::LineStyle, and LaxInterfaces::FillStyle.

Attribute * LaxFiles::DumpUtility::dump_out_atts ( Attribute att,
int  what,
Laxkit::anObject savecontext 
)
inlinevirtual

Default is return NULL. what==0 means write out normal Attribute formatted things.

If att==NULL, then create and return a new Attribute. Otherwise just append to att.

Todo:
what==-1 should mean write out a definition snippet that represents what attributes can be passed in to this object. this would make it a snap to produce the Attribute equivalent of dtd information..

Reimplemented in Laxkit::anXWindow, Laxkit::CurveWindow, Laxkit::RulerWindow, Laxkit::Scroller, Laxkit::MessageBar, Laxkit::DateSelector, Laxkit::Button, and Laxkit::Palette.


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

Mon Feb 17 2014 11:52:58, Laxkit