• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LinkEndChild函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetDocument

TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
{
	if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
	{
		if ( GetDocument() ) 
			GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
		return 0;
	}
	TiXmlNode* node = addThis.Clone();
	if ( !node )
		return 0;

	return LinkEndChild( node );
}
开发者ID:RoboticStudio,项目名称:robotModelParser-libs,代码行数:14,代码来源:tinyxml.cpp


示例2: CNodeData

CNodeData* CNodeData::AddNode(unsigned long uIndex, const std::string& name)
{
	CNodeData* pNode = new CNodeData();
	LinkEndChild(pNode);
	for (unsigned long i=0; i<=uIndex; ++i)
	{
		CNodeData* pNode = indexChild(i, name);
		if (pNode)
		{
		}
	}
	pNode->SetName(name);
	return pNode;
}
开发者ID:constantinbogdan,项目名称:node3d,代码行数:14,代码来源:NodeData.cpp


示例3: TiXmlElement

GpxRteElement::GpxRteElement(const wxString &name, const wxString &cmt, const wxString &desc,
              const wxString &src, ListOfGpxLinks *links, int number,
              const wxString &type, GpxExtensionsElement *extensions, ListOfGpxWpts *waypoints) : TiXmlElement("rte")
{
      if (!name.IsEmpty())
            SetProperty(wxString(_T("name")), name);
      if (!cmt.IsEmpty())
            SetProperty(wxString(_T("cmt")), cmt);
      if (!desc.IsEmpty())
            SetProperty(wxString(_T("desc")), desc);
      if (!src.IsEmpty())
            SetProperty(wxString(_T("src")), src);
      if (links)
      {
            wxListOfGpxLinksNode *link = links->GetFirst();
            while (link)
            {
                  LinkEndChild(link->GetData());
                  link = link->GetNext();
            }
      }
      if (number != -1)
            SetProperty(wxString(_T("number")), wxString::Format(_T("%u"), number));
      if (!type.IsEmpty())
            SetProperty(wxString(_T("type")), type);
      if (extensions)
            LinkEndChild(extensions);
      if (waypoints) {
            wxListOfGpxWptsNode *wpt = waypoints->GetFirst();
            while (wpt)
            {
                  //TODO: Here we should check whether the waypoint is a *rtept*
                  AppendRtePoint(wpt->GetData());
                  wpt = wpt->GetNext();
            }
      }
}
开发者ID:nohal,项目名称:OpenCPN-bak,代码行数:37,代码来源:gpxdocument.cpp


示例4: RemoveExtensions

void GpxRootElement::SetExtensions(GpxExtensionsElement *extensions)
{
      if (!extensions)
            RemoveExtensions();
      else
      {
            if(!my_extensions)
                  my_extensions = (GpxExtensionsElement *)LinkEndChild(extensions);
            else
            {
                  my_extensions = (GpxExtensionsElement *)ReplaceChild(my_extensions, *extensions);
                  extensions->Clear();
                  delete extensions;
            }
      }
}
开发者ID:nohal,项目名称:OpenCPN-bak,代码行数:16,代码来源:gpxdocument.cpp


示例5: TiXmlElement

TiXmlElement *PowerLawWidgetManager::serializeToXml() {
    auto root = new TiXmlElement("PowerLaws");

    for (auto &widget : m_Widgets) {
        auto params = widget->getPowerLawParameters();
        auto law = new TiXmlElement("PowerLawParameters");
        law->SetDoubleAttribute("factor", params.factor);
        law->SetDoubleAttribute("exponent", params.exponent);
        law->SetDoubleAttribute("offset", params.offset);
        law->SetDoubleAttribute("rangeMin", widget->getMin());
        law->SetDoubleAttribute("rangeMax", widget->getMax());
        root->LinkEndChild(law);
    }

    return root;
}
开发者ID:wennsbray,项目名称:mitk-gem,代码行数:16,代码来源:PowerLawWidgetManager.cpp


示例6: ClearThis

/**
*  @brief
*    Copy operator
*/
XmlElement &XmlElement::operator =(const XmlElement &cSource)
{
	ClearThis();
	m_sValue    = cSource.m_sValue;
	m_pUserData = cSource.m_pUserData;
	m_cCursor   = cSource.m_cCursor;

	// Clone the attributes
	for (const XmlAttribute *pAttribute=cSource.m_cAttributeSet.GetFirst(); pAttribute; pAttribute=pAttribute->GetNext())
		SetAttribute(pAttribute->GetName(), pAttribute->GetValue());

	// Clone the children
	for (const XmlNode *pNode=cSource.GetFirstChild(); pNode; pNode=pNode->GetNextSibling()) {
		XmlNode *pClone = pNode->Clone();
		if (pClone)
			LinkEndChild(*pClone);
	}

	// Return a reference to this instance
	return *this;
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:25,代码来源:XmlElement.cpp


示例7: SetError

const char* TiXmlDocument::Parse( const char* p )
{
	// Parse away, at the document level. Since a document
	// contains nothing but other tags, most of what happens
	// here is skipping white space.
	//
	// In this variant (as opposed to stream and Parse) we
	// read everything we can.


	if ( !p || !*p )
	{
		SetError( TIXML_ERROR_DOCUMENT_EMPTY );
		return false;
	}

    p = SkipWhiteSpace( p );
	if ( !p )
	{
		SetError( TIXML_ERROR_DOCUMENT_EMPTY );
		return false;
	}

	while ( p && *p )
	{
		TiXmlNode* node = Identify( p );
		if ( node )
		{
			p = node->Parse( p );
			LinkEndChild( node );
		}
		else
		{
			break;
		}
		p = SkipWhiteSpace( p );
	}
	// All is well.
	return p;
}
开发者ID:Andais,项目名称:dmz,代码行数:40,代码来源:tinyxmlparser.cpp


示例8: GpxSimpleElement

void GpxTrkElement::SetProperty(const wxString &name, const wxString &value)
{
      //FIXME: doesn't care about order so it can be absolutely wrong, have to redo this code if it has to be used by something else than the constructor
      //then it can be made public
      //FIXME: can be reused for route and track
      GpxSimpleElement *element = new GpxSimpleElement(name, value);
      TiXmlElement *curelement = FirstChildElement();
      bool found = false;
      while(curelement)
      {
            if((const char *)curelement->Value() == (const char *)name.ToUTF8())
            {
                  ReplaceChild(curelement, *element);
                  element->Clear();
                  delete element;
                  break;
            }
            curelement = curelement->NextSiblingElement();
      }
      if (!found)
            LinkEndChild(element);
}
开发者ID:nohal,项目名称:OpenCPN-bak,代码行数:22,代码来源:gpxdocument.cpp


示例9: LinkEndChild

void GpxTrkElement::AppendTrkSegment(GpxTrksegElement *trkseg)
{
      //FIXME: can be reused for route and track segment
      LinkEndChild(trkseg);
}
开发者ID:nohal,项目名称:OpenCPN-bak,代码行数:5,代码来源:gpxdocument.cpp


示例10: _toXMLImpl

		const bool _toXMLImpl(std::ifstream& pInput, TiXmlDocument* pOutput) {
			if (!pInput) return false;

			auto spellsElement = static_cast<TiXmlElement*>(pOutput->LinkEndChild(new TiXmlElement("spells")));

			String line;
			auto c = 0;
			while (std::getline(pInput, line)) {
				if (c >= 100) break;
				c++;

				Spell s;
				spellLineSplit(line, s);

				auto spellElement = static_cast<TiXmlElement*>(spellsElement->LinkEndChild(new TiXmlElement("spell")));
				spellElement->SetAttribute("id", s[FieldIndex::ID].c_str());
				spellElement->SetAttribute("name", s[FieldIndex::Name].c_str());
				spellElement->SetAttribute("mana", s[FieldIndex::ManaCost].c_str());
				spellElement->SetAttribute("target", s[FieldIndex::TargetType].c_str());
				spellElement->SetAttribute("range", s[FieldIndex::Range].c_str());
				
				if (s[FieldIndex::ResistType] != "0")
					spellElement->SetAttribute("resist", s[FieldIndex::ResistType].c_str());

				//spellElement->SetAttribute("zone", s[FieldIndex::ZoneType].c_str());
				//spellElement->SetAttribute("env", s[FieldIndex::EnvironmentType].c_str());

				// Classes.
				auto classesElement = static_cast<TiXmlElement*>(spellElement->LinkEndChild(new TiXmlElement("classes")));
				for (auto i = 0; i < NumClasses; i++) {
					if (s[FieldIndex::WAR_Level + i] == "255") continue;
					classesElement->SetAttribute(Classes[i].c_str(), s[FieldIndex::WAR_Level + i].c_str());
				}

				// Effects.
				auto effectsElement = static_cast<TiXmlElement*>(spellElement->LinkEndChild(new TiXmlElement("effects")));
				for (auto i = 0; i < NumEffects; i++) {
					if (s[FieldIndex::EffectID1 + i] == "254") continue;

					auto effectElement = static_cast<TiXmlElement*>(effectsElement->LinkEndChild(new TiXmlElement("effect")));

					// ID
					effectElement->SetAttribute("type", s[FieldIndex::EffectID1 + i].c_str());
					// Formula
					effectElement->SetAttribute("formula", s[FieldIndex::EffectFormula1 + i].c_str());
					// Base
					effectElement->SetAttribute("base", s[FieldIndex::EffectBase1 + i].c_str());
					// Limit
					effectElement->SetAttribute("limit", s[FieldIndex::EffectLimit1 + i].c_str());
					// Max
					effectElement->SetAttribute("max", s[FieldIndex::EffectMax1 + i].c_str());
				}
				// Strip element if the spell has no effects.
				if (effectsElement->NoChildren())
					spellElement->RemoveChild(effectsElement);

			}

			return true;
			//if (!pInput) { return false; }

			//auto spellsElement = static_cast<TiXmlElement*>(pOutput->LinkEndChild(new TiXmlElement("spells")));

			//static const std::list<std::pair<int, int>> ignore = {
			//	{ FieldIndex::EffectBase1, FieldIndex::EffectMax12 },
			//	{ FieldIndex::ComponentID_1, FieldIndex::ComponentCount_4 },
			//	{ FieldIndex::EffectFormula1, FieldIndex::EffectFormula12 },
			//	{ FieldIndex::EffectID1, FieldIndex::EffectID12 },
			//};
			//auto inIgnored = [=](const int pFieldID){
			//	for (auto i : ignore) {
			//		if (pFieldID >= i.first && pFieldID <= i.second)
			//			return true;
			//	}
			//	return false;
			//};

			//// Iterate lines
			//String line;
			//auto count = 1;
			//while (std::getline(pInput, line)) {
			//	if (count >= 1000) break;
			//	std::cout << count << std::endl;
			//	auto spellElement = static_cast<TiXmlElement*>(spellsElement->LinkEndChild(new TiXmlElement("spell")));
			//	auto field = 0;
			//	std::vector<String> values = split(line, '^');
			//	for (auto i : values) {
			//		if (inIgnored(field)) { field++; continue; }
			//		if (i.empty()) { field++; continue; }

			//		spellElement->SetAttribute(FieldNames[field].c_str(), i.c_str());
			//		field++;
			//	}

			//	// Write effects.
			//	auto effectsElement = new TiXmlElement("effects");
			//	auto effectCount = 0;
			//	for (auto i = 0; i < 12; i++) {
			//		// Check for non 254 effect ID.
			//		if (values[FieldIndex::EffectID1 + i] == "254") continue;
//.........这里部分代码省略.........
开发者ID:Drajor,项目名称:EQDataTools,代码行数:101,代码来源:main.cpp


示例11: TiXmlDeclaration

void mitk::PlanarFigureWriter::GenerateData()
{
  m_Success = false;

  if (!m_WriteToMemory && m_FileName.empty())
  {
    MITK_ERROR << "Could not write planar figures. File name is invalid";
    throw std::invalid_argument("file name is empty");
  }

  TiXmlDocument document;
  auto  decl = new TiXmlDeclaration( "1.0", "", "" ); // TODO what to write here? encoding? etc....
  document.LinkEndChild( decl );

  auto  version = new TiXmlElement("Version");
  version->SetAttribute("Writer",  __FILE__ );
  version->SetAttribute("CVSRevision",  "$Revision: 17055 $" );
  version->SetAttribute("FileVersion",  1 );
  document.LinkEndChild(version);


  /* create xml element for each input */
  for ( unsigned int i = 0 ; i < this->GetNumberOfInputs(); ++i )
  {
    // Create root element for this PlanarFigure
    InputType::Pointer pf = this->GetInput( i );
    if (pf.IsNull())
      continue;
    auto  pfElement = new TiXmlElement("PlanarFigure");
    pfElement->SetAttribute("type", pf->GetNameOfClass());
    document.LinkEndChild(pfElement);

    if ( pf->GetNumberOfControlPoints() == 0 )
      continue;

    //PlanarFigure::VertexContainerType* vertices = pf->GetControlPoints();
    //if (vertices == NULL)
    //  continue;

    // Serialize property list of PlanarFigure
    mitk::PropertyList::Pointer propertyList = pf->GetPropertyList();
    mitk::PropertyList::PropertyMap::const_iterator it;
    for ( it = propertyList->GetMap()->begin(); it != propertyList->GetMap()->end(); ++it )
    {
      // Create seralizer for this property
      const mitk::BaseProperty* prop = it->second;
      std::string serializerName = std::string( prop->GetNameOfClass() ) + "Serializer";
      std::list< itk::LightObject::Pointer > allSerializers = itk::ObjectFactoryBase::CreateAllInstance(
        serializerName.c_str() );

      if ( allSerializers.size() != 1 )
      {
        // No or too many serializer(s) found, skip this property
        continue;
      }

      mitk::BasePropertySerializer* serializer = dynamic_cast< mitk::BasePropertySerializer* >(
        allSerializers.begin()->GetPointer() );
      if ( serializer == nullptr )
      {
        // Serializer not valid; skip this property
      }

      auto  keyElement = new TiXmlElement( "property" );
      keyElement->SetAttribute( "key", it->first );
      keyElement->SetAttribute( "type", prop->GetNameOfClass() );

        serializer->SetProperty( prop );
      TiXmlElement* valueElement = nullptr;
      try
      {
        valueElement = serializer->Serialize();
      }
      catch (...)
      {
      }

      if ( valueElement == nullptr )
      {
        // Serialization failed; skip this property
        continue;
      }

      // Add value to property element
      keyElement->LinkEndChild( valueElement );

      // Append serialized property to property list
      pfElement->LinkEndChild( keyElement );
    }

    // Serialize control points of PlanarFigure
    auto  controlPointsElement = new TiXmlElement("ControlPoints");
    pfElement->LinkEndChild(controlPointsElement);
    for (unsigned int i = 0; i < pf->GetNumberOfControlPoints(); i++)
    {
      auto  vElement = new TiXmlElement("Vertex");
      vElement->SetAttribute("id", i);
      vElement->SetDoubleAttribute("x", pf->GetControlPoint(i)[0]);
      vElement->SetDoubleAttribute("y", pf->GetControlPoint(i)[1]);
      controlPointsElement->LinkEndChild(vElement);
//.........这里部分代码省略.........
开发者ID:151706061,项目名称:MITK,代码行数:101,代码来源:mitkPlanarFigureWriter.cpp


示例12: printf

bool FileProcess::CreateStructXML(std::string strFile, std::string strFileName)
{
	std::cout << strFile << std::endl;
	// 打开excel
	MiniExcelReader::ExcelFile* x = new MiniExcelReader::ExcelFile();
	if (!x->open(strFile.c_str()))
	{
		printf("can't open %s\n", strFile.c_str());
		return false;
	}

	// PropertyName
	// cpp
	std::string strHPPPropertyInfo = "";
	std::string strHppRecordInfo = "";
	std::string strHppEnumInfo = "";

	strHPPPropertyInfo = strHPPPropertyInfo + "class " + strFileName + "\n{\npublic:\n";
	strHPPPropertyInfo = strHPPPropertyInfo + "\t//Class name\n\tstatic const std::string& ThisName(){ static std::string x" + strFileName + " = \"" + strFileName + "\";" + " return x" + strFileName + "; }\n" + "\t// IObject\n" + strHppIObjectInfo + "\t// Property\n";

	// java
	std::string strJavaPropertyInfo = "";
	std::string strJavaRecordInfo = "";
	std::string strJavaEnumInfo = "";

	strJavaPropertyInfo = strJavaPropertyInfo + "public class " + strFileName + " {\n";
	strJavaPropertyInfo = strJavaPropertyInfo + "\t//Class name\n\tpublic static final String ThisName = \"" + strFileName + "\";\n\t// IObject\n" + strJavaIObjectInfo + "\t// Property\n";

	// C#
	std::string strCSPropertyInfo = "";
	std::string strCSRecordInfo = "";
	std::string strCSEnumInfo = "";

	strCSPropertyInfo = strCSPropertyInfo + "public class " + strFileName + "\n{\n";
	strCSPropertyInfo = strCSPropertyInfo + "\t//Class name\n\tpublic static readonly string ThisName = \"" + strFileName + "\";\n\t// IObject\n" + strCSIObjectInfo + "\t// Property\n";

	// 开始创建xml
	tinyxml2::XMLDocument* structDoc = new tinyxml2::XMLDocument();
	if (NULL == structDoc)
	{
		return false;
	}
	//xml声明
	tinyxml2::XMLDeclaration *pDel = structDoc->NewDeclaration("xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"");
	if (NULL == pDel)
	{
		return false;
	}

	structDoc->LinkEndChild(pDel);

	// 写入XML root标签
	tinyxml2::XMLElement* root = structDoc->NewElement("XML");
	structDoc->LinkEndChild(root);

	// 写入Propertys标签
	tinyxml2::XMLElement* propertyNodes = structDoc->NewElement("Propertys");
	root->LinkEndChild(propertyNodes);

	// 写入Records标签
	tinyxml2::XMLElement* recordNodes = structDoc->NewElement("Records");
	root->LinkEndChild(recordNodes);

	// 写入components的处理
	tinyxml2::XMLElement* componentNodes = structDoc->NewElement("Components");
	root->LinkEndChild(componentNodes);

	// 读取excel中每一个sheet
	std::vector<MiniExcelReader::Sheet>& sheets = x->sheets();
	for (MiniExcelReader::Sheet& sh : sheets)
	{
		std::string strSheetName = sh.getName();

		const MiniExcelReader::Range& dim = sh.getDimension();

		std::string strUpperSheetName = strSheetName.substr(0, 8);
		transform(strUpperSheetName.begin(), strUpperSheetName.end(), strUpperSheetName.begin(), ::tolower);
		if (strUpperSheetName == "property")
		{
			std::vector<std::string> colNames;
			for (int r = dim.firstRow; r <= dim.firstRow + 7; r++)
			{
				MiniExcelReader::Cell* cell = sh.getCell(r, dim.firstCol);
				if (cell)
				{
					colNames.push_back(cell->value);
				}
			}

			for (int c = dim.firstCol + 1; c <= dim.lastCol; c++)
			{
				std::string testValue = "";
				MiniExcelReader::Cell* cell = sh.getCell(dim.firstRow, c);
				if (cell)
				{
					testValue = cell->value;
				}
				if (testValue == "")
				{
					continue;
//.........这里部分代码省略.........
开发者ID:myth326,项目名称:NoahGameFrame,代码行数:101,代码来源:FileProcess.cpp


示例13: SkipWhiteSpace

/**
*  @brief
*    Reads the "value" of the element -- another element, or text
*/
const char *XmlElement::ReadValue(const char *pszData, XmlParsingData *pData, EEncoding nEncoding)
{
	// Read in text and elements in any order
	const char *pWithWhiteSpace = pszData;
	pszData = SkipWhiteSpace(pszData, nEncoding);

	while (pszData && *pszData) {
		if (*pszData != '<') {
			// Take what we have, make a text element
			XmlText *pTextNode = new XmlText("");

			if (IsWhiteSpaceCondensed())
				pszData = pTextNode->Parse(pszData, pData, nEncoding);
			else {
				// Special case: we want to keep the white space so that leading spaces aren't removed
				pszData = pTextNode->Parse(pWithWhiteSpace, pData, nEncoding);
			}

			// Does the text value only contain white spaces?
			bool bIsBlank = true;
			{
				const String sValue = pTextNode->GetValue();
				for (uint32 i=0; i<sValue.GetLength(); i++) {
					if (!IsWhiteSpace(sValue[i])) {
						bIsBlank = false;
						break;
					}
				}
			}
			if (bIsBlank)
				delete pTextNode;
			else
				LinkEndChild(*pTextNode);
		} else {
			// We hit a '<'
			// Have we hit a new element or an end tag? This could also be a XmlText in the "CDATA" style
			if (StringEqual(pszData, "</", false, nEncoding))
				return pszData;
			else {
				XmlNode *pNode = Identify(pszData, nEncoding);
				if (pNode) {
					pszData = pNode->Parse(pszData, pData, nEncoding);
					LinkEndChild(*pNode);
				} else {
					return nullptr;
				}
			}
		}
		pWithWhiteSpace = pszData;
		pszData = SkipWhiteSpace(pszData, nEncoding);
	}

	if (!pszData) {
		// Set error code
		XmlDocument *pDocument = GetDocument();
		if (pDocument)
			pDocument->SetError(ErrorReadingElementValue, 0, 0, nEncoding);
	}

	// Done
	return pszData;
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:66,代码来源:XmlElement.cpp


示例14: ClearError

const char* TiXmlDocument::Parse
  ( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding )
{
    ClearError();

    // Parse away, at the document level. Since a document
    // contains nothing but other tags, most of what happens
    // here is skipping white space.
    // sherm 100319: I changed this so that untagged top-level text is
    // parsed as a Text node rather than a parsing error. CDATA text was
    // already allowed at the top level so this seems more consistent.
    if ( !p || !*p )
    {
        SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
        return 0;
    }

    // Note that, for a document, this needs to come
    // before the while space skip, so that parsing
    // starts from the pointer we are given.
    location.Clear();
    if ( prevData )
    {
        location.row = prevData->cursor.row;
        location.col = prevData->cursor.col;
    }
    else
    {
        location.row = 0;
        location.col = 0;
    }
    TiXmlParsingData data( p, TabSize(), location.row, location.col );
    location = data.Cursor();

    if ( encoding == TIXML_ENCODING_UNKNOWN )
    {
        // Check for the Microsoft UTF-8 lead bytes.
        const unsigned char* pU = (const unsigned char*)p;
        if (    *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0
             && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1
             && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 )
        {
            encoding = TIXML_ENCODING_UTF8;
            useMicrosoftBOM = true;
        }
    }

    // Remember the start of white space in case we end up reading a text
    // element in a "keep white space" mode.
    const char* pWithWhiteSpace = p;
    p = SkipWhiteSpace( p, encoding );
    if ( !p )
    {
        SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
        return 0;
    }

    // sherm 100319: ignore all but the first Declaration
    bool haveSeenDeclaration = false;
    while ( p && *p )
    {
        TiXmlNode* node = 0;
        if ( *p != '<' )
        {   // sherm 100319: I added this case by stealing the code from
            // Element parsing; see above comment.
            // Take what we have, make a text element.
            TiXmlText* textNode = new TiXmlText( "" );

            if ( !textNode )
            {
                SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding );
                return 0;
            }

            if ( TiXmlBase::IsWhiteSpaceCondensed() )
            {
                p = textNode->Parse( p, &data, encoding );
            }
            else
            {
                // Special case: we want to keep the white space
                // so that leading spaces aren't removed.
                p = textNode->Parse( pWithWhiteSpace, &data, encoding );
            }

            if ( !textNode->Blank() ) {
                LinkEndChild( textNode );
                node = textNode;
            }
            else
                delete textNode;
        }
        else // We saw a '<', now identify what kind of tag it is.
        {
            TiXmlNode* node = Identify( p, encoding );
            if ( node )
            {
                p = node->Parse( p, &data, encoding );
                if (node->ToDeclaration()) {
                    if (haveSeenDeclaration) {
//.........这里部分代码省略.........
开发者ID:thomasklau,项目名称:simbody,代码行数:101,代码来源:tinyxmlparser.cpp


示例15: localeSwitch

TiXmlElement* mitk::TransferFunctionPropertySerializer::Serialize()
{
  if (const TransferFunctionProperty* prop = dynamic_cast<const TransferFunctionProperty*>(mitk::BasePropertySerializer::m_Property.GetPointer()))
  {
    LocaleSwitch localeSwitch("C");

    TransferFunction* transferfunction = prop->GetValue();
    if (!transferfunction)
      return nullptr;

    auto  element = new TiXmlElement("TransferFunction");

    // serialize scalar opacity function
    auto  scalarOpacityPointlist = new TiXmlElement( "ScalarOpacity" );

    TransferFunction::ControlPoints scalarOpacityPoints = transferfunction->GetScalarOpacityPoints();
    for ( auto iter = scalarOpacityPoints.begin();
      iter != scalarOpacityPoints.end();
      ++iter )
    {
      auto  pointel = new TiXmlElement("point");
      pointel->SetAttribute("x", boost::lexical_cast<std::string>(iter->first));
      pointel->SetAttribute("y", boost::lexical_cast<std::string>(iter->second));
      scalarOpacityPointlist->LinkEndChild( pointel );
    }
    element->LinkEndChild( scalarOpacityPointlist );
    // serialize gradient opacity function
    auto  gradientOpacityPointlist = new TiXmlElement( "GradientOpacity" );
    TransferFunction::ControlPoints gradientOpacityPoints = transferfunction->GetGradientOpacityPoints();
    for ( auto iter = gradientOpacityPoints.begin();
      iter != gradientOpacityPoints.end();
      ++iter )
    {
      auto  pointel = new TiXmlElement("point");
      pointel->SetAttribute("x", boost::lexical_cast<std::string>(iter->first));
      pointel->SetAttribute("y", boost::lexical_cast<std::string>(iter->second));
      gradientOpacityPointlist->LinkEndChild( pointel );
    }
    element->LinkEndChild( gradientOpacityPointlist );

    // serialize color function
    vtkColorTransferFunction* ctf = transferfunction->GetColorTransferFunction();
    if (ctf == nullptr)
      return nullptr;
    auto  pointlist = new TiXmlElement("Color");
    for (int i = 0; i < ctf->GetSize(); i++ )
    {
      double myVal[6];
      ctf->GetNodeValue(i, myVal);
      auto  pointel = new TiXmlElement("point");
      pointel->SetAttribute("x", boost::lexical_cast<std::string>(myVal[0]));
      pointel->SetAttribute("r", boost::lexical_cast<std::string>(myVal[1]));
      pointel->SetAttribute("g", boost::lexical_cast<std::string>(myVal[2]));
      pointel->SetAttribute("b", boost::lexical_cast<std::string>(myVal[3]));
      pointel->SetAttribute("midpoint", boost::lexical_cast<std::string>(myVal[4]));
      pointel->SetAttribute("sharpness", boost::lexical_cast<std::string>(myVal[5]));
      pointlist->LinkEndChild( pointel );
    }
    element->LinkEndChild( pointlist );
    return element;
  }
  else return nullptr;
}
开发者ID:151706061,项目名称:MITK,代码行数:63,代码来源:mitkTransferFunctionPropertySerializer.cpp


示例16: GetDocument

const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
{
	TiXmlDocument* document = GetDocument();

	// Read in text and elements in any order.
	const char* pWithWhiteSpace = p;
	p = SkipWhiteSpace( p, encoding );

	while ( p && *p )
	{
		if ( *p != '<' )
		{
			// Take what we have, make a text element.
			TiXmlText* textNode = new TiXmlText( "" );

			if ( !textNode )
			{
			    return 0;
			}

			if ( TiXmlBase::IsWhiteSpaceCondensed() )
			{
				p = textNode->Parse( p, data, encoding );
			}
			else
			{
				// Special case: we want to keep the white space
				// so that leading spaces aren't removed.
				p = textNode->Parse( pWithWhiteSpace, data, encoding );
			}

			if ( !textNode->Blank() )
				LinkEndChild( textNode );
			else
				delete textNode;
		} 
		else 
		{
			// We hit a '<'
			// Have we hit a new element or an end tag? This could also be
			// a TiXmlText in the "CDATA" style.
			if ( StringEqual( p, "</", false, encoding ) )
			{
				return p;
			}
			else
			{
				TiXmlNode* node = Identify( p, encoding );
				if ( node )
				{
					p = node->Parse( p, data, encoding );
					LinkEndChild( node );
				}				
				else
				{
					return 0;
				}
			}
		}
		pWithWhiteSpace = p;
		p = SkipWhiteSpace( p, encoding );
	}

	if ( !p )
	{
		if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding );
	}	
	return p;
}
开发者ID:fangbaolei,项目名称:EC700IR,代码行数:69,代码来源:tinyxmlparser.cpp


示例17: ClearError

const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding )
{
	ClearError();

	// Parse away, at the document level. Since a document
	// contains nothing but other tags, most of what happens
	// here is skipping white space.
	if ( !p || !*p )
	{
		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
		return 0;
	}

	// Note that, for a document, this needs to come
	// before the while space skip, so that parsing
	// starts from the pointer we are given.
	location.Clear();
	if ( prevData )
	{
		location.row = prevData->cursor.row;
		location.col = prevData->cursor.col;
	}
	else
	{
		location.row = 0;
		location.col = 0;
	}
	TiXmlParsingData data( p, TabSize(), location.row, location.col );
	location = data.Cursor();

	if ( encoding == TIXML_ENCODING_UNKNOWN )
	{
		// Check for the Microsoft UTF-8 lead bytes.
		const unsigned char* pU = (const unsigned char*)p;
		if (	*(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0
			 && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1
			 && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 )
		{
			encoding = TIXML_ENCODING_UTF8;
			useMicrosoftBOM = true;
		}
	}

    p = SkipWhiteSpace( p, encoding );
	if ( !p )
	{
		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
		return 0;
	}

	while ( p && *p )
	{
		TiXmlNode* node = Identify( p, encoding );
		if ( node )
		{
			p = node->Parse( p, &data, encoding );
			LinkEndChild( node );
		}
		else
		{
			break;
		}

		// Did we get encoding info?
		if (    encoding == TIXML_ENCODING_UNKNOWN
			 && node->ToDeclaration() )
		{
			TiXmlDeclaration* dec = node->ToDeclaration();
			const char* enc = dec->Encoding();
			assert( enc );

			if ( *enc == 0 )
				encoding = TIXML_ENCODING_UTF8;
			else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) )
				encoding = TIXML_ENCODING_UTF8;
			else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) )
				encoding = TIXML_ENCODING_UTF8;	// incorrect, but be nice
			else 
				encoding = TIXML_ENCODING_LEGACY;
		}

		p = SkipWhiteSpace( p, encoding );
	}

	// Was this empty?
	if ( !firstChild ) {
		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding );
		return 0;
	}

	// All is well.
	return p;
}
开发者ID:fangbaolei,项目名称:EC700IR,代码行数:93,代码来源:tinyxmlparser.cpp


示例18: while

void SoapServerInternal::GenerateWsdl()
{
	tinyxml2::XMLDocument doc;

	auto root = doc.NewElement("wsdl:definitions");
	root->SetAttribute("name", "BGSService");
	root->SetAttribute("targetNamespace", "http://battle.net");

	int x = 0;

	while (s_Namespaces[x])
	{
		root->SetAttribute(s_Namespaces[x], s_Namespaces[x + 1]);
		x += 2;
	};

	doc.LinkEndChild(root);

	auto types = doc.NewElement("wsdl:types");
	auto schema = doc.NewElement("xs:schema");

	schema->SetAttribute("elementFormDefault", "qualified");
	schema->SetAttribute("targetNamespace", "http://battle.net/types");
  schema->SetAttribute("xmlns:tns", "http://battle.net");
	schema->SetAttribute("xmlns:xs", "http://www.w3.org/2001/XMLSchema");

	map<string, ClassBinding>::iterator it = m_classBindings.begin();

	for (; it != m_classBindings.end(); ++it)
	{
    vector<tinyxml2::XMLElement*> nodes = it->second.GenerateWsdl(&doc);

    for (size_t y = 0; y < nodes.size(); ++y)
    {
      schema->LinkEndChild(nodes[y]);
    }
	}

  map<string, ServiceBinding>::iterator sit = m_soapMappings.begin();

  for (; sit != m_soapMappings.end(); ++sit)
  {
    vector<tinyxml2::XMLElement*> nodes = sit->second.GenerateWsdlElements(&doc);

    for (size_t y = 0; y < nodes.size(); ++y)
    {
      schema->LinkEndChild(nodes[y]);
    }
  }

	types->LinkEndChild(schema);
	root->LinkEndChild(types);

	sit = m_soapMappings.begin();



  tinyxml2::XMLElement* portType = doc.NewElement("wsdl:portType");
  portType->SetAttribute("name", "IBGSService");

	tinyxml2::XMLElement* binding = doc.NewElement("wsdl:binding");
	binding->SetAttribute("name", "BGSService");
	binding->SetAttribute("type", "tns:IBGSService");

	tinyxml2::XMLElement* transport = doc.NewElement("soap:binding");
	transport->SetAttribute("transport", "http://schemas.microsoft.com/soap/tcp");
	binding->LinkEndChild(transport);

  tinyxml2::XMLElement* service = doc.NewElement("wsdl:service");
  service->SetAttribute("name", "BGSService");

	for (; sit != m_soapMappings.end(); ++sit)
	{
		auto r = sit->second.GenerateWsdl(&doc);

		for (size_t y = 0; y < r.size(); ++y)
		{
			root->LinkEndChild(r[y]);
		}

    r = sit->second.GenerateWsdlPortTypeOperations(&doc);

    for (size_t y = 0; y < r.size(); ++y)
    {
      portType->LinkEndChild(r[y]);
    }

    r = sit->second.GenerateWsdlBindingOperations(&doc);

    for (size_t y = 0; y < r.size(); ++y)
    {
      binding->LinkEndChild(r[y]);
    }
	}
  
  root->LinkEndChild(portType);
  root->LinkEndChild(binding);

  tinyxml2::XMLElement* port = doc.NewElement("wsdl:port");
  port->SetAttribute("name", "BGSService");
//.........这里部分代码省略.........
开发者ID:lodle,项目名称:SoapServer,代码行数:101,代码来源:SoapServerInternal.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LinkInfo函数代码示例发布时间:2022-05-30
下一篇:
C++ LinearMove函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap