Beispiel #1
0
void CMIPSTags::Serialize(Framework::Xml::CNode* parentNode) const
{
	for(const auto& tagPair : m_tags)
	{
		auto node = new Framework::Xml::CNode(TAG_ELEMENT_NAME, true);
		node->InsertAttribute(TAG_ELEMENT_ATTRIBUTE_ADDRESS, lexical_cast_hex<std::string>(tagPair.first, 8).c_str());
		node->InsertAttribute(TAG_ELEMENT_ATTRIBUTE_VALUE, tagPair.second.c_str());
		parentNode->InsertNode(node);
	}
}
Beispiel #2
0
void CPlaylist::Write(const boost::filesystem::path& playlistPath)
{
	std::unique_ptr<Framework::Xml::CNode> document(new Framework::Xml::CNode());
	auto playlistNode = document->InsertNode(new Framework::Xml::CNode(PLAYLIST_NODE_TAG, true));

	auto parentPath = playlistPath.parent_path();

	for(auto itemIterator(std::begin(m_items));
	    itemIterator != std::end(m_items); itemIterator++)
	{
		const auto& item(*itemIterator);

		boost::filesystem::path itemPath(item.path);
		auto itemRelativePath(naive_uncomplete(itemPath, parentPath));

		auto itemNode = playlistNode->InsertNode(new Framework::Xml::CNode(PLAYLIST_ITEM_NODE_TAG, true));
		itemNode->InsertAttribute(PLAYLIST_ITEM_PATH_ATTRIBUTE, Framework::Utf8::ConvertTo(itemRelativePath.wstring()).c_str());
		itemNode->InsertAttribute(PLAYLIST_ITEM_TITLE_ATTRIBUTE, Framework::Utf8::ConvertTo(item.title).c_str());
		itemNode->InsertAttribute(Framework::Xml::CreateAttributeIntValue(PLAYLIST_ITEM_LENGTH_ATTRIBUTE, item.length));
	}

	auto stream(Framework::CreateOutputStdStream(playlistPath.native()));
	Framework::Xml::CWriter::WriteDocument(stream, document.get());
}
Beispiel #3
0
extern "C" JNIEXPORT jstring JNICALL Java_com_virtualapplications_play_InputManager_getVirtualPadItems(JNIEnv* env, jobject obj, jfloat screenWidth, jfloat screenHeight)
{
	auto items = CVirtualPad::GetItems(screenWidth, screenHeight);
	auto documentNode = std::make_unique<Framework::Xml::CNode>("Document", true);
	for(const auto& item : items)
	{
		auto itemNode = new Framework::Xml::CNode("Item", true);
		itemNode->InsertAttribute("isAnalog", item.isAnalog ? "true" : "false");
		itemNode->InsertAttribute("x1", std::to_string(item.x1).c_str());
		itemNode->InsertAttribute("y1", std::to_string(item.y1).c_str());
		itemNode->InsertAttribute("x2", std::to_string(item.x2).c_str());
		itemNode->InsertAttribute("y2", std::to_string(item.y2).c_str());
		itemNode->InsertAttribute("code0", std::to_string(item.code0).c_str());
		itemNode->InsertAttribute("code1", std::to_string(item.code1).c_str());
		itemNode->InsertAttribute("caption", item.caption.c_str());
		itemNode->InsertAttribute("imageName", item.imageName.c_str());
		documentNode->InsertNode(itemNode);
	}
	Framework::CMemStream outputStream;
	Framework::Xml::CWriter::WriteDocument(outputStream, documentNode.get());
	auto resultString = std::string(outputStream.GetBuffer(), outputStream.GetBuffer() + outputStream.GetSize());
	jstring result = env->NewStringUTF(resultString.c_str());
	return result;
}