当前位置: 首页>>代码示例>>C++>>正文


C++ writeAttribute函数代码示例

本文整理汇总了C++中writeAttribute函数的典型用法代码示例。如果您正苦于以下问题:C++ writeAttribute函数的具体用法?C++ writeAttribute怎么用?C++ writeAttribute使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了writeAttribute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: writeAttribute

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);
}
开发者ID:SadTigger,项目名称:kbe,代码行数:9,代码来源:gwfstreamwriter.cpp

示例2: writeStartElement

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();
    }
开发者ID:SadTigger,项目名称:kbe,代码行数:11,代码来源:gwfstreamwriter.cpp

示例3: attribute

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;
}
开发者ID:siamect,项目名称:proview,代码行数:49,代码来源:wb_session.cpp

示例4: time_GetTime

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);
}
开发者ID:siamect,项目名称:proview,代码行数:25,代码来源:wb_session.cpp

示例5: IRR_ASSERT

		//! 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;
		}
开发者ID:CowPlay,项目名称:engineSDK,代码行数:33,代码来源:CXMLWriter.cpp

示例6: foreach

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();
}
开发者ID:NeutronStein,项目名称:jreen,代码行数:16,代码来源:bookmarkfactory.cpp

示例7: writeDom

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;
}
开发者ID:DchunWang,项目名称:TTKMusicplayer,代码行数:7,代码来源:musicabstractxml.cpp

示例8: addDevToGrpDialog

/*
 * 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;
}
开发者ID:byteworks-ch,项目名称:esos,代码行数:38,代码来源:menu_actions-alua.c

示例9: remDevGrpDialog

/*
 * 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;
}
开发者ID:byteworks-ch,项目名称:esos,代码行数:38,代码来源:menu_actions-alua.c

示例10: sizeof

//! 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;
}
开发者ID:John-He-928,项目名称:krkrz,代码行数:35,代码来源:CXMLWriter.cpp

示例11: H5Pset_obj_track_times

  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;
  }
开发者ID:voxie-viewer,项目名称:voxie,代码行数:9,代码来源:Matlab.cpp

示例12: setDevice

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;
}
开发者ID:ChowZenki,项目名称:psi,代码行数:19,代码来源:optionstreewriter.cpp

示例13: setCodec

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;
}
开发者ID:SadTigger,项目名称:kbe,代码行数:11,代码来源:gwfstreamwriter.cpp

示例14: writeAttribute

  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);
  }
开发者ID:voxie-viewer,项目名称:voxie,代码行数:11,代码来源:Matlab.cpp

示例15: writeAttributes

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 << "]";
}
开发者ID:marvin2k,项目名称:ogdf,代码行数:51,代码来源:GraphIO_dot.cpp


注:本文中的writeAttribute函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。