Base::Writer Class Referenceabstract

The Writer class This is an important helper class for the store and retrieval system of persistent objects in FreeCAD. More...

#include <Writer.h>

Classes

struct  FileEntry
 

Public Member Functions

int getFileVersion () const
 
void insertAsciiFile (const char *FileName)
 insert a file as CDATA section in the XML file More...
 
void insertBinFile (const char *FileName)
 insert a binary file BASE64 coded as CDATA section in the XML file More...
 
bool isForceXML ()
 check on state More...
 
void setFileVersion (int)
 
void setForceXML (bool on)
 switch the writer in XML only mode (no files allowed) More...
 
 Writer ()
 
virtual ~Writer ()
 
additional file writing
std::string addFile (const char *Name, const Base::Persistence *Object)
 add a write request of a persistent object More...
 
virtual void writeFiles ()=0
 process the requested file storing More...
 
const std::vector< std::string > & getFilenames () const
 get all registered file names More...
 
void setMode (const std::string &mode)
 Set mode. More...
 
void setModes (const std::set< std::string > &modes)
 Set modes. More...
 
bool getMode (const std::string &mode) const
 Get mode. More...
 
std::set< std::string > getModes () const
 Get modes. More...
 
void clearMode (const std::string &mode)
 Clear mode. More...
 
void clearModes ()
 Clear modes. More...
 
Error handling
void addError (const std::string &)
 
bool hasErrors () const
 
void clearErrors ()
 
std::vector< std::string > getErrors () const
 

pretty formatting for XML

std::string ObjectName
 name for underlying file saves More...
 
std::vector< FileEntryFileList
 
std::vector< std::string > FileNames
 
std::vector< std::string > Errors
 
std::set< std::string > Modes
 
short indent
 
char indBuf [1024]
 
bool forceXML
 
int fileVersion
 
const char * ind () const
 get the current indentation More...
 
void incInd ()
 increase indentation by one tab More...
 
void decInd ()
 decrease indentation by one tab More...
 
virtual std::ostream & Stream ()=0
 
std::string getUniqueFileName (const char *Name)
 

Detailed Description

The Writer class This is an important helper class for the store and retrieval system of persistent objects in FreeCAD.

See also
Base::Persistence
Author
Juergen Riegel

Constructor & Destructor Documentation

◆ Writer()

Writer::Writer ( )

References indBuf.

◆ ~Writer()

Writer::~Writer ( )
virtual

Member Function Documentation

◆ addError()

void Writer::addError ( const std::string &  msg)

◆ addFile()

◆ clearErrors()

void Writer::clearErrors ( )

References Errors.

◆ clearMode()

void Writer::clearMode ( const std::string &  mode)

Clear mode.

References Modes.

◆ clearModes()

void Writer::clearModes ( )

Clear modes.

References Modes.

◆ decInd()

◆ getErrors()

std::vector< std::string > Writer::getErrors ( ) const

References Errors.

◆ getFilenames()

const std::vector< std::string > & Writer::getFilenames ( ) const

get all registered file names

References FileNames.

◆ getFileVersion()

int Writer::getFileVersion ( ) const

References fileVersion.

Referenced by App::Document::Save().

◆ getMode()

bool Writer::getMode ( const std::string &  mode) const

◆ getModes()

std::set< std::string > Writer::getModes ( ) const

Get modes.

References Modes.

Referenced by Gui::RecoveryWriter::writeFiles().

◆ getUniqueFileName()

std::string Writer::getUniqueFileName ( const char *  Name)
protected

◆ hasErrors()

bool Writer::hasErrors ( ) const

References Errors.

Referenced by App::Document::saveToFile().

◆ incInd()

◆ ind()

const char * Base::Writer::ind ( ) const

get the current indentation

Referenced by Spreadsheet::PropertySheet::copyCells(), Gui::Document::exportObjects(), Fem::FemMesh::Save(), Part::Geometry::Save(), Part::GeomPoint::Save(), Part::GeomBSplineCurve::Save(), Part::GeomCircle::Save(), Part::GeomArcOfCircle::Save(), Part::GeomEllipse::Save(), Part::GeomArcOfEllipse::Save(), Part::GeomHyperbola::Save(), Part::GeomArcOfHyperbola::Save(), Part::GeomParabola::Save(), Part::GeomArcOfParabola::Save(), Part::GeomLine::Save(), Part::GeomLineSegment::Save(), Part::Geom2dPoint::Save(), Part::Geom2dCircle::Save(), Part::Geom2dArcOfCircle::Save(), Part::Geom2dEllipse::Save(), Part::Geom2dArcOfEllipse::Save(), Part::Geom2dHyperbola::Save(), Part::Geom2dArcOfHyperbola::Save(), Part::Geom2dParabola::Save(), Part::Geom2dArcOfParabola::Save(), Part::Geom2dLineSegment::Save(), Part::GeometryPersistenceExtension::Save(), Path::Command::Save(), Path::Toolpath::Save(), Path::Tool::Save(), Path::Tooltable::Save(), Robot::Robot6Axis::Save(), Robot::Trajectory::Save(), Robot::Waypoint::Save(), TechDraw::CosmeticVertex::Save(), TechDraw::CosmeticEdge::Save(), TechDraw::CenterLine::Save(), TechDraw::GeomFormat::Save(), TechDraw::Vertex::Save(), Gui::DocumentItem::Save(), Sketcher::Constraint::Save(), TechDraw::BaseGeom::Save(), TechDraw::Circle::Save(), TechDraw::AOC::Save(), TechDraw::Generic::Save(), App::PropertyContainer::Save(), App::PropertyFileIncluded::Save(), App::PropertyMatrix::Save(), App::PropertyPythonObject::Save(), App::PropertyInteger::Save(), App::PropertyPath::Save(), App::PropertyEnumeration::Save(), App::PropertyIntegerSet::Save(), App::PropertyMap::Save(), App::PropertyFloat::Save(), App::PropertyString::Save(), App::PropertyUUID::Save(), App::PropertyBool::Save(), App::PropertyColor::Save(), App::PropertyMaterial::Save(), Fem::PropertyPostDataObject::Save(), Inspection::PropertyDistanceList::Save(), Mesh::PropertyNormalList::Save(), Mesh::PropertyCurvatureList::Save(), Mesh::PropertyMeshKernel::Save(), Part::PropertyGeometryList::Save(), Part::PropertyPartShape::Save(), Part::PropertyFilletEdges::Save(), Points::PointKernel::Save(), Points::PropertyGreyValueList::Save(), Points::PropertyNormalList::Save(), Points::PropertyCurvatureList::Save(), Spreadsheet::Cell::save(), Spreadsheet::PropertyColumnWidths::Save(), Spreadsheet::PropertyRowHeights::Save(), TechDraw::PropertyCenterLineList::Save(), TechDraw::PropertyCosmeticEdgeList::Save(), TechDraw::PropertyCosmeticVertexList::Save(), TechDraw::PropertyGeomFormatList::Save(), App::PropertyExpressionEngine::Save(), App::PropertyVector::Save(), App::PropertyVectorList::Save(), App::PropertyPlacement::Save(), App::PropertyPlacementList::Save(), App::PropertyRotation::Save(), App::PropertyLink::Save(), App::PropertyLinkList::Save(), App::PropertyLinkSub::Save(), App::PropertyLinkSubList::Save(), App::PropertyXLink::Save(), App::PropertyXLinkSubList::Save(), App::PropertyXLinkContainer::Save(), App::PropertyIntegerList::Save(), App::PropertyFloatList::Save(), App::PropertyStringList::Save(), App::PropertyBoolList::Save(), App::PropertyColorList::Save(), App::PropertyMaterialList::Save(), App::PropertyPersistentObject::Save(), Sketcher::PropertyConstraintList::Save(), Spreadsheet::PropertySheet::Save(), Gui::Document::SaveDocFile(), App::ExtensionContainer::saveExtensions(), MeshCore::MeshOutput::SaveXML(), and App::Document::writeObjects().

◆ insertAsciiFile()

void Writer::insertAsciiFile ( const char *  FileName)

insert a file as CDATA section in the XML file

References Stream().

◆ insertBinFile()

void Writer::insertBinFile ( const char *  FileName)

insert a binary file BASE64 coded as CDATA section in the XML file

References Base::base64_encode(), and Stream().

Referenced by App::PropertyFileIncluded::Save().

◆ isForceXML()

◆ setFileVersion()

void Writer::setFileVersion ( int  v)

References fileVersion.

◆ setForceXML()

void Writer::setForceXML ( bool  on)

switch the writer in XML only mode (no files allowed)

References forceXML.

Referenced by Gui::Document::exportObjects(), and Gui::Document::SaveDocFile().

◆ setMode()

void Writer::setMode ( const std::string &  mode)

◆ setModes()

void Writer::setModes ( const std::set< std::string > &  modes)

Set modes.

References Modes.

Referenced by Gui::RecoveryRunnable::RecoveryRunnable().

◆ Stream()

virtual std::ostream & Base::Writer::Stream ( )
pure virtual

Implemented in Base::ZipWriter, Base::StringWriter, Base::FileWriter, and Cloud::CloudWriter.

Referenced by Spreadsheet::PropertySheet::copyCells(), Gui::Document::exportObjects(), insertAsciiFile(), insertBinFile(), Fem::FemMesh::Save(), Part::Geometry::Save(), Part::GeomPoint::Save(), Part::GeomBSplineCurve::Save(), Part::GeomCircle::Save(), Part::GeomArcOfCircle::Save(), Part::GeomEllipse::Save(), Part::GeomArcOfEllipse::Save(), Part::GeomHyperbola::Save(), Part::GeomArcOfHyperbola::Save(), Part::GeomParabola::Save(), Part::GeomArcOfParabola::Save(), Part::GeomLine::Save(), Part::GeomLineSegment::Save(), Part::Geom2dPoint::Save(), Part::Geom2dCircle::Save(), Part::Geom2dArcOfCircle::Save(), Part::Geom2dEllipse::Save(), Part::Geom2dArcOfEllipse::Save(), Part::Geom2dHyperbola::Save(), Part::Geom2dArcOfHyperbola::Save(), Part::Geom2dParabola::Save(), Part::Geom2dArcOfParabola::Save(), Part::Geom2dLineSegment::Save(), Part::GeometryPersistenceExtension::Save(), Path::Command::Save(), Path::Toolpath::Save(), Path::Tool::Save(), Path::Tooltable::Save(), Robot::Robot6Axis::Save(), Robot::Trajectory::Save(), Robot::Waypoint::Save(), TechDraw::CosmeticVertex::Save(), TechDraw::CosmeticEdge::Save(), TechDraw::CenterLine::Save(), TechDraw::GeomFormat::Save(), TechDraw::Vertex::Save(), Gui::DocumentItem::Save(), Sketcher::Constraint::Save(), TechDraw::BaseGeom::Save(), TechDraw::Circle::Save(), TechDraw::AOC::Save(), TechDraw::Generic::Save(), App::PropertyContainer::Save(), App::PropertyFileIncluded::Save(), App::PropertyMatrix::Save(), App::PropertyPythonObject::Save(), App::PropertyInteger::Save(), App::PropertyPath::Save(), App::PropertyEnumeration::Save(), App::PropertyIntegerSet::Save(), App::PropertyMap::Save(), App::PropertyFloat::Save(), App::PropertyString::Save(), App::PropertyUUID::Save(), App::PropertyBool::Save(), App::PropertyColor::Save(), App::PropertyMaterial::Save(), Fem::PropertyPostDataObject::Save(), Inspection::PropertyDistanceList::Save(), Mesh::PropertyNormalList::Save(), Mesh::PropertyCurvatureList::Save(), Mesh::PropertyMeshKernel::Save(), Part::PropertyGeometryList::Save(), Part::PropertyPartShape::Save(), Part::PropertyFilletEdges::Save(), Points::PointKernel::Save(), Points::PropertyGreyValueList::Save(), Points::PropertyNormalList::Save(), Points::PropertyCurvatureList::Save(), Spreadsheet::Cell::save(), Spreadsheet::PropertyColumnWidths::Save(), Spreadsheet::PropertyRowHeights::Save(), TechDraw::PropertyCenterLineList::Save(), TechDraw::PropertyCosmeticEdgeList::Save(), TechDraw::PropertyCosmeticVertexList::Save(), TechDraw::PropertyGeomFormatList::Save(), App::Document::Save(), App::PropertyExpressionEngine::Save(), App::PropertyVector::Save(), App::PropertyVectorList::Save(), App::PropertyPlacement::Save(), App::PropertyPlacementList::Save(), App::PropertyRotation::Save(), App::PropertyLink::Save(), App::PropertyLinkList::Save(), App::PropertyLinkSub::Save(), App::PropertyLinkSubList::Save(), App::PropertyXLink::Save(), App::PropertyXLinkSubList::Save(), App::PropertyXLinkContainer::Save(), App::PropertyIntegerList::Save(), App::PropertyFloatList::Save(), App::PropertyStringList::Save(), App::PropertyBoolList::Save(), App::PropertyColorList::Save(), App::PropertyMaterialList::Save(), App::PropertyPersistentObject::Save(), Sketcher::PropertyConstraintList::Save(), Spreadsheet::PropertySheet::Save(), App::DynamicProperty::save(), Part::GeometryPersistenceExtension::saveAttributes(), Part::GeometryDefaultExtension< T >::saveAttributes(), Sketcher::ExternalGeometryExtension::saveAttributes(), Sketcher::SketchGeometryExtension::saveAttributes(), Part::Geom2dConic::SaveAxis(), Part::Geom2dArcOfConic::SaveAxis(), App::PropertyFileIncluded::SaveDocFile(), App::PropertyPythonObject::SaveDocFile(), App::VRMLObject::SaveDocFile(), Gui::Document::SaveDocFile(), Gui::Thumbnail::SaveDocFile(), Fem::FemMesh::SaveDocFile(), Fem::PropertyPostDataObject::SaveDocFile(), Inspection::PropertyDistanceList::SaveDocFile(), Mesh::MeshObject::SaveDocFile(), Mesh::PropertyNormalList::SaveDocFile(), Mesh::PropertyCurvatureList::SaveDocFile(), Mesh::PropertyMeshKernel::SaveDocFile(), Part::PropertyPartShape::SaveDocFile(), Part::PropertyFilletEdges::SaveDocFile(), Path::Toolpath::SaveDocFile(), Points::PointKernel::SaveDocFile(), Points::PropertyGreyValueList::SaveDocFile(), Points::PropertyNormalList::SaveDocFile(), Points::PropertyCurvatureList::SaveDocFile(), App::PropertyVectorList::SaveDocFile(), App::PropertyPlacementList::SaveDocFile(), App::PropertyFloatList::SaveDocFile(), App::PropertyColorList::SaveDocFile(), App::PropertyMaterialList::SaveDocFile(), App::ExtensionContainer::saveExtensions(), MeshCore::MeshOutput::SaveXML(), and App::Document::writeObjects().

◆ writeFiles()

virtual void Base::Writer::writeFiles ( )
pure virtual

process the requested file storing

Implemented in Base::ZipWriter, Base::StringWriter, Base::FileWriter, Gui::RecoveryWriter, and Cloud::CloudWriter.

Member Data Documentation

◆ Errors

std::vector<std::string> Base::Writer::Errors
protected

◆ FileList

std::vector<FileEntry> Base::Writer::FileList
protected

◆ FileNames

std::vector<std::string> Base::Writer::FileNames
protected

◆ fileVersion

int Base::Writer::fileVersion
protected

Referenced by getFileVersion(), and setFileVersion().

◆ forceXML

bool Base::Writer::forceXML
protected

Referenced by isForceXML(), and setForceXML().

◆ indBuf

char Base::Writer::indBuf[1024]
protected

Referenced by decInd(), incInd(), and Writer().

◆ indent

short Base::Writer::indent
protected

Referenced by decInd(), and incInd().

◆ Modes

std::set<std::string> Base::Writer::Modes
protected

◆ ObjectName

std::string Base::Writer::ObjectName

name for underlying file saves

Referenced by Path::Toolpath::Save(), and Points::PointKernel::Save().


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