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< 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 () 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) |
The Writer class This is an important helper class for the store and retrieval system of persistent objects in FreeCAD.
Writer::Writer | ( | ) |
References indBuf.
|
virtual |
void Writer::addError | ( | const std::string & | msg | ) |
References Errors.
Referenced by Fem::PropertyPostDataObject::SaveDocFile().
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 Fem::FemMesh::Save(), Path::Toolpath::Save(), App::PropertyFileIncluded::Save(), App::VRMLObject::Save(), Gui::Document::Save(), Gui::Thumbnail::Save(), Fem::PropertyPostDataObject::Save(), Inspection::PropertyDistanceList::Save(), Mesh::PropertyNormalList::Save(), Mesh::PropertyCurvatureList::Save(), Mesh::PropertyMeshKernel::Save(), Part::PropertyPartShape::Save(), Part::PropertyFilletEdges::Save(), Points::PointKernel::Save(), Points::PropertyGreyValueList::Save(), Points::PropertyNormalList::Save(), Points::PropertyCurvatureList::Save(), App::PropertyVectorList::Save(), App::PropertyPlacementList::Save(), App::PropertyFloatList::Save(), App::PropertyColorList::Save(), and App::PropertyMaterialList::Save().
void Writer::clearErrors | ( | ) |
References Errors.
void Writer::clearMode | ( | const std::string & | mode | ) |
Clear mode.
References Modes.
void Writer::clearModes | ( | ) |
Clear modes.
References Modes.
void Writer::decInd | ( | ) |
decrease indentation by one tab
References indBuf, and indent.
Referenced by Spreadsheet::PropertySheet::copyCells(), Gui::Document::exportObjects(), Part::Geometry::Save(), Part::GeomBSplineCurve::Save(), Path::Toolpath::Save(), Path::Tooltable::Save(), Robot::Trajectory::Save(), TechDraw::CenterLine::Save(), TechDraw::Generic::Save(), App::PropertyContainer::Save(), App::PropertyFileIncluded::Save(), App::PropertyEnumeration::Save(), App::PropertyIntegerSet::Save(), App::PropertyMap::Save(), Inspection::PropertyDistanceList::Save(), Part::PropertyGeometryList::Save(), Points::PropertyGreyValueList::Save(), Spreadsheet::PropertyColumnWidths::Save(), Spreadsheet::PropertyRowHeights::Save(), TechDraw::PropertyCenterLineList::Save(), TechDraw::PropertyCosmeticEdgeList::Save(), TechDraw::PropertyCosmeticVertexList::Save(), TechDraw::PropertyGeomFormatList::Save(), App::PropertyExpressionEngine::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::PropertyPersistentObject::Save(), Sketcher::PropertyConstraintList::Save(), Spreadsheet::PropertySheet::Save(), Gui::Document::SaveDocFile(), App::ExtensionContainer::saveExtensions(), MeshCore::MeshOutput::SaveXML(), and App::Document::writeObjects().
std::vector< std::string > Writer::getErrors | ( | ) | const |
References Errors.
const std::vector< std::string > & Writer::getFilenames | ( | ) | const |
get all registered file names
References FileNames.
int Writer::getFileVersion | ( | ) | const |
References fileVersion.
Referenced by App::Document::Save().
bool Writer::getMode | ( | const std::string & | mode | ) | const |
Get mode.
References Modes.
Referenced by Part::PropertyPartShape::Save(), and Part::PropertyPartShape::SaveDocFile().
std::set< std::string > Writer::getModes | ( | ) | const |
|
protected |
References Base::FileInfo::extension(), Base::FileInfo::fileNamePure(), FileNames, DraftVecUtils::find(), Base::Tools::getUniqueName(), and Base::FileInfo::setFile().
Referenced by addFile().
bool Writer::hasErrors | ( | ) | const |
References Errors.
Referenced by App::Document::saveToFile().
void Writer::incInd | ( | ) |
increase indentation by one tab
References indBuf, and indent.
Referenced by Spreadsheet::PropertySheet::copyCells(), Gui::Document::exportObjects(), Part::Geometry::Save(), Part::GeomBSplineCurve::Save(), Path::Toolpath::Save(), Path::Tooltable::Save(), Robot::Trajectory::Save(), TechDraw::CenterLine::Save(), TechDraw::Generic::Save(), App::PropertyContainer::Save(), App::PropertyFileIncluded::Save(), App::PropertyEnumeration::Save(), App::PropertyIntegerSet::Save(), App::PropertyMap::Save(), Inspection::PropertyDistanceList::Save(), Part::PropertyGeometryList::Save(), Points::PropertyGreyValueList::Save(), Spreadsheet::PropertyColumnWidths::Save(), Spreadsheet::PropertyRowHeights::Save(), TechDraw::PropertyCenterLineList::Save(), TechDraw::PropertyCosmeticEdgeList::Save(), TechDraw::PropertyCosmeticVertexList::Save(), TechDraw::PropertyGeomFormatList::Save(), App::PropertyExpressionEngine::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::PropertyPersistentObject::Save(), Sketcher::PropertyConstraintList::Save(), Spreadsheet::PropertySheet::Save(), Gui::Document::SaveDocFile(), App::ExtensionContainer::saveExtensions(), MeshCore::MeshOutput::SaveXML(), and App::Document::writeObjects().
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().
void Writer::insertAsciiFile | ( | const char * | FileName | ) |
insert a file as CDATA section in the XML file
References Stream().
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().
bool Writer::isForceXML | ( | ) |
check on state
References forceXML.
Referenced by addFile(), Gui::Document::exportObjects(), Fem::FemMesh::Save(), Path::Toolpath::Save(), App::PropertyFileIncluded::Save(), Gui::Document::Save(), Gui::Thumbnail::Save(), Fem::PropertyPostDataObject::Save(), Inspection::PropertyDistanceList::Save(), Mesh::PropertyNormalList::Save(), Mesh::PropertyCurvatureList::Save(), Mesh::PropertyMeshKernel::Save(), Part::PropertyPartShape::Save(), Part::PropertyFilletEdges::Save(), Points::PointKernel::Save(), Points::PropertyGreyValueList::Save(), Points::PropertyNormalList::Save(), Points::PropertyCurvatureList::Save(), App::PropertyVectorList::Save(), App::PropertyPlacementList::Save(), App::PropertyFloatList::Save(), App::PropertyColorList::Save(), App::PropertyMaterialList::Save(), and Gui::Document::SaveDocFile().
void Writer::setFileVersion | ( | int | v | ) |
References fileVersion.
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().
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().
void Writer::setModes | ( | const std::set< std::string > & | modes | ) |
|
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().
|
pure virtual |
process the requested file storing
Implemented in Base::ZipWriter, Base::StringWriter, Base::FileWriter, Gui::RecoveryWriter, and Cloud::CloudWriter.
|
protected |
Referenced by addError(), clearErrors(), getErrors(), and hasErrors().
|
protected |
|
protected |
Referenced by addFile(), getFilenames(), and getUniqueFileName().
|
protected |
Referenced by getFileVersion(), and setFileVersion().
|
protected |
Referenced by isForceXML(), and setForceXML().
|
protected |
Referenced by clearMode(), clearModes(), getMode(), getModes(), setMode(), and setModes().
std::string Base::Writer::ObjectName |
name for underlying file saves
Referenced by Path::Toolpath::Save(), and Points::PointKernel::Save().