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 (void) |
check on state More... | |
void | setFileVersion (int) |
void | setForceXML (bool on) |
switch the writer in XML only mode (no files allowed) More... | |
Writer (void) | |
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 (void)=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< FileEntry > | FileList |
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 (void) const |
get the current indentation More... | |
void | incInd (void) |
increase indentation by one tab More... | |
void | decInd (void) |
decrease indentation by one tab More... | |
virtual std::ostream & | Stream (void)=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
Constructor & Destructor Documentation
◆ Writer()
Writer::Writer | ( | void | ) |
References indBuf.
◆ ~Writer()
|
virtual |
Member Function Documentation
◆ addError()
void Writer::addError | ( | const std::string & | msg | ) |
References Errors.
Referenced by Fem::PropertyPostDataObject::SaveDocFile(), and Part::PropertyPartShape::SaveDocFile().
◆ addFile()
std::string Writer::addFile | ( | const char * | Name, |
const Base::Persistence * | Object | ||
) |
add a write request of a persistent object
References FileList, Base::Writer::FileEntry::FileName, FileNames, getUniqueFileName(), isForceXML(), and Base::Writer::FileEntry::Object.
Referenced by Gui::Thumbnail::Save(), Fem::FemMesh::Save(), Path::Toolpath::Save(), App::VRMLObject::Save(), App::PropertyFileIncluded::Save(), Mesh::PropertyNormalList::Save(), Fem::PropertyPostDataObject::Save(), Points::PropertyGreyValueList::Save(), Part::PropertyPartShape::Save(), Points::PointKernel::Save(), Gui::Document::Save(), Points::PropertyNormalList::Save(), Mesh::PropertyCurvatureList::Save(), Inspection::PropertyDistanceList::Save(), Part::PropertyFilletEdges::Save(), App::PropertyVectorList::Save(), Points::PropertyCurvatureList::Save(), Mesh::PropertyMeshKernel::Save(), App::PropertyPlacementList::Save(), App::PropertyFloatList::Save(), App::PropertyColorList::Save(), and App::PropertyMaterialList::Save().
◆ 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()
void Writer::decInd | ( | void | ) |
decrease indentation by one tab
References indBuf, and indent.
Referenced by Spreadsheet::PropertySheet::copyCells(), Gui::Document::exportObjects(), Robot::Trajectory::Save(), TechDraw::PropertyCenterLineList::Save(), Part::PropertyGeometryList::Save(), TechDraw::PropertyCosmeticVertexList::Save(), TechDraw::PropertyGeomFormatList::Save(), TechDraw::PropertyCosmeticEdgeList::Save(), Path::Tooltable::Save(), Spreadsheet::PropertySheet::Save(), Path::Toolpath::Save(), App::PropertyFileIncluded::Save(), Spreadsheet::PropertyRowHeights::Save(), Spreadsheet::PropertyColumnWidths::Save(), Points::PropertyGreyValueList::Save(), Sketcher::PropertyConstraintList::Save(), App::PropertyExpressionEngine::Save(), Part::Geometry::Save(), Inspection::PropertyDistanceList::Save(), App::PropertyEnumeration::Save(), TechDraw::CenterLine::Save(), App::PropertyContainer::Save(), TechDraw::Generic::Save(), Part::GeomBSplineCurve::Save(), App::PropertyIntegerList::Save(), App::PropertyIntegerSet::Save(), App::PropertyMap::Save(), App::PropertyFloatList::Save(), App::PropertyLinkList::Save(), App::PropertyStringList::Save(), App::PropertyLinkSub::Save(), App::PropertyLinkSubList::Save(), App::PropertyPersistentObject::Save(), App::PropertyXLink::Save(), App::PropertyXLinkSubList::Save(), App::PropertyXLinkContainer::Save(), Gui::Document::SaveDocFile(), App::ExtensionContainer::saveExtensions(), MeshCore::MeshOutput::SaveXML(), and App::Document::writeObjects().
◆ 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 |
Get mode.
References Modes.
Referenced by Part::PropertyPartShape::Save(), and Part::PropertyPartShape::SaveDocFile().
◆ getModes()
std::set< std::string > Writer::getModes | ( | ) | const |
◆ getUniqueFileName()
|
protected |
References Base::FileInfo::extension(), Base::FileInfo::fileNamePure(), FileNames, DraftVecUtils::find(), Base::Tools::getUniqueName(), and Base::FileInfo::setFile().
Referenced by addFile().
◆ hasErrors()
bool Writer::hasErrors | ( | ) | const |
References Errors.
Referenced by App::Document::saveToFile().
◆ incInd()
void Writer::incInd | ( | void | ) |
increase indentation by one tab
References indBuf, and indent.
Referenced by Spreadsheet::PropertySheet::copyCells(), Gui::Document::exportObjects(), Robot::Trajectory::Save(), TechDraw::PropertyCenterLineList::Save(), Part::PropertyGeometryList::Save(), TechDraw::PropertyCosmeticVertexList::Save(), TechDraw::PropertyGeomFormatList::Save(), TechDraw::PropertyCosmeticEdgeList::Save(), Path::Tooltable::Save(), Spreadsheet::PropertySheet::Save(), Path::Toolpath::Save(), App::PropertyFileIncluded::Save(), Spreadsheet::PropertyRowHeights::Save(), Spreadsheet::PropertyColumnWidths::Save(), Points::PropertyGreyValueList::Save(), Sketcher::PropertyConstraintList::Save(), App::PropertyExpressionEngine::Save(), Part::Geometry::Save(), Inspection::PropertyDistanceList::Save(), App::PropertyEnumeration::Save(), TechDraw::CenterLine::Save(), App::PropertyContainer::Save(), TechDraw::Generic::Save(), Part::GeomBSplineCurve::Save(), App::PropertyIntegerList::Save(), App::PropertyIntegerSet::Save(), App::PropertyMap::Save(), App::PropertyFloatList::Save(), App::PropertyLinkList::Save(), App::PropertyStringList::Save(), App::PropertyLinkSub::Save(), App::PropertyLinkSubList::Save(), App::PropertyPersistentObject::Save(), App::PropertyXLink::Save(), App::PropertyXLinkSubList::Save(), App::PropertyXLinkContainer::Save(), Gui::Document::SaveDocFile(), App::ExtensionContainer::saveExtensions(), MeshCore::MeshOutput::SaveXML(), and App::Document::writeObjects().
◆ ind()
const char* Base::Writer::ind | ( | void | ) | const |
get the current indentation
Referenced by Spreadsheet::PropertySheet::copyCells(), Gui::Document::exportObjects(), Robot::Trajectory::Save(), App::PropertyPythonObject::Save(), Fem::FemMesh::Save(), App::PropertyInteger::Save(), TechDraw::PropertyCenterLineList::Save(), Part::PropertyGeometryList::Save(), Robot::Robot6Axis::Save(), Sketcher::SketchGeometryExtension::Save(), TechDraw::PropertyCosmeticVertexList::Save(), TechDraw::PropertyGeomFormatList::Save(), TechDraw::PropertyCosmeticEdgeList::Save(), Part::GeometryDefaultExtension< T >::Save(), Path::Tooltable::Save(), Path::Command::Save(), Spreadsheet::PropertySheet::Save(), TechDraw::CosmeticVertex::Save(), App::PropertyVector::Save(), Path::Toolpath::Save(), Sketcher::ExternalGeometryExtension::Save(), App::PropertyFileIncluded::Save(), Spreadsheet::PropertyColumnWidths::Save(), Spreadsheet::PropertyRowHeights::Save(), Part::Geom2dPoint::Save(), Mesh::PropertyNormalList::Save(), Fem::PropertyPostDataObject::Save(), Robot::Waypoint::Save(), Points::PropertyGreyValueList::Save(), Spreadsheet::Cell::save(), Sketcher::PropertyConstraintList::Save(), App::PropertyPath::Save(), App::PropertyExpressionEngine::Save(), Part::Geometry::Save(), Part::PropertyPartShape::Save(), TechDraw::BaseGeom::Save(), Path::Tool::Save(), Sketcher::Constraint::Save(), Points::PointKernel::Save(), TechDraw::CosmeticEdge::Save(), Points::PropertyNormalList::Save(), Part::GeomPoint::Save(), TechDraw::Circle::Save(), Mesh::PropertyCurvatureList::Save(), Inspection::PropertyDistanceList::Save(), App::PropertyEnumeration::Save(), TechDraw::CenterLine::Save(), Part::PropertyFilletEdges::Save(), App::PropertyContainer::Save(), App::PropertyVectorList::Save(), TechDraw::AOC::Save(), Points::PropertyCurvatureList::Save(), Mesh::PropertyMeshKernel::Save(), App::PropertyMatrix::Save(), Part::Geom2dCircle::Save(), TechDraw::Generic::Save(), TechDraw::GeomFormat::Save(), Gui::DocumentItem::Save(), Part::Geom2dArcOfCircle::Save(), Part::GeomBSplineCurve::Save(), App::PropertyIntegerList::Save(), TechDraw::Vertex::Save(), App::PropertyPlacement::Save(), Part::Geom2dEllipse::Save(), Part::Geom2dArcOfEllipse::Save(), App::PropertyIntegerSet::Save(), App::PropertyPlacementList::Save(), Part::Geom2dHyperbola::Save(), Part::Geom2dArcOfHyperbola::Save(), App::PropertyMap::Save(), Part::Geom2dParabola::Save(), Part::GeomCircle::Save(), App::PropertyFloat::Save(), Part::Geom2dArcOfParabola::Save(), Part::GeomArcOfCircle::Save(), Part::GeomEllipse::Save(), Part::Geom2dLineSegment::Save(), Part::GeomArcOfEllipse::Save(), Part::GeomHyperbola::Save(), App::PropertyFloatList::Save(), App::PropertyLink::Save(), Part::GeomArcOfHyperbola::Save(), Part::GeomParabola::Save(), App::PropertyString::Save(), Part::GeomArcOfParabola::Save(), App::PropertyUUID::Save(), App::PropertyLinkList::Save(), Part::GeomLine::Save(), Part::GeomLineSegment::Save(), App::PropertyStringList::Save(), App::PropertyBool::Save(), App::PropertyBoolList::Save(), App::PropertyLinkSub::Save(), App::PropertyColor::Save(), App::PropertyColorList::Save(), App::PropertyMaterial::Save(), App::PropertyLinkSubList::Save(), App::PropertyMaterialList::Save(), App::PropertyPersistentObject::Save(), App::PropertyXLink::Save(), App::PropertyXLinkSubList::Save(), App::PropertyXLinkContainer::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()
bool Writer::isForceXML | ( | void | ) |
check on state
References forceXML.
Referenced by addFile(), Gui::Document::exportObjects(), Gui::Thumbnail::Save(), Fem::FemMesh::Save(), Path::Toolpath::Save(), App::PropertyFileIncluded::Save(), Mesh::PropertyNormalList::Save(), Fem::PropertyPostDataObject::Save(), Points::PropertyGreyValueList::Save(), Part::PropertyPartShape::Save(), Points::PointKernel::Save(), Gui::Document::Save(), Points::PropertyNormalList::Save(), Mesh::PropertyCurvatureList::Save(), Inspection::PropertyDistanceList::Save(), Part::PropertyFilletEdges::Save(), App::PropertyVectorList::Save(), Points::PropertyCurvatureList::Save(), Mesh::PropertyMeshKernel::Save(), App::PropertyPlacementList::Save(), App::PropertyFloatList::Save(), App::PropertyColorList::Save(), App::PropertyMaterialList::Save(), and Gui::Document::SaveDocFile().
◆ 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(), Base::PersistencePy::getContent(), and Gui::Document::SaveDocFile().
◆ setMode()
void Writer::setMode | ( | const std::string & | mode | ) |
Set mode.
References Modes.
Referenced by Cloud::Module::cloudSave(), Base::Persistence::dumpToStream(), Gui::AutoSaver::saveDocument(), and App::Document::saveToFile().
◆ setModes()
void Writer::setModes | ( | const std::set< std::string > & | modes | ) |
◆ Stream()
|
pure virtual |
Implemented in Base::FileWriter, Base::StringWriter, Base::ZipWriter, and Cloud::CloudWriter.
Referenced by Spreadsheet::PropertySheet::copyCells(), Gui::Document::exportObjects(), insertAsciiFile(), insertBinFile(), Robot::Trajectory::Save(), App::PropertyPythonObject::Save(), Fem::FemMesh::Save(), TechDraw::PropertyCenterLineList::Save(), App::PropertyInteger::Save(), Part::PropertyGeometryList::Save(), Robot::Robot6Axis::Save(), TechDraw::PropertyCosmeticVertexList::Save(), TechDraw::PropertyGeomFormatList::Save(), Sketcher::SketchGeometryExtension::Save(), TechDraw::PropertyCosmeticEdgeList::Save(), Part::GeometryDefaultExtension< T >::Save(), Path::Tooltable::Save(), Path::Command::Save(), TechDraw::CosmeticVertex::Save(), Spreadsheet::PropertySheet::Save(), Path::Toolpath::Save(), App::PropertyVector::Save(), Sketcher::ExternalGeometryExtension::Save(), App::PropertyFileIncluded::Save(), Spreadsheet::PropertyRowHeights::Save(), Spreadsheet::PropertyColumnWidths::Save(), Part::Geom2dPoint::Save(), Mesh::PropertyNormalList::Save(), Fem::PropertyPostDataObject::Save(), Robot::Waypoint::Save(), Points::PropertyGreyValueList::Save(), Spreadsheet::Cell::save(), Sketcher::PropertyConstraintList::Save(), App::PropertyPath::Save(), App::PropertyExpressionEngine::Save(), Part::Geometry::Save(), TechDraw::BaseGeom::Save(), Part::PropertyPartShape::Save(), Path::Tool::Save(), Sketcher::Constraint::Save(), Points::PointKernel::Save(), TechDraw::CosmeticEdge::Save(), App::DynamicProperty::save(), Part::GeomPoint::Save(), Points::PropertyNormalList::Save(), TechDraw::Circle::Save(), Mesh::PropertyCurvatureList::Save(), Inspection::PropertyDistanceList::Save(), App::PropertyEnumeration::Save(), TechDraw::CenterLine::Save(), Part::PropertyFilletEdges::Save(), App::PropertyContainer::Save(), App::PropertyVectorList::Save(), TechDraw::AOC::Save(), App::Document::Save(), Points::PropertyCurvatureList::Save(), Mesh::PropertyMeshKernel::Save(), App::PropertyMatrix::Save(), Part::Geom2dCircle::Save(), TechDraw::Generic::Save(), TechDraw::GeomFormat::Save(), Gui::DocumentItem::Save(), Part::Geom2dArcOfCircle::Save(), Part::GeomBSplineCurve::Save(), App::PropertyIntegerList::Save(), TechDraw::Vertex::Save(), App::PropertyPlacement::Save(), Part::Geom2dEllipse::Save(), Part::Geom2dArcOfEllipse::Save(), App::PropertyIntegerSet::Save(), App::PropertyPlacementList::Save(), Part::Geom2dHyperbola::Save(), Part::Geom2dArcOfHyperbola::Save(), App::PropertyMap::Save(), Part::Geom2dParabola::Save(), Part::GeomCircle::Save(), App::PropertyFloat::Save(), Part::Geom2dArcOfParabola::Save(), Part::GeomArcOfCircle::Save(), Part::GeomEllipse::Save(), Part::Geom2dLineSegment::Save(), Part::GeomArcOfEllipse::Save(), Part::GeomHyperbola::Save(), App::PropertyFloatList::Save(), App::PropertyLink::Save(), Part::GeomArcOfHyperbola::Save(), Part::GeomParabola::Save(), App::PropertyString::Save(), Part::GeomArcOfParabola::Save(), App::PropertyUUID::Save(), App::PropertyLinkList::Save(), Part::GeomLine::Save(), Part::GeomLineSegment::Save(), App::PropertyStringList::Save(), App::PropertyBool::Save(), App::PropertyBoolList::Save(), App::PropertyLinkSub::Save(), App::PropertyColor::Save(), App::PropertyColorList::Save(), App::PropertyMaterial::Save(), App::PropertyLinkSubList::Save(), App::PropertyMaterialList::Save(), App::PropertyPersistentObject::Save(), App::PropertyXLink::Save(), App::PropertyXLinkSubList::Save(), App::PropertyXLinkContainer::Save(), Part::Geom2dConic::SaveAxis(), Part::Geom2dArcOfConic::SaveAxis(), Gui::Thumbnail::SaveDocFile(), App::PropertyPythonObject::SaveDocFile(), Fem::FemMesh::SaveDocFile(), Path::Toolpath::SaveDocFile(), App::VRMLObject::SaveDocFile(), App::PropertyFileIncluded::SaveDocFile(), Mesh::PropertyNormalList::SaveDocFile(), Fem::PropertyPostDataObject::SaveDocFile(), Points::PropertyGreyValueList::SaveDocFile(), Part::PropertyPartShape::SaveDocFile(), Points::PointKernel::SaveDocFile(), Mesh::MeshObject::SaveDocFile(), Gui::Document::SaveDocFile(), Points::PropertyNormalList::SaveDocFile(), Mesh::PropertyCurvatureList::SaveDocFile(), Inspection::PropertyDistanceList::SaveDocFile(), Part::PropertyFilletEdges::SaveDocFile(), App::PropertyVectorList::SaveDocFile(), Points::PropertyCurvatureList::SaveDocFile(), Mesh::PropertyMeshKernel::SaveDocFile(), App::PropertyPlacementList::SaveDocFile(), App::PropertyFloatList::SaveDocFile(), App::PropertyColorList::SaveDocFile(), App::PropertyMaterialList::SaveDocFile(), App::ExtensionContainer::saveExtensions(), MeshCore::MeshOutput::SaveXML(), and App::Document::writeObjects().
◆ writeFiles()
|
pure virtual |
process the requested file storing
Implemented in Base::FileWriter, Base::StringWriter, Base::ZipWriter, Cloud::CloudWriter, and Gui::RecoveryWriter.
Member Data Documentation
◆ Errors
|
protected |
Referenced by addError(), clearErrors(), getErrors(), and hasErrors().
◆ FileList
|
protected |
◆ FileNames
|
protected |
Referenced by addFile(), getFilenames(), and getUniqueFileName().
◆ fileVersion
|
protected |
Referenced by getFileVersion(), and setFileVersion().
◆ forceXML
|
protected |
Referenced by isForceXML(), and setForceXML().
◆ indBuf
◆ indent
◆ Modes
|
protected |
Referenced by clearMode(), clearModes(), getMode(), getModes(), setMode(), and setModes().
◆ 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:
- src/Base/Writer.h
- src/Base/Writer.cpp