Пример #1
0
void GwfStreamWriter::writeObjectAttributes(SCgObject *obj)
{
    writeAttribute("type", mTypeAlias2GWFType[obj->typeAlias()]);
    writeAttribute("idtf", obj->idtfValue());
    writeAttribute("shapeColor", QString::number(obj->color().value()));
    writeAttribute("id", QString::number( obj->id() ));
    writeAttribute("parent", QString::number( obj->parentId() ));
    writeText(obj);
}
Пример #2
0
void daeLIBXMLPlugin::writeElement( daeElement* element )
{
	daeIntegrationObject* _intObject = element->getIntObject();
	daeMetaElement* _meta = element->getMeta();
	if(_intObject)
	{
		// added in response to bug 478
		_intObject->toCOLLADAChecked();
		_intObject->toCOLLADAPostProcessChecked();
	}
	if (!_meta->getIsTransparent() ) {
		if ( element->getElementName() ) {
			xmlTextWriterStartElement(writer, (xmlChar*)element->getElementName());
		}
		else {
            xmlTextWriterStartElement(writer, (xmlChar*)(daeString)_meta->getName());
		}
		daeMetaAttributeRefArray& attrs = _meta->getMetaAttributes();
		
		int acnt = (int)attrs.getCount();
		
		for(int i=0;i<acnt;i++) {
			writeAttribute( attrs[i], element);
		}
	}
	daeMetaAttribute* valueAttr = _meta->getValueAttribute();
	if (valueAttr!=NULL)
		writeAttribute(valueAttr, element);
	
	if (_meta->getContents() != NULL) {
		daeElementRefArray* era = (daeElementRefArray*)_meta->getContents()->getWritableMemory(element);
		int elemCnt = (int)era->getCount();
		for(int i = 0; i < elemCnt; i++) {
			daeElementRef elem = (daeElementRef)era->get(i);
			if (elem != NULL) {
				writeElement( elem );
			}
		}
	}
	else
	{
		daeMetaElementAttributeArray& children = _meta->getMetaElements();
		int cnt = (int)children.getCount();
		for(int i=0;i<cnt;i++) {
			daeMetaElement *type = children[i]->getElementType();
			if ( !type->getIsAbstract() ) {
				for (int c = 0; c < children[i]->getCount(element); c++ ) {
					writeElement( *(daeElementRef*)children[i]->get(element,c) );
				}
			}
		}
	}
	if (!_meta->getIsTransparent() ) {
		xmlTextWriterEndElement(writer);
	}
}
Пример #3
0
void GwfStreamWriter::writePoints(const QVector<QPointF>& points)
{
    writeStartElement("points");

    foreach(const QPointF& point,points)
    {
        writeStartElement("point");
        writeAttribute("x", QString::number(point.x()));
        writeAttribute("y", QString::number(point.y()));
        writeEndElement();
    }
Пример #4
0
bool wb_session::castAttribute(pwr_sAttrRef* arp, pwr_tCid cid)
{
  wb_attribute a = attribute(arp);
  if (!a)
    return a.sts();

  if (!(a.flags() & PWR_MASK_CASTATTR)) {
    m_sts = 0;
    return false;
  }

  wb_cdef c = cdef(cid);
  // if ( c.size( pwr_eBix_rt) != a.size()) {
  //  m_sts = 0;
  //  return false;
  //}

  // pwr_tTid tid = a.tid();

  pwr_tCastId castid;
  if (cid == a.originalTid())
    castid = pwr_cNClassId;
  else
    castid = cid;

  pwr_sAttrRef cast_aref = cdh_ArefToCastAref(arp);
  wb_attribute cast_a = attribute(&cast_aref);
  if (!cast_a)
    return cast_a.sts();

  try {
    writeAttribute(cast_a, &castid);
  } catch (wb_error& e) {
    m_sts = e.sts();
    return false;
  }

  void* body = calloc(1, c.size(pwr_eBix_rt));
  c.attrTemplateBody(&m_sts, pwr_eBix_rt, body, a);

  try {
    writeAttribute(a, body);
  } catch (wb_error& e) {
    m_sts = e.sts();
    return false;
  }

  return true;
}
Пример #5
0
bool wb_session::commit()
{
  if (!m_vrep->erep()->check_lock((char*)m_vrep->name(), m_vrep->dbtype())) {
    m_sts = LDH__LOCKSTOLEN;
    return false;
  }

  // Store time in volume object
  pwr_tOid oid = pwr_cNOid;
  pwr_tTime time;

  time_GetTime(&time);
  oid.vid = m_vrep->vid();

  wb_orep* orep = m_vrep->object(&m_sts, oid);
  if (oddSts()) {
    orep->ref();
    wb_attribute modtime(m_sts, orep, "SysBody", "Modified");
    if (modtime.oddSts())
      writeAttribute(modtime, &time);
    orep->unref();
  }

  return m_srep->commit(&m_sts);
}
Пример #6
0
		//! Writes an xml element with any number of attributes
		void CXMLWriter::writeElement(const c8* name, bool empty,
				core::array<core::stringc> &names, core::array<core::stringc> &values)
		{
			IRR_ASSERT(sizeof(name) > 0);

			if (Tabs > 0)
			{
				for (int i = 0; i < Tabs; ++i)
					File->write("\t", sizeof(c8));
			}

			// write name

			File->write("<", sizeof(c8));
			File->write(name, strlen(name) * sizeof(c8));

			// write attributes
			u32 i = 0;
			for (; i < names.size() && i < values.size(); ++i)
				writeAttribute(names[i].cStr(), values[i].cStr());

			// write closing tag
			if (empty)
				File->write(" />", 3 * sizeof(c8));
			else
			{
				File->write(">", sizeof(c8));
				++Tabs;
			}

			TextWrittenLast = false;
		}
Пример #7
0
void BookmarkFactory::serialize(Payload *extension, QXmlStreamWriter *writer)
{
	Bookmark *bookmark = se_cast<Bookmark*>(extension);
	writer->writeStartElement(QLatin1String("storage"));
	writer->writeDefaultNamespace(NS_BOOKMARKS);
	foreach (const Bookmark::Conference &conf, bookmark->conferences()) {
		writer->writeStartElement(QLatin1String("conference"));
		writeAttribute(writer,QLatin1String("jid"), conf.jid().full());
		writeAttribute(writer,QLatin1String("name"), conf.name());
		writeAttribute(writer,QLatin1String("autojoin"), enumToStr(conf.autojoin(), autojoin_types));
		writeTextElement(writer,QLatin1String("nick"), conf.nick());
		writeTextElement(writer,QLatin1String("password"), conf.password());
		writer->writeEndElement();
	}
	writer->writeEndElement();
}
Пример #8
0
QDomElement MusicAbstractXml::writeDomElement(QDomElement &element, const QString &node,
                                              const QString &key, const QVariant &value)
{
    QDomElement domElement = writeDom(element, node);
    writeAttribute(domElement, key, value);
    return domElement;
}
Пример #9
0
/*
 * Run the Add Device to Group dialog
 */
void addDevToGrpDialog(CDKSCREEN *main_cdk_screen) {
    char device_name[MAX_SYSFS_ATTR_SIZE] = {0},
    dev_handler[MAX_SYSFS_ATTR_SIZE] = {0},
    dev_grp_name[MAX_SYSFS_ATTR_SIZE] = {0},
    attr_path[MAX_SYSFS_PATH_SIZE] = {0},
    attr_value[MAX_SYSFS_ATTR_SIZE] = {0};
    char *error_msg = NULL;
    int temp_int = 0;

    /* Have the user choose a SCST device */
    getSCSTDevChoice(main_cdk_screen, device_name, dev_handler);
    if (device_name[0] == '\0')
        return;

    /* Have the user choose a SCST device group (to add the device to) */
    getSCSTDevGrpChoice(main_cdk_screen, dev_grp_name);
    if (dev_grp_name[0] == '\0')
        return;

    /* Add the SCST device to the device group (ALUA) */
    snprintf(attr_path, MAX_SYSFS_PATH_SIZE,
            "%s/device_groups/%s/devices/mgmt",
            SYSFS_SCST_TGT, dev_grp_name);
    snprintf(attr_value, MAX_SYSFS_ATTR_SIZE, "add %s", device_name);
    if ((temp_int = writeAttribute(attr_path, attr_value)) != 0) {
        SAFE_ASPRINTF(&error_msg,
                "Couldn't add SCST (ALUA) device to device group: %s",
                strerror(temp_int));
        errorDialog(main_cdk_screen, error_msg, NULL);
        FREE_NULL(error_msg);
    }

    /* Done */
    return;
}
Пример #10
0
/*
 * Run the Remove Device Group dialog
 */
void remDevGrpDialog(CDKSCREEN *main_cdk_screen) {
    char dev_grp_name[MAX_SYSFS_ATTR_SIZE] = {0},
    attr_path[MAX_SYSFS_PATH_SIZE] = {0},
    attr_value[MAX_SYSFS_ATTR_SIZE] = {0};
    char *error_msg = NULL, *confirm_msg = NULL;
    boolean confirm = FALSE;
    int temp_int = 0;

    /* Have the user choose a SCST device group */
    getSCSTDevGrpChoice(main_cdk_screen, dev_grp_name);
    if (dev_grp_name[0] == '\0')
        return;

    /* Get a final confirmation from user before we delete */
    SAFE_ASPRINTF(&confirm_msg,
            "Are you sure you want to delete SCST device group '%s?'",
            dev_grp_name);
    confirm = confirmDialog(main_cdk_screen, confirm_msg, NULL);
    FREE_NULL(confirm_msg);
    if (confirm) {
        /* Delete the specified SCST device group */
        snprintf(attr_path, MAX_SYSFS_PATH_SIZE,
                "%s/device_groups/mgmt", SYSFS_SCST_TGT);
        snprintf(attr_value, MAX_SYSFS_ATTR_SIZE, "del %s", dev_grp_name);
        if ((temp_int = writeAttribute(attr_path, attr_value)) != 0) {
            SAFE_ASPRINTF(&error_msg, "Couldn't delete SCST (ALUA) device group: %s",
                    strerror(temp_int));
            errorDialog(main_cdk_screen, error_msg, NULL);
            FREE_NULL(error_msg);
        }
    }

    /* Done */
    return;
}
Пример #11
0
//! Writes an xml element with any number of attributes
void CXMLWriter::writeElement(const wchar_t* name, bool empty,
				  core::array<core::stringw> &names,
				  core::array<core::stringw> &values)
{
	if (!File || !name)
		return;

	if (Tabs > 0)
	{
		for (int i=0; i<Tabs; ++i)
			File->write(L"\t", sizeof(wchar_t));
	}
	
	// write name

	File->write(L"<", sizeof(wchar_t));
	File->write(name, wcslen(name)*sizeof(wchar_t));

	// write attributes
	u32 i=0;
	for (; i < names.size() && i < values.size(); ++i)
		writeAttribute(names[i].c_str(), values[i].c_str());

	// write closing tag
	if (empty)
		File->write(L" />", 3*sizeof(wchar_t));
	else
	{
		File->write(L">", sizeof(wchar_t));
		++Tabs;
	}
	
	TextWrittenLast = false;
}
Пример #12
0
  HDF5::Group MatlabSerializationContext::createMatlabGroup () const {
    // Disable time tracking for objects to make HDF5 files more deterministic
    GroupCreatePropList gcpl = GroupCreatePropList::create ();
    HDF5::Exception::check ("H5Pset_obj_track_times", H5Pset_obj_track_times (gcpl.handle (), false));

    HDF5::Group group = HDF5::Group::create (file (), gcpl);
    writeAttribute (group, "MATLAB_class", "struct");
    return group;
  }
Пример #13
0
bool OptionsTreeWriter::write(QIODevice* device)
{
	setDevice(device);

	// turn it off for even more speed
	setAutoFormatting(true);
	setAutoFormattingIndent(1);

	writeStartDocument();
	writeDTD(QString("<!DOCTYPE %1>").arg(configName_));
	writeStartElement(configName_);
	writeAttribute("version", configVersion_);
	writeAttribute("xmlns", configNS_);

	writeTree(&options_->tree_);

	writeEndDocument();
	return true;
}
Пример #14
0
void GwfStreamWriter::startWriting(const char* encoding)
{
    QTextCodec *codec = QTextCodec::codecForName(encoding);
    setCodec(codec);
    setAutoFormatting(true);
    writeStartDocument();
    writeStartElement("GWF");
    writeAttribute("version", "1.6");
    writeStartElement("staticSector");
    isWritingStarted = true;
}
Пример #15
0
  void MatlabSerializer<bool>::h5MatlabSave (const MatlabSerializationContextHandle& handle, const bool& b) {
    //HDF5::DataSpace dataSpace = HDF5::DataSpace::create (H5S_SCALAR); // Matlab (7.5) cannot read this
    HDF5::DataSpace dataSpace = HDF5::DataSpace::createSimple (1);

    uint8_t data = b ? 1 : 0;
    HDF5::DataType dt = getH5Type<uint8_t> ();
    HDF5::DataSet dataSet = handle.createDataSet (dt, dataSpace);
    writeAttribute (dataSet, "MATLAB_class", "logical");
    writeScalarAttribute<int32_t> (dataSet, "MATLAB_int_decode", 1);
    dataSet.write (&data, dt, dataSpace);
  }
Пример #16
0
static inline void writeAttributes(
	std::ostream &out,
	const GraphAttributes &GA, const edge &e)
{
	const long flags = GA.attributes();

	out << "[";

	bool comma = false; // Whether to put comma before attribute.

	if(flags & GraphAttributes::edgeLabel) {
		writeAttribute(out, comma, "label", GA.label(e));
	}

	if(flags & GraphAttributes::edgeDoubleWeight) {
		writeAttribute(out, comma, "weight", GA.doubleWeight(e));
	} else if(flags & GraphAttributes::edgeIntWeight) {
		writeAttribute(out, comma, "weight", GA.intWeight(e));
	}

	if(flags & GraphAttributes::edgeGraphics) {
		// This should be legal cubic B-Spline in the future.
		std::stringstream sstream;
		for(const DPoint &p : GA.bends(e)) {
			sstream << p.m_x << "," << p.m_y << " ";
		}

		writeAttribute(out, comma, "pos", sstream.str());
	}

	if(flags & GraphAttributes::edgeArrow) {
		writeAttribute(out, comma, "dir", dot::toString(GA.arrowType(e)));
	}

	if(flags & GraphAttributes::edgeStyle) {
		writeAttribute(out, comma, "color", GA.strokeColor(e));
	}

	if(flags & GraphAttributes::edgeType) {
		writeAttribute(out, comma, "arrowhead", GA.arrowType(e));

		// Additionaly, according to IBM UML doc dependency is a dashed edge.
		if(GA.type(e) == Graph::dependency) {
			writeAttribute(out, comma, "style", "dashed");
		}
	}

	// NOTE: Edge subgraphs are not supported.

	out << "]";
}
Пример #17
0
//! [2]
void XbelWriter::writeItem(QTreeWidgetItem *item)
{
    QString tagName = item->data(0, Qt::UserRole).toString();
    if (tagName == "folder") {
        bool folded = !treeWidget->isItemExpanded(item);
        writeStartElement(tagName);
        writeAttribute("folded", folded ? "yes" : "no");
        writeTextElement("title", item->text(0));
        for (int i = 0; i < item->childCount(); ++i)
            writeItem(item->child(i));
        writeEndElement();
    } else if (tagName == "bookmark") {
        writeStartElement(tagName);
        if (!item->text(1).isEmpty())
            writeAttribute("href", item->text(1));
        writeTextElement("title", item->text(0));
        writeEndElement();
    } else if (tagName == "separator") {
        writeEmptyElement(tagName);
    }
}
Пример #18
0
void GwfStreamWriter::writeBus(SCgObject *obj)
{
    writeStartElement("bus");
    writeObjectAttributes(obj);
    SCgBus* bus = static_cast<SCgBus*>(obj);

    writeAttribute("owner", QString::number(bus->owner()->id()));

    QVector<QPointF> points = bus->scenePoints();
    writeAttribute("b_x", QString::number(points.first().x()));
    writeAttribute("b_y", QString::number(points.first().y()));
    writeAttribute("e_x", QString::number(points.last().x()));
    writeAttribute("e_y", QString::number(points.last().y()));

    // do not save begin and end points
    points.pop_back();
    points.pop_front();
    writePoints(points);

    writeEndElement();
}
Пример #19
0
static void
writeAttributes(template_t *t, tfile_t *tf)
{
	evl_list_t *head = t->tm_attributes;
	evl_listnode_t *p, *end;
	int nAttrs = _evlGetListSize(head);

	writeScalar(nAttrs, tf);
	for (p=head, end=NULL; p!=end; end=head, p=p->li_next) {
		writeAttribute((tmpl_attribute_t*) p->li_data, t, tf);
	}
}
Пример #20
0
void QhpWriter::writeCustomFilters()
{
    if (!m_customFilters.count())
        return;

    foreach (const CustomFilter &f, m_customFilters) {
        writeStartElement(QLatin1String("customFilter"));
        writeAttribute(QLatin1String("name"), f.name);
        foreach (const QString &a, f.filterAttributes)
            writeTextElement(QLatin1String("filterAttribute"), a);
        writeEndElement();
    }
Пример #21
0
QString QxXmlWriter::writeBinaryData(const QString & qualifiedName, QxXmlWriter::type_byte_arr_ptr pData)
{
   QString sKey(getNextKeyBinaryData());
   m_mapBinaryData.insert(sKey, pData);

   writeStartElement(qualifiedName);
   writeAttribute(QX_XML_ATTRIBUTE_IS_BINARY_DATA, "1");
   writeCharacters(sKey);
   writeEndElement();

   return sKey;
}
Пример #22
0
//! Writes an xml element with maximal 5 attributes
void CXMLWriter::writeElement(const wchar_t* name, bool empty,
	const wchar_t* attr1Name, const wchar_t* attr1Value,
	const wchar_t* attr2Name, const wchar_t* attr2Value,
	const wchar_t* attr3Name, const wchar_t* attr3Value,
	const wchar_t* attr4Name, const wchar_t* attr4Value,
	const wchar_t* attr5Name, const wchar_t* attr5Value)
{
	if (!File || !name)
		return;

	if (Tabs > 0)
	{
		for (int i=0; i<Tabs; ++i)
			File->write(L"\t", sizeof(wchar_t));
	}
	
	// write name

	File->write(L"<", sizeof(wchar_t));
	File->write(name, wcslen(name)*sizeof(wchar_t));

	// write attributes

	writeAttribute(attr1Name, attr1Value);
	writeAttribute(attr2Name, attr2Value);
	writeAttribute(attr3Name, attr3Value);
	writeAttribute(attr4Name, attr4Value);
	writeAttribute(attr5Name, attr5Value);

	// write closing tag
	if (empty)
		File->write(L" />", 3*sizeof(wchar_t));
	else
	{
		File->write(L">", sizeof(wchar_t));
		++Tabs;
	}
	
	TextWrittenLast = false;
}
Пример #23
0
/*
 * Run the Remove Target from Group dialog
 */
void remTgtFromGrpDialog(CDKSCREEN *main_cdk_screen) {
    char dev_grp_name[MAX_SYSFS_ATTR_SIZE] = {0},
    tgt_grp_name[MAX_SYSFS_ATTR_SIZE] = {0},
    target_name[MAX_SYSFS_ATTR_SIZE] = {0},
    attr_path[MAX_SYSFS_PATH_SIZE] = {0},
    attr_value[MAX_SYSFS_ATTR_SIZE] = {0};
    char *error_msg = NULL, *confirm_msg = NULL;
    boolean confirm = FALSE;
    int temp_int = 0;

    /* Have the user choose a SCST device group */
    getSCSTDevGrpChoice(main_cdk_screen, dev_grp_name);
    if (dev_grp_name[0] == '\0')
        return;

    /* Get target group choice from user (based on previously
     * selected device group) */
    getSCSTTgtGrpChoice(main_cdk_screen, dev_grp_name, tgt_grp_name);
    if (tgt_grp_name[0] == '\0')
        return;

    /* Get target group choice from user (based on previously
     * selected device group) */
    getSCSTTgtGrpTgtChoice(main_cdk_screen, dev_grp_name, tgt_grp_name,
            target_name);
    if (target_name[0] == '\0')
        return;

    /* Get a final confirmation from user before we delete */
    SAFE_ASPRINTF(&confirm_msg, "target '%s' from group '%s?'",
            target_name, tgt_grp_name);
    confirm = confirmDialog(main_cdk_screen,
            "Are you sure you want to remove SCST", confirm_msg);
    FREE_NULL(confirm_msg);
    if (confirm) {
        /* Remove the SCST target from the target group (ALUA) */
        snprintf(attr_path, MAX_SYSFS_PATH_SIZE,
                "%s/device_groups/%s/target_groups/%s/mgmt",
                SYSFS_SCST_TGT, dev_grp_name, tgt_grp_name);
        snprintf(attr_value, MAX_SYSFS_ATTR_SIZE, "del %s", target_name);
        if ((temp_int = writeAttribute(attr_path, attr_value)) != 0) {
            SAFE_ASPRINTF(&error_msg,
                    "Couldn't delete SCST (ALUA) target from target group: %s",
                    strerror(temp_int));
            errorDialog(main_cdk_screen, error_msg, NULL);
            FREE_NULL(error_msg);
        }
    }

    /* Done */
    return;
}
Пример #24
0
/*
 * Run the Add Device Group dialog
 */
void addDevGrpDialog(CDKSCREEN *main_cdk_screen) {
    CDKENTRY *dev_grp_name_entry = 0;
    char attr_path[MAX_SYSFS_PATH_SIZE] = {0},
            attr_value[MAX_SYSFS_ATTR_SIZE] = {0};
    char *dev_grp_name = NULL, *error_msg = NULL;
    int temp_int = 0;

    while (1) {
        /* Get new device group name (entry widget) */
        dev_grp_name_entry = newCDKEntry(main_cdk_screen, CENTER, CENTER,
                "<C></31/B>Add New Device Group\n",
                "</B>New Group Name (no spaces): ",
                COLOR_DIALOG_SELECT, '_' | COLOR_DIALOG_INPUT, vMIXED,
                SCST_DEV_GRP_NAME_LEN, 0, SCST_DEV_GRP_NAME_LEN, TRUE, FALSE);
        if (!dev_grp_name_entry) {
            errorDialog(main_cdk_screen, ENTRY_ERR_MSG, NULL);
            break;
        }
        setCDKEntryBoxAttribute(dev_grp_name_entry, COLOR_DIALOG_BOX);
        setCDKEntryBackgroundAttrib(dev_grp_name_entry, COLOR_DIALOG_TEXT);

        /* Draw the entry widget */
        curs_set(1);
        dev_grp_name = activateCDKEntry(dev_grp_name_entry, 0);

        /* Check exit from widget */
        if (dev_grp_name_entry->exitType == vNORMAL) {
            /* Check group name for bad characters */
            if (!checkInputStr(main_cdk_screen, NAME_CHARS, dev_grp_name))
                break;

            /* Add the new device group */
            snprintf(attr_path, MAX_SYSFS_PATH_SIZE,
                    "%s/device_groups/mgmt", SYSFS_SCST_TGT);
            snprintf(attr_value, MAX_SYSFS_ATTR_SIZE,
                    "create %s", dev_grp_name);
            if ((temp_int = writeAttribute(attr_path, attr_value)) != 0) {
                SAFE_ASPRINTF(&error_msg,
                        "Couldn't add SCST (ALUA) device group: %s",
                        strerror(temp_int));
                errorDialog(main_cdk_screen, error_msg, NULL);
                FREE_NULL(error_msg);
            }
        }
        break;
    }

    /* Done */
    destroyCDKEntry(dev_grp_name_entry);
    return;
}
Пример #25
0
		//! Writes an xml element with maximal 5 attributes
		void CXMLWriter::writeElement(const c8* name, bool empty,
				const c8* attr1Name, const c8* attr1Value, const c8* attr2Name,
				const c8* attr2Value, const c8* attr3Name, const c8* attr3Value,
				const c8* attr4Name, const c8* attr4Value, const c8* attr5Name,
				const c8* attr5Value)
		{
			IRR_ASSERT(sizeof(name) > 0);

			if (Tabs > 0)
			{
				for (int i = 0; i < Tabs; ++i)
					File->write("\t", sizeof(c8));
			}

			// write name

			File->write("<", sizeof(c8));
			File->write(name, strlen(name) * sizeof(c8));

			// write attributes

			writeAttribute(attr1Name, attr1Value);
			writeAttribute(attr2Name, attr2Value);
			writeAttribute(attr3Name, attr3Value);
			writeAttribute(attr4Name, attr4Value);
			writeAttribute(attr5Name, attr5Value);

			// write closing tag
			if (empty)
				File->write(" />", 3 * sizeof(c8));
			else
			{
				File->write(">", sizeof(c8));
				++Tabs;
			}

			TextWrittenLast = false;
		}
Пример #26
0
//! [1]
bool XbelWriter::writeFile(QIODevice *device)
{
    setDevice(device);

    writeStartDocument();
    writeDTD("<!DOCTYPE xbel>");
    writeStartElement("xbel");
    writeAttribute("version", "1.0");
    for (int i = 0; i < treeWidget->topLevelItemCount(); ++i)
        writeItem(treeWidget->topLevelItem(i));

    writeEndDocument();
    return true;
}
Пример #27
0
QDomElement MusicAbstractXml::writeDomElementMutil(QDomElement &element, const QString &node,
                                                   const QStringList &keys,
                                                   const QList<QVariant> &values)
{
    Q_ASSERT(!keys.isEmpty());
    Q_ASSERT(!values.isEmpty());

    QDomElement domElement = writeDomElement(element, node, keys.front(), values.front());
    for(int i=1; i<keys.count(); ++i)
    {
        writeAttribute(domElement, keys[i], values[i]);
    }
    return domElement;
}
Пример #28
0
void GwfStreamWriter::writeNode( SCgObject *obj)
{
    writeStartElement("node");
    writeObjectAttributes(obj);
    writePosition(obj, "x", "y");

    SCgNode *node = static_cast<SCgNode*>(obj);

    writeAttribute("haveBus", node->bus() ? "true" : "false");

    writeContent(node);

    writeEndElement();//node
}
Пример #29
0
void CSharpWriter::writeAttributes(UMLAttributeList &atList, QTextStream &cs) {

    for (UMLAttribute *at = atList.first(); at ; at = atList.next()) {

        bool asProperty = true;
        if (at->getVisibility() == Uml::Visibility::Private) {
            asProperty = false;
        }
        writeAttribute(at->getDoc(), at->getVisibility(), at->getStatic(),
            makeLocalTypeName(at), at->getName(), at->getInitialValue(), asProperty, cs);

        cs << m_endl;
    } // end for
    return;
}
Пример #30
0
void XbelWriter::writeToFile(QIODevice *device)
{
    TRACE_OBJ
    setDevice(device);

    writeStartDocument();
    writeDTD(QLatin1String("<!DOCTYPE xbel>"));
    writeStartElement(QLatin1String("xbel"));
    writeAttribute(QLatin1String("version"), QLatin1String("1.0"));

    const QModelIndex &root = bookmarkModel->index(0,0, QModelIndex());
    for (int i = 0; i < bookmarkModel->rowCount(root); ++i)
        writeData(bookmarkModel->index(i, 0, root));
    writeEndDocument();
}