コード例 #1
0
ファイル: XMLValueMap.cpp プロジェクト: equinoxefr/cbang
void XMLValueMap::writeXMLValue(XMLWriter &writer, const string &name,
                                const string &value) const {
  XMLAttributes attrs;
  attrs["v"] = value;
  writer.startElement(name, attrs);
  writer.endElement(name);
}
コード例 #2
0
void ViewInfo::WriteXMLAttributes(XMLWriter &xmlFile)
{
    selectedRegion.WriteXMLAttributes(xmlFile, wxT("sel0"), wxT("sel1"));
    xmlFile.WriteAttr(wxT("vpos"), vpos);
    xmlFile.WriteAttr(wxT("h"), h, 10);
    xmlFile.WriteAttr(wxT("zoom"), zoom, 10);
}
コード例 #3
0
ファイル: SilentBlockFile.cpp プロジェクト: MindFy/audacity
void SilentBlockFile::SaveXML(XMLWriter &xmlFile)
// may throw
{
   xmlFile.StartTag(wxT("silentblockfile"));

   xmlFile.WriteAttr(wxT("len"), mLen);

   xmlFile.EndTag(wxT("silentblockfile"));
}
コード例 #4
0
bool SceneSerializer::AddVector3Attribute(XMLWriter& writer, const float x, const float y, const float z)
{
	if(writer.AddAttribute(X, x))
		if(writer.AddAttribute(Y, y))
			if(writer.AddAttribute(Z, z))
				return true;

	return false;
}
コード例 #5
0
ファイル: Customer.cpp プロジェクト: bendova/MyCode
	void Customer::ToXML(XMLWriter& writer) const
	{
		writer.BeginElement(CUSTOMER_TAG);
		{
			writer.WriteElement(NAME_TAG, mName);
			writer.WriteElement(ADDRESS_TAG, mAddress);
			writer.WriteElement(DATA_TAG, mData);
		}
		writer.EndElement(CUSTOMER_TAG);
	}
コード例 #6
0
void SceneSerializer::SerializeGameObject(XMLWriter& writer, const SharedGameObject gameObject)
{
	Ogre::Vector3 position = gameObject->GetWorldPosition();
	Ogre::Vector3 scale = gameObject->GetWorldScale();
	Ogre::Quaternion rotation = gameObject->GetWorldOrientation();
	
	writer.CreateNode(GameObjectNode, std::string(""), true); writer.AddAttribute(ObjectName, gameObject->GetName());
	writer.AddAttribute(ObjectTag, gameObject->tag, false, false);

		//game object Transform
		writer.CreateNode(Position);
			AddVector3Attribute(writer, position);
		writer.PopNode();

		writer.CreateNode(Rotation, gameObject->GetInheritOrientation());
			AddVector4Attribute(writer, rotation.x, rotation.y, rotation.z, rotation.w);
		writer.PopNode();

		writer.CreateNode(Scale, gameObject->GetInheritScale());
			AddVector3Attribute(writer, scale);
		writer.PopNode();

	for (auto compIter = gameObject->components.begin(); compIter != gameObject->components.end(); ++compIter)
	{
		switch (compIter->second->GetComponentType())
		{
		case Component::AUDIO_COMPONENT:
			break;

		case Component::MESH_RENDER_COMPONENT:
			SerializeMeshRenderComponent(writer, (MeshRenderComponent*)compIter->second);
			break;

		case Component::PARTICLE_COMPONENT:
			SerializeParticleComponent(writer, (ParticleComponent*)compIter->second);
			break;

		case Component::RIGID_BODY_COMPONENT:
			SerializeRigidBodyComponent(writer, (RigidBodyComponent*)compIter->second);
			break;

		default:
			break;
		}
	}

	//Serialize Child Game Objects
	for (auto childStart = gameObject->children.begin();
		childStart != gameObject->children.end(); ++childStart)
	{
		SerializeGameObject(writer, *childStart);
	}

	writer.PopNode();
}
コード例 #7
0
ファイル: profiledb.cpp プロジェクト: Ginox/MoSync
void ProfileDB::dumpProfilesXML(vector<Profile*> profiles,
        map<string, Profile*> profileMappings, string profileName) {
	ostringstream output;
	XMLWriter writer = XMLWriter(&output);
	writer.start();
	writer.startTag("db");
	writer.setAttr("version", "1.0");
	writer.setAttr("id", "main");

	string line;

	if (profiles.size() > 0) {
		for (size_t i = 0; i < profiles.size(); i++) {
			Profile* profile = profiles.at(i);
			if (profile) {
				profile->toXML(writer, fIncludeCapabilities);
			}
		}
		if (fOutputMappings) {
			dumpProfileMappings(&writer, profileMappings);
		}
	} else {
		writer.startTag("error");
		writer.text(string("Could find no matching profile for ") + profileName);
		writer.endTag();
	}

	writer.endTag();

	printf("%s", output.str().c_str());
}
コード例 #8
0
bool vfs::PropertyContainer::writeToXMLFile(vfs::Path const& sFileName, vfs::PropertyContainer::TagMap& tagmap)
{
	XMLWriter xmlw;

	xmlw.openNode(tagmap.container());

	tSections::iterator sit = m_mapProps.begin();
	for(; sit != m_mapProps.end(); ++sit)
	{
		xmlw.addAttributeToNextValue(tagmap.sectionID(),sit->first.utf8());
		xmlw.openNode(tagmap.section());

		vfs::PropertyContainer::Section& section = sit->second;
		vfs::PropertyContainer::Section::tProps::iterator kit = section.mapProps.begin();
		for(; kit != section.mapProps.end(); ++kit)
		{
			xmlw.addAttributeToNextValue(tagmap.keyID(), kit->first.utf8());
			xmlw.addValue(tagmap.key(), kit->second.utf8());
		}

		xmlw.closeNode();

	}

	xmlw.closeNode();

	return xmlw.writeToFile(sFileName);
}
コード例 #9
0
bool SceneSerializer::SerializeScene(const IScene* scene, std::string rootNodeName, const std::string& fileName,
			const std::string& refCollection/* = std::string("")*/)
{
	//PxDataManSerializeOptions serialOptions = PxDataManSerializeOptions(PxDataManSerializeOptions::ALL,
		//PxDataCollection, true, fileName);
	StartID = PhysXSerializerWrapper::GetHighestIDInCollection(ActorCollection);

	pxDataRefCollection = refCollection;

	if(StartID < 1)
		StartID = 1;

	long long otherCollectionID = PhysXSerializerWrapper::GetHighestIDInCollection(refCollection);

	if(otherCollectionID < 1)
		otherCollectionID = 1;

	if(otherCollectionID > StartID)
		StartID = otherCollectionID + 1;

	if(PhysXSerializerWrapper::CreateSerializer() )//&& 
		//PhysXDataManager::GetSingletonPtr()->SerializeData(serialOptions))
	{
		XMLWriter writer;
	
		rootNodeName.erase(std::remove_if(rootNodeName.begin(), rootNodeName.end(), isspace), rootNodeName.end());

		if(	PhysXSerializerWrapper::CreateCollection(ActorCollection, true))
		{
			writer.CreateNode(rootNodeName, std::string(""), false);//Root node which is scene name

			for (GameObjectList::iterator start = scene->gameObjectList.begin();
				start != scene->gameObjectList.end(); ++start)
			{
				if(start->get()->IsSerializable())//if serializable, serialize
					SerializeGameObject(writer, *start);
			}

			//PhysXSerializerWrapper::CompleteCollection(ActorCollection, refCollection);

			bool serialize = PhysXSerializerWrapper::SerializeToBinary(fileName + "Actors.pbd",
				ActorCollection, refCollection);

			bool xml = writer.WriteFile(fileName + "Actors.xml");

			PhysXSerializerWrapper::ReleaseCollection(ActorCollection);
			PhysXSerializerWrapper::DestroySerializer();

			return serialize && xml;
		}		
	}

	return false;
}
コード例 #10
0
ファイル: TestResult.cpp プロジェクト: husninazer/qt
void TestResult::toXML(XMLWriter &receiver) const
{
    QXmlAttributes atts;
    atts.append(QLatin1String("name"), QString(), QLatin1String("name"), m_testName);
    atts.append(QLatin1String("result"), QString(), QLatin1String("result"), displayName(m_status));

    if(!m_comment.isEmpty())
        atts.append(QLatin1String("comment"), QString(), QLatin1String("comment"), m_comment);

    receiver.startElement(QLatin1String("test-case"), atts);
    receiver.endElement(QLatin1String("test-case"));
}
コード例 #11
0
ファイル: TimeTrack.cpp プロジェクト: ruthmagnus/audacity
void TimeTrack::WriteXML(XMLWriter &xmlFile)
{
   xmlFile.StartTag(wxT("timetrack"));

   xmlFile.WriteAttr(wxT("name"), mName);
   xmlFile.WriteAttr(wxT("channel"), mChannel);
   xmlFile.WriteAttr(wxT("offset"), mOffset, 8);

   mEnvelope->WriteXML(xmlFile);

   xmlFile.EndTag(wxT("timetrack"));
}
コード例 #12
0
ファイル: WaveClip.cpp プロジェクト: tuanmasterit/audacity
void WaveClip::WriteXML(XMLWriter &xmlFile)
{
   xmlFile.StartTag(wxT("waveclip"));
   xmlFile.WriteAttr(wxT("offset"), mOffset, 8);

   mSequence->WriteXML(xmlFile);
   mEnvelope->WriteXML(xmlFile);

   for (WaveClipList::compatibility_iterator it=mCutLines.GetFirst(); it; it=it->GetNext())
      it->GetData()->WriteXML(xmlFile);

   xmlFile.EndTag(wxT("waveclip"));
}
コード例 #13
0
ファイル: ODDecodeBlockFile.cpp プロジェクト: MindFy/audacity
/// Writes the xml as a SimpleBlockFile if we can (if we have a summary file)
/// Otherwise writes XML as a subset of attributes with 'odpcmaliasblockfile as the start tag.
/// Most notably, the summaryfile attribute refers to a file that does not yet, so when the project file is read back in
/// and this object reconstructed, it needs to avoid trying to open it as well as schedule itself for OD loading
void ODDecodeBlockFile::SaveXML(XMLWriter &xmlFile)
// may throw
{
   auto locker = LockForRead();
   if(IsSummaryAvailable())
   {
      SimpleBlockFile::SaveXML(xmlFile);
   }
   else
   {
      xmlFile.StartTag(wxT("oddecodeblockfile"));
      {
         //unlock to prevent deadlock and resume lock after.
         auto suspension = locker.Suspend();
         ODLocker locker2{ &mFileNameMutex };
         xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName());
      }
      xmlFile.WriteAttr(wxT("audiofile"), mAudioFileName.GetFullPath());
      xmlFile.WriteAttr(wxT("aliasstart"),
                        mAliasStart.as_long_long());
      xmlFile.WriteAttr(wxT("aliaslen"), mLen);
      xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
      xmlFile.WriteAttr(wxT("decodetype"), (size_t)mType);

      xmlFile.EndTag(wxT("oddecodeblockfile"));
   }
}
コード例 #14
0
/// Writes the xml as a SimpleBlockFile if we can (if we have a summary file)
/// Otherwise writes XML as a subset of attributes with 'odpcmaliasblockfile as the start tag.
/// Most notably, the summaryfile attribute refers to a file that does not yet, so when the project file is read back in
/// and this object reconstructed, it needs to avoid trying to open it as well as schedule itself for OD loading
void ODDecodeBlockFile::SaveXML(XMLWriter &xmlFile)
{
   LockRead();
   if(IsSummaryAvailable())
   {
      SimpleBlockFile::SaveXML(xmlFile);
   }
   else
   {
      xmlFile.StartTag(wxT("oddecodeblockfile"));
       //unlock to prevent deadlock and resume lock after.
      UnlockRead();
      mFileNameMutex.Lock();
      xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName());
      mFileNameMutex.Unlock();
      LockRead();
      xmlFile.WriteAttr(wxT("audiofile"), mAudioFileName.GetFullPath());
      xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
      xmlFile.WriteAttr(wxT("aliaslen"), mLen);
      xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
      xmlFile.WriteAttr(wxT("decodetype"), (size_t)mType);

      xmlFile.EndTag(wxT("oddecodeblockfile"));
   }
   UnlockRead();
}
コード例 #15
0
void LegacyAliasBlockFile::SaveXML(XMLWriter &xmlFile)
{
   xmlFile.StartTag(wxT("legacyblockfile"));
   
   xmlFile.WriteAttr(wxT("alias"), 1);
   xmlFile.WriteAttr(wxT("name"), mFileName.GetFullName());
   xmlFile.WriteAttr(wxT("aliaspath"), mAliasedFileName.GetFullPath());
   xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
   xmlFile.WriteAttr(wxT("aliaslen"), mLen);
   xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
   xmlFile.WriteAttr(wxT("summarylen"), mSummaryInfo.totalSummaryBytes);
   if (mSummaryInfo.fields < 3)
      xmlFile.WriteAttr(wxT("norms"), 1);

   xmlFile.EndTag(wxT("legacyblockfile"));
}
コード例 #16
0
/// Writes the xml as a PCMAliasBlockFile if we can (if we have a summary file)
/// Otherwise writes XML as a subset of attributes with 'odpcmaliasblockfile as the start tag.
/// Most notably, the summaryfile attribute refers to a file that does not yet, so when the project file is read back in
/// and this object reconstructed, it needs to avoid trying to open it as well as schedule itself for OD loading
void ODPCMAliasBlockFile::SaveXML(XMLWriter &xmlFile)
{
   //we lock this so that mAliasedFileName doesn't change.
   mReadDataMutex.Lock();
   if(IsSummaryAvailable())
   {
      PCMAliasBlockFile::SaveXML(xmlFile);
      mHasBeenSaved = true;
   }
   else
   {
      xmlFile.StartTag(wxT("odpcmaliasblockfile"));

      //unlock to prevent deadlock and resume lock after.
      mReadDataMutex.Unlock();
      mFileNameMutex.Lock();
      xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName());
      mFileNameMutex.Unlock();
      mReadDataMutex.Lock();
      
      xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath());
      xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
      xmlFile.WriteAttr(wxT("aliaslen"), mLen);
      xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
      //these have not been computed yet.
      //xmlFile.WriteAttr(wxT("min"), mMin);
      //xmlFile.WriteAttr(wxT("max"), mMax);
     // xmlFile.WriteAttr(wxT("rms"), mRMS);

      xmlFile.EndTag(wxT("odpcmaliasblockfile"));
   }
   
   mReadDataMutex.Unlock();
}
コード例 #17
0
ファイル: ODPCMAliasBlockFile.cpp プロジェクト: aeve/audacity
/// Writes the xml as a PCMAliasBlockFile if we can (if we have a summary file)
/// Otherwise writes XML as a subset of attributes with 'odpcmaliasblockfile as the start tag.
/// Most notably, the summaryfile attribute refers to a file that does not yet, so when the project file is read back in
/// and this object reconstructed, it needs to avoid trying to open it as well as schedule itself for OD loading
void ODPCMAliasBlockFile::SaveXML(XMLWriter &xmlFile)
{
   //we lock this so that mAliasedFileName doesn't change.
   LockRead();
   if(IsSummaryAvailable())
   {
      PCMAliasBlockFile::SaveXML(xmlFile);
      mHasBeenSaved = true;
   }
   else
   {
      xmlFile.StartTag(wxT("odpcmaliasblockfile"));

      //unlock to prevent deadlock and resume lock after.
      UnlockRead();
      mFileNameMutex.Lock();
      xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName());
      mFileNameMutex.Unlock();
      LockRead();

      xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath());
      xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
      xmlFile.WriteAttr(wxT("aliaslen"), mLen);
      xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);

      xmlFile.EndTag(wxT("odpcmaliasblockfile"));
   }

   UnlockRead();
}
コード例 #18
0
/// Writes the xml as a PCMAliasBlockFile if we can (if we have a summary file)
/// Otherwise writes XML as a subset of attributes with 'odpcmaliasblockfile as the start tag.
/// Most notably, the summaryfile attribute refers to a file that does not yet exist, so when the project file is read back in
/// and this object reconstructed, it needs to avoid trying to open it as well as schedule itself for OD loading
void ODPCMAliasBlockFile::SaveXML(XMLWriter &xmlFile)
// may throw
{
   //we lock this so that mAliasedFileName doesn't change.
   auto locker = LockForRead();
   if(IsSummaryAvailable())
   {
      PCMAliasBlockFile::SaveXML(xmlFile);
      mHasBeenSaved = true;
   }
   else
   {
      xmlFile.StartTag(wxT("odpcmaliasblockfile"));

      //unlock to prevent deadlock and resume lock after.
      {
         auto suspension = locker.Suspend();
         ODLocker locker2 { &mFileNameMutex };
         xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName());
      }

      xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath());
      xmlFile.WriteAttr(wxT("aliasstart"),
                        mAliasStart.as_long_long());
      xmlFile.WriteAttr(wxT("aliaslen"), mLen);
      xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);

      xmlFile.EndTag(wxT("odpcmaliasblockfile"));
   }
}
コード例 #19
0
void FFmpegPresets::WriteXMLHeader(XMLWriter &xmlFile)
{
   xmlFile.Write(wxT("<?xml "));
   xmlFile.Write(wxT("version=\"1.0\" "));
   xmlFile.Write(wxT("standalone=\"no\" "));
   xmlFile.Write(wxT("?>\n"));

   wxString dtdName = wxT("-//audacityffmpegpreset-1.0.0//DTD//EN");
   wxString dtdURI =
      wxT("http://audacity.sourceforge.net/xml/audacityffmpegpreset-1.0.0.dtd");

   xmlFile.Write(wxT("<!DOCTYPE "));
   xmlFile.Write(wxT("project "));
   xmlFile.Write(wxT("PUBLIC "));
   xmlFile.Write(wxT("\"-//audacityffmpegpreset-1.0.0//DTD//EN\" "));
   xmlFile.Write(wxT("\"http://audacity.sourceforge.net/xml/audacityffmpegpreset-1.0.0.dtd\" "));
   xmlFile.Write(wxT(">\n"));
}
コード例 #20
0
void PCMAliasBlockFile::SaveXML(XMLWriter &xmlFile)
{
   xmlFile.StartTag(wxT("pcmaliasblockfile"));

   xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName());
   xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath());
   xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
   xmlFile.WriteAttr(wxT("aliaslen"), mLen);
   xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
   xmlFile.WriteAttr(wxT("min"), mMin);
   xmlFile.WriteAttr(wxT("max"), mMax);
   xmlFile.WriteAttr(wxT("rms"), mRMS);

   xmlFile.EndTag(wxT("pcmaliasblockfile"));
}
コード例 #21
0
ファイル: profiledb.cpp プロジェクト: Ginox/MoSync
void Profile::toXML(XMLWriter& writer, bool includeCapabilities) {
	writer.startTag(ELEMENT_PLATFORM);
	writer.setAttr(ATTR_FAMILY, fFamily);
	writer.setAttr(ATTR_VARIANT, fVariant);
	writer.setAttr(ATTR_RUNTIME, fRuntime);
	if (fIsAbstract) {
		writer.setAttr(ATTR_ABSTRACT, "true");
	}

	if (includeCapabilities) {
		set<string> capabilities = Profile::getCapabilities();
		for (set<string>::iterator capability = capabilities.begin(); capability
		        != capabilities.end(); capability++) {
			Capability value = getCapability(*capability);
			value.toXML(writer);
		}
	}
	writer.endTag();
}
コード例 #22
0
bool SceneSerializer::SerializeRigidBodyComponent(XMLWriter& writer, const RigidBodyComponent* rigidBody)
{
	using namespace physx;

	RigidBodyComponent::RigidBodyType rigidType = rigidBody->GetBodyType();

	if(rigidType == RigidBodyComponent::NONE)
		return false;

	//if rigid body node created
	if(writer.CreateNode(RigidBodyComponen))
	{
		//write enabled state
		writer.AddAttribute(Enabled, rigidBody->IsEnabled());
		writer.AddAttribute(DynamicBodyType, rigidBody->GetBodyType() == RigidBodyComponent::DYNAMIC);

		physx::PxRigidActor* actor = NULL;
		if(rigidBody->GetBodyType() == RigidBodyComponent::DYNAMIC)
			actor = rigidBody->GetDynamicActor();
		else if(rigidBody->GetBodyType() == RigidBodyComponent::STATIC)
			actor = rigidBody->GetStaticActor();

		//if no actor, pop off the rigid body component
		if(!actor)
			writer.PopNode();

		std::string shapeName = "";
		PxU32 numShapes = actor->getNbShapes();
		PxShape** shapes = new physx::PxShape*[numShapes];
		actor->getShapes(shapes, numShapes);

		//loop through the shapes
		for (PxU32 i = 0; i < numShapes; i++)
		{
			//if the shape can't be found, move next iteration
			if(!PhysXDataManager::GetSingletonPtr()->FindShapeName(shapes[i], shapeName))
				continue;
			
			//Create the shape node and store its reference
			writer.CreateNode(RigidShape);
			writer.AddAttribute(ShapeName, shapeName);
			writer.PopNode();
		}

		delete[] shapes;
	}
		
	writer.PopNode();

	return true;
}
コード例 #23
0
ファイル: NoteTrack.cpp プロジェクト: dannyflax/audacity
void NoteTrack::WriteXML(XMLWriter &xmlFile)
{
   std::ostringstream data;
   // Normally, Duplicate is called in pairs -- once to put NoteTrack
   // on the Undo stack, and again to move from the Undo stack to an
   // "active" editable state. For efficiency, we do not do a "real"
   // Duplicate followed by serialization into a binary blob. Instead,
   // we combine the Duplicate with serialization or unserialization.
   // Serialization and Unserialization happen on alternate calls to
   // Duplicate and (usually) produce the right results at the right
   // time.
   // It turns out that this optimized Duplicate is a little too
   // clever. There is at least one case where a track can be duplicated
   // and then AutoSave'd. (E.g. do an "Insert Silence" effect on a
   // NoteTrack.) In this case, mSeq will be NULL. To avoid a crash
   // and perform WriteXML, we may need to restore NoteTracks from binary
   // blobs to regular data structures (with an Alg_seq member).
   NoteTrack *saveme = this;
   if (!mSeq) { // replace saveme with an (unserialized) duplicate
      saveme = (NoteTrack *) this->Duplicate();
      assert(saveme->mSeq);
   }
   saveme->mSeq->write(data, true);
   xmlFile.StartTag(wxT("notetrack"));
   xmlFile.WriteAttr(wxT("name"), saveme->mName);
   xmlFile.WriteAttr(wxT("offset"), saveme->GetOffset());
   xmlFile.WriteAttr(wxT("visiblechannels"), saveme->mVisibleChannels);
   xmlFile.WriteAttr(wxT("height"), saveme->GetActualHeight());
   xmlFile.WriteAttr(wxT("minimized"), saveme->GetMinimized());
   xmlFile.WriteAttr(wxT("isSelected"), this->GetSelected());

#ifdef EXPERIMENTAL_MIDI_OUT
   xmlFile.WriteAttr(wxT("velocity"), (double) saveme->mGain);
#endif
   xmlFile.WriteAttr(wxT("bottomnote"), saveme->mBottomNote);
   xmlFile.WriteAttr(wxT("data"), wxString(data.str().c_str(), wxConvUTF8));
   xmlFile.EndTag(wxT("notetrack"));
   if (this != saveme) {
      delete saveme; // delete the duplicate
   }
}
コード例 #24
0
void FFmpegPresets::WriteXML(XMLWriter &xmlFile)
{
   xmlFile.StartTag(wxT("ffmpeg_presets"));
   xmlFile.WriteAttr(wxT("version"),wxT("1.0"));
   FFmpegPresetList::iterator iter;
   for (iter = mPresets->begin(); iter != mPresets->end(); ++iter)
   {
      FFmpegPreset *preset = *iter;
      xmlFile.StartTag(wxT("preset"));
      xmlFile.WriteAttr(wxT("name"),*preset->mPresetName);
      for (long i = FEFirstID + 1; i < FELastID; i++)
      {
         xmlFile.StartTag(wxT("setctrlstate"));
         xmlFile.WriteAttr(wxT("id"),wxString(FFmpegExportCtrlIDNames[i - FEFirstID]));
         xmlFile.WriteAttr(wxT("state"),preset->mControlState->Item(i - FEFirstID));
         xmlFile.EndTag(wxT("setctrlstate"));
      }
      xmlFile.EndTag(wxT("preset"));
   }
   xmlFile.EndTag(wxT("ffmpeg_presets"));
}
コード例 #25
0
ファイル: TestBaseLine.cpp プロジェクト: venkatarajasekhar/Qt
void TestBaseLine::toXML(XMLWriter &receiver) const
{
    switch(m_type)
    {
        case XML: /* Fallthrough. */
        case Fragment: /* Fallthrough. */
        case SchemaIsValid: /* Fallthrough. */
        case Text:
        {
            QXmlAttributes inspectAtts;
            inspectAtts.append(QLatin1String("role"), QString(),
                               QLatin1String("role"), QLatin1String("principal"));
            inspectAtts.append(QLatin1String("compare"), QString(),
                               QLatin1String("compare"), displayName(m_type));
            receiver.startElement(QLatin1String("output-file"), inspectAtts);
            receiver.characters(m_details);
            receiver.endElement(QLatin1String("output-file"));
            return;
        }
        case Ignore:
        {
            Q_ASSERT_X(false, Q_FUNC_INFO, "Serializing 'Ignore' is not implemented.");
            return;
        }
        case Inspect:
        {
            QXmlAttributes inspectAtts;
            inspectAtts.append(QLatin1String("role"), QString(),
                               QLatin1String("role"), QLatin1String("principal"));
            inspectAtts.append(QLatin1String("compare"), QString(),
                               QLatin1String("compare"), QLatin1String("Inspect"));
            receiver.startElement(QLatin1String("output-file"), inspectAtts);
            receiver.characters(m_details);
            receiver.endElement(QLatin1String("output-file"));
            return;
        }
        case ExpectedError:
        {
            receiver.startElement(QLatin1String("expected-error"));
            receiver.characters(m_details);
            receiver.endElement(QLatin1String("expected-error"));
            return;
        }
    }
}
コード例 #26
0
void Tool::write(XMLWriter &writer) const {
  double scale = getUnits() == ToolUnits::UNITS_INCH ? 1.0 / 25.4 : 1;
  const double small = 0.0000001;

  XMLAttributes attrs;
  attrs["number"] = String(number);
  attrs["units"] = getUnits().toString();
  attrs["shape"] = getShape().toString();
  attrs["length"] = String(getLength() * scale);
  attrs["radius"] = String(getRadius() * scale);
  if (getShape() == ToolShape::TS_SNUBNOSE && small < getSnubDiameter())
    attrs["snub_diameter"] = String(getSnubDiameter() * scale);

  writer.simpleElement("tool", getDescription(), attrs);
}
コード例 #27
0
ファイル: profiledb.cpp プロジェクト: Ginox/MoSync
void Capability::toXML(XMLWriter& writer) {
	string stateStr = getStateString(fState);

	writer.startTag(ELEMENT_CAPABILITY);
	writer.setAttr(ATTR_NAME, fName);
	if (fValue.length() > 0) {
		writer.setAttr(ATTR_VALUE, fValue);
	}
	writer.setAttr(ATTR_STATE, stateStr);
	writer.setAttr(ATTR_FRAGMENTATION,
	        fFragmentation == BUILDTIME ? "buildtime" : "runtime");
	if (fType.length() > 0) {
		writer.setAttr(ATTR_TYPE, fType);
	}
	writer.endTag();
}
コード例 #28
0
ファイル: Envelope.cpp プロジェクト: dannyflax/audacity
void Envelope::WriteXML(XMLWriter &xmlFile)
{
   unsigned int ctrlPt;

   xmlFile.StartTag(wxT("envelope"));
   xmlFile.WriteAttr(wxT("numpoints"), mEnv.GetCount());

   for (ctrlPt = 0; ctrlPt < mEnv.GetCount(); ctrlPt++) {
      xmlFile.StartTag(wxT("controlpoint"));
      xmlFile.WriteAttr(wxT("t"), mEnv[ctrlPt]->GetT(), 12);
      xmlFile.WriteAttr(wxT("val"), mEnv[ctrlPt]->GetVal(), 12);
      xmlFile.EndTag(wxT("controlpoint"));
   }

   xmlFile.EndTag(wxT("envelope"));
}
コード例 #29
0
ファイル: CommandManager.cpp プロジェクト: dot-Sean/audio
void CommandManager::WriteXML(XMLWriter &xmlFile)
{
   unsigned int j;

   xmlFile.StartTag(wxT("audacitykeyboard"));
   xmlFile.WriteAttr(wxT("audacityversion"), AUDACITY_VERSION_STRING);

   for(j=0; j<mCommandList.GetCount(); j++) {
      wxString label = mCommandList[j]->label;
      label = wxMenuItem::GetLabelFromText(label.BeforeFirst(wxT('\t')));

      xmlFile.StartTag(wxT("command"));
      xmlFile.WriteAttr(wxT("name"), mCommandList[j]->name);
      xmlFile.WriteAttr(wxT("label"), label);
      xmlFile.WriteAttr(wxT("key"), mCommandList[j]->key);
      xmlFile.EndTag(wxT("command"));
   }

   xmlFile.EndTag(wxT("audacitykeyboard"));
}
コード例 #30
0
ファイル: Tags.cpp プロジェクト: Rubelislam9950/Audacity
void Tags::WriteXML(XMLWriter &xmlFile)
{
   xmlFile.StartTag(wxT("tags"));

   wxString n, v;
   for (bool cont = GetFirst(n, v); cont; cont = GetNext(n, v)) {
      xmlFile.StartTag(wxT("tag"));
      xmlFile.WriteAttr(wxT("name"), n);
      xmlFile.WriteAttr(wxT("value"), v);
      xmlFile.EndTag(wxT("tag"));
   }

   xmlFile.EndTag(wxT("tags"));
}