本文整理汇总了C++中base::Writer::isForceXML方法的典型用法代码示例。如果您正苦于以下问题:C++ Writer::isForceXML方法的具体用法?C++ Writer::isForceXML怎么用?C++ Writer::isForceXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类base::Writer
的用法示例。
在下文中一共展示了Writer::isForceXML方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Save
void PropertyFileIncluded::Save (Base::Writer &writer) const
{
if (writer.isForceXML()) {
if (!_cValue.empty()) {
Base::FileInfo file(_cValue.c_str());
writer.Stream() << writer.ind() << "<FileIncluded data=\"" <<
file.fileName() << "\">" << std::endl;
// write the file in the XML stream
writer.incInd();
writer.insertBinFile(_cValue.c_str());
writer.decInd();
writer.Stream() << writer.ind() <<"</FileIncluded>" << endl;
}
else
writer.Stream() << writer.ind() << "<FileIncluded data=\"\"/>" << std::endl;
}
else {
// instead initiate an extra file
if (!_cValue.empty()) {
Base::FileInfo file(_cValue.c_str());
writer.Stream() << writer.ind() << "<FileIncluded file=\"" <<
writer.addFile(file.fileName().c_str(), this) << "\"/>" << std::endl;
}
else
writer.Stream() << writer.ind() << "<FileIncluded file=\"\"/>" << std::endl;
}
}
示例2: Save
void PropertyCurvatureList::Save (Base::Writer &writer) const
{
if (!writer.isForceXML()) {
writer.Stream() << writer.ind() << "<CurvatureList file=\"" <<
writer.addFile(getName(), this) << "\"/>" << std::endl;
}
}
示例3: Save
void PointKernel::Save (Base::Writer &writer) const
{
if (!writer.isForceXML()) {
writer.Stream() << writer.ind()
<< "<Points file=\"" << writer.addFile(writer.ObjectName.c_str(), this) << "\" "
<< "mtrx=\"" << _Mtrx.toString() << "\"/>" << std::endl;
}
}
示例4: Save
void PropertyPartShape::Save (Base::Writer &writer) const
{
if(!writer.isForceXML()) {
//See SaveDocFile(), RestoreDocFile()
writer.Stream() << writer.ind() << "<Part file=\""
<< writer.addFile("PartShape.brp", this)
<< "\"/>" << std::endl;
}
}
示例5: SaveDocFile
/**
* Saves the properties of the view providers.
*/
void Document::SaveDocFile (Base::Writer &writer) const
{
writer.Stream() << "<?xml version='1.0' encoding='utf-8'?>" << std::endl
<< "<!--" << std::endl
<< " FreeCAD Document, see http://free-cad.sourceforge.net for more information..."
<< std::endl << "-->" << std::endl;
writer.Stream() << "<Document SchemaVersion=\"1\">" << std::endl;
std::map<const App::DocumentObject*,ViewProviderDocumentObject*>::const_iterator it;
// writing the view provider names itself
writer.incInd(); // indention for 'ViewProviderData Count'
writer.Stream() << writer.ind() << "<ViewProviderData Count=\""
<< d->_ViewProviderMap.size() <<"\">" << std::endl;
bool xml = writer.isForceXML();
//writer.setForceXML(true);
writer.incInd(); // indention for 'ViewProvider name'
for(it = d->_ViewProviderMap.begin(); it != d->_ViewProviderMap.end(); ++it) {
const App::DocumentObject* doc = it->first;
ViewProvider* obj = it->second;
writer.Stream() << writer.ind() << "<ViewProvider name=\""
<< doc->getNameInDocument() << "\" "
<< "expanded=\"" << (doc->testStatus(App::Expand) ? 1:0)
<< "\">" << std::endl;
obj->Save(writer);
writer.Stream() << writer.ind() << "</ViewProvider>" << std::endl;
}
writer.setForceXML(xml);
writer.decInd(); // indention for 'ViewProvider name'
writer.Stream() << writer.ind() << "</ViewProviderData>" << std::endl;
writer.decInd(); // indention for 'ViewProviderData Count'
// set camera settings
QString viewPos;
if (d->_pcAppWnd->sendHasMsgToActiveView("GetCamera")) {
const char* ppReturn=0;
d->_pcAppWnd->sendMsgToActiveView("GetCamera",&ppReturn);
// remove the first line because it's a comment like '#Inventor V2.1 ascii'
QStringList lines = QString(QString::fromAscii(ppReturn)).split(QLatin1String("\n"));
if (lines.size() > 1) {
lines.pop_front();
viewPos = lines.join(QLatin1String(" "));
}
}
writer.incInd(); // indention for camera settings
writer.Stream() << writer.ind() << "<Camera settings=\""
<< (const char*)viewPos.toAscii() <<"\"/>" << std::endl;
writer.decInd(); // indention for camera settings
writer.Stream() << "</Document>" << std::endl;
}
示例6: Save
void PropertyGreyValueList::Save (Base::Writer &writer) const
{
if (writer.isForceXML()) {
writer.Stream() << writer.ind() << "<FloatList count=\"" << getSize() <<"\">" << endl;
writer.incInd();
for(int i = 0;i<getSize(); i++)
writer.Stream() << writer.ind() << "<F v=\"" << _lValueList[i] <<"\"/>" << endl; ;
writer.decInd();
writer.Stream() << writer.ind() <<"</FloatList>" << endl ;
}
else {
writer.Stream() << writer.ind() << "<FloatList file=\"" <<
writer.addFile(getName(), this) << "\"/>" << std::endl;
}
}
示例7: exportObjects
void Document::exportObjects(const std::vector<App::DocumentObject*>& obj, Base::Writer& writer)
{
writer.Stream() << "<?xml version='1.0' encoding='utf-8'?>" << std::endl;
writer.Stream() << "<Document SchemaVersion=\"1\">" << std::endl;
std::map<const App::DocumentObject*,ViewProvider*> views;
for (std::vector<App::DocumentObject*>::const_iterator it = obj.begin(); it != obj.end(); ++it) {
Document* doc = Application::Instance->getDocument((*it)->getDocument());
if (doc) {
ViewProvider* vp = doc->getViewProvider(*it);
if (vp) views[*it] = vp;
}
}
// writing the view provider names itself
writer.incInd(); // indention for 'ViewProviderData Count'
writer.Stream() << writer.ind() << "<ViewProviderData Count=\""
<< views.size() <<"\">" << std::endl;
bool xml = writer.isForceXML();
//writer.setForceXML(true);
writer.incInd(); // indention for 'ViewProvider name'
std::map<const App::DocumentObject*,ViewProvider*>::const_iterator jt;
for (jt = views.begin(); jt != views.end(); ++jt) {
const App::DocumentObject* doc = jt->first;
ViewProvider* obj = jt->second;
writer.Stream() << writer.ind() << "<ViewProvider name=\""
<< doc->getNameInDocument() << "\" type=\""
<< obj->getTypeId().getName()
<< "\">" << std::endl;
obj->Save(writer);
writer.Stream() << writer.ind() << "</ViewProvider>" << std::endl;
}
writer.setForceXML(xml);
writer.decInd(); // indention for 'ViewProvider name'
writer.Stream() << writer.ind() << "</ViewProviderData>" << std::endl;
writer.decInd(); // indention for 'ViewProviderData Count'
writer.incInd(); // indention for camera settings
writer.Stream() << writer.ind() << "<Camera settings=\"\"/>" << std::endl;
writer.decInd(); // indention for camera settings
writer.Stream() << "</Document>" << std::endl;
}
示例8: Save
/**
* Adds a separate XML file to the projects file that contains information about the view providers.
*/
void Document::Save (Base::Writer &writer) const
{
// It's only possible to add extra information if force of XML is disabled
if (writer.isForceXML() == false) {
writer.addFile("GuiDocument.xml", this);
if (App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/Document")->GetBool("SaveThumbnail",false)) {
std::list<MDIView*> mdi = getMDIViews();
for (std::list<MDIView*>::iterator it = mdi.begin(); it != mdi.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(View3DInventor::getClassTypeId())) {
View3DInventorViewer* view = static_cast<View3DInventor*>(*it)->getViewer();
d->thumb.setFileName(d->_pcDocument->FileName.getValue());
d->thumb.setSize(128);
d->thumb.setViewer(view);
d->thumb.Save(writer);
break;
}
}
}
}
}
示例9: Save
void PropertyFileIncluded::Save (Base::Writer &writer) const
{
// when saving a document under a new file name the transient directory
// name changes and thus the stored file name doesn't work any more.
if (!_cValue.empty() && !Base::FileInfo(_cValue).exists()) {
Base::FileInfo fi(getDocTransientPath() + "/" + _BaseFileName);
if (fi.exists())
_cValue = fi.filePath();
}
if (writer.isForceXML()) {
if (!_cValue.empty()) {
Base::FileInfo file(_cValue.c_str());
writer.Stream() << writer.ind() << "<FileIncluded data=\""
<< file.fileName() << "\">" << std::endl;
// write the file in the XML stream
writer.incInd();
writer.insertBinFile(_cValue.c_str());
writer.decInd();
writer.Stream() << writer.ind() <<"</FileIncluded>" << endl;
}
else {
writer.Stream() << writer.ind() << "<FileIncluded data=\"\"/>" << std::endl;
}
}
else {
// instead initiate an extra file
if (!_cValue.empty()) {
Base::FileInfo file(_cValue.c_str());
writer.Stream() << writer.ind() << "<FileIncluded file=\""
<< writer.addFile(file.fileName().c_str(), this) << "\"/>" << std::endl;
}
else {
writer.Stream() << writer.ind() << "<FileIncluded file=\"\"/>" << std::endl;
}
}
}
示例10: Save
void Thumbnail::Save (Base::Writer &writer) const
{
// It's only possible to add extra information if force of XML is disabled
if (writer.isForceXML() == false)
writer.addFile("thumbnails/Thumbnail.png", this);
}