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


C++ Attributes::getLength方法代码示例

本文整理汇总了C++中Attributes::getLength方法的典型用法代码示例。如果您正苦于以下问题:C++ Attributes::getLength方法的具体用法?C++ Attributes::getLength怎么用?C++ Attributes::getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Attributes的用法示例。


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

示例1: wcscmp

bool qm::AutoPilotContentHandler::startElement(const WCHAR* pwszNamespaceURI,
											   const WCHAR* pwszLocalName,
											   const WCHAR* pwszQName,
											   const Attributes& attributes)
{
	if (wcscmp(pwszLocalName, L"entry") == 0) {
		if (state_ != STATE_AUTOPILOT)
			return false;
		
		bEnabled_ = true;
		for (int n = 0; n < attributes.getLength(); ++n) {
			const WCHAR* pwszAttrName = attributes.getLocalName(n);
			if (wcscmp(pwszAttrName, L"enabled") == 0)
				bEnabled_ = wcscmp(attributes.getValue(n), L"false") != 0;
			else
				return false;
		}
		
		state_ = STATE_ENTRY;
	}
	else {
		struct {
			const WCHAR* pwszName_;
			State stateBefore_;
			State stateAfter_;
		} states[] = {
			{ L"autoPilot",	STATE_ROOT,			STATE_AUTOPILOT	},
			{ L"course",	STATE_ENTRY,		STATE_COURSE	},
			{ L"interval",	STATE_ENTRY,		STATE_INTERVAL	}
		};
		
		int n = 0;
		for (n = 0; n < countof(states); ++n) {
			if (wcscmp(pwszLocalName, states[n].pwszName_) == 0) {
				if (state_ != states[n].stateBefore_)
					return false;
				if (attributes.getLength() != 0)
					return false;
				state_ = states[n].stateAfter_;
				break;
			}
		}
		if (n == countof(states))
			return false;
	}
	
	return true;
}
开发者ID:snakamura,项目名称:q3,代码行数:48,代码来源:autopilot.cpp

示例2: startElement

 void startElement(const XMLCh* const uri,const XMLCh* const localname,
   const XMLCh* const qname, const Attributes& attributes)
 { 
   //cout << "TestHandler::startElement: " << StrX(qname) << endl;
   char* buf = XMLString::transcode(qname);
   string sbuf(buf);
   if ( sbuf == tag )
   {
     read = true;
   }
   XMLString::release(&buf);
   
   if ( read )
   {
     // copy start element tag with attributes
     cout << "<" << StrX(qname).localForm();
     unsigned int len = attributes.getLength();
     for (unsigned int index = 0; index < len; index++)
     {
       cout << " " << attributes.getQName(index)
            << "=\"" 
            << attributes.getValue(index)
            << "\"";
     }
     cout << ">";
   }
 };
开发者ID:xorJane,项目名称:qball,代码行数:27,代码来源:xmlextract.C

示例3:

void ILI2Handler::startElement(
    CPL_UNUSED const XMLCh* const uri,
    CPL_UNUSED const XMLCh* const localname,
    const XMLCh* const qname,
    const Attributes& attrs
    ) {
  // start to add the layers, features with the DATASECTION
  char *tmpC = NULL;
  m_nEntityCounter = 0;
  if ((level >= 0) || (cmpStr(ILI2_DATASECTION, tmpC = XMLString::transcode(qname)) == 0)) {
    level++;

    if (level >= 2) {

      // create the dom tree
      DOMElement *elem = (DOMElement*)dom_doc->createElement(qname);
      
      // add all attributes
      unsigned int len = attrs.getLength();
      for (unsigned int index = 0; index < len; index++)
        elem->setAttribute(attrs.getQName(index), attrs.getValue(index));
      dom_elem->appendChild(elem);
      dom_elem = elem;
    }
  }
  XMLString::release(&tmpC);
}
开发者ID:garnertb,项目名称:gdal,代码行数:27,代码来源:ili2handler.cpp

示例4: declareAttributeNamespaces

void XMLWriter::declareAttributeNamespaces(const Attributes& attributes)
{
	for (int i = 0; i < attributes.getLength(); i++)
	{
		XMLString namespaceURI = attributes.getURI(i);
		XMLString localName    = attributes.getLocalName(i);
		XMLString qname        = attributes.getQName(i);
		if (!localName.empty())
		{
			XMLString prefix;
			XMLString splitLocalName;
			Name::split(qname, prefix, splitLocalName);
			if (prefix.empty()) prefix = _namespaces.getPrefix(namespaceURI);
			if (prefix.empty() && !namespaceURI.empty() && !_namespaces.isMapped(namespaceURI))
			{
				prefix = newPrefix();
				_namespaces.declarePrefix(prefix, namespaceURI);
			}

			const XMLString& uri = _namespaces.getURI(prefix);
			if ((uri.empty() || uri != namespaceURI) && !namespaceURI.empty())
			{
				_namespaces.declarePrefix(prefix, namespaceURI);
			}
		}
	}
}
开发者ID:BrianHoldsworth,项目名称:Poco,代码行数:27,代码来源:XMLWriter.cpp

示例5:

void
XMLTreeGenerator::startElement(const XMLCh* const uri, 
									const XMLCh* const localname, 
									const XMLCh* const qname, 
									const Attributes& attrs)
{
	string name = XMLUtil::trim(XMLUtil::WideCharToString(localname ));

	if (name.empty() ) return;

	XMLTree* pTree = NULL;

	if (m_pBuffer == NULL )
	{
		m_pRoot->SetName(name);
		
		pTree = m_pRoot;
	}
	else
	{
		pTree = m_pBuffer->AddChild(name);
	}

	for (unsigned int i = 0; i < attrs.getLength(); i++ ) 
	{
		pTree->AddAttribute(
			XMLUtil::trim(XMLUtil::WideCharToString(attrs.getLocalName(i ) ) ),
			XMLUtil::trim(XMLUtil::WideCharToString(attrs.getValue(i ) ) ));
	}

	m_pBuffer = pTree;
}
开发者ID:hillwah,项目名称:darkeden,代码行数:32,代码来源:SXml.cpp

示例6: if

void MySAX2Handler::startElement(const   XMLCh* const    uri,
                                 const   XMLCh* const    localname,
                                 const   XMLCh* const    qname,
                                 const   Attributes&     attrs)
{
    char* message = XMLString::transcode(localname);

    if (strcmp(message, "TIME_SLOT") == 0) {
        string label;
        int value;
        for (int i=0; i<attrs.getLength(); i++) {
            char *localname = XMLString::transcode(attrs.getLocalName(i));
            char *atvalue = XMLString::transcode(attrs.getValue(i));
            if (strcmp(localname, "TIME_SLOT_ID") == 0) {
                label = atvalue;
            } else if (strcmp(localname, "TIME_VALUE") == 0) {
                value = atoi(atvalue);
            }
            //cout << localname  << " " << value << endl;
            time_slots[label] = value;

            XMLString::release(&localname);
            XMLString::release(&atvalue);
        }
        cout << label << " " << value << endl;

    } else {
        cout << "I saw element: "<< message << endl;
    }
    XMLString::release(&message);
}
开发者ID:lwinmoe,项目名称:cmake_tutorial,代码行数:31,代码来源:MySAX2Handler.cpp

示例7: startElement

	void startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs )      {
		theOStream << "<" << qname;
		for ( unsigned int i = 0; i < attrs.getLength(); i++ ) {
			theOStream  <<  " " << attrs.getQName( i ) << "=\"" << attrs.getValue( i ) << "\"";
		}
		theOStream << ">";
	}     
开发者ID:PeterWang9,项目名称:code,代码行数:7,代码来源:stdin_parser.cpp

示例8: startElement

// ---------------------------------------------------------------------------
//  XSerializerHandlers: Implementation of the SAX DocumentHandler interface
// ---------------------------------------------------------------------------
void XSerializerHandlers::startElement(const XMLCh* const uri
                                   , const XMLCh* const localname
                                   , const XMLCh* const qname
                                   , const Attributes& attrs)
{
    fElementCount++;
    fAttrCount += attrs.getLength();
}
开发者ID:brock7,项目名称:TianLong,代码行数:11,代码来源:XSerializerHandlers.cpp

示例9:

// ---------------------------------------------------------------------------
//  SAX2CountHandlers: Implementation of the SAX DocumentHandler interface
// ---------------------------------------------------------------------------
void SAX2CountHandlers::startElement(const XMLCh* const /* uri */
                                   , const XMLCh* const /* localname */
                                   , const XMLCh* const /* qname */
                                   , const Attributes& attrs)
{
    fElementCount++;
    fAttrCount += attrs.getLength();
}
开发者ID:kanbang,项目名称:Colt,代码行数:11,代码来源:SAX2CountHandlers.cpp

示例10: SetAttributes

  void GpXmlStateMachine::SetAttributes(GpType* target, const Attributes& attrs)
  {
    XMLSize_t           numAtts = attrs.getLength();
    string              retValue;

    map<string, string> attributes;
    DEBOUT("GpXmlStateMachine::SetAttributes - Type");

    if (numAtts > 0)
    {
      for (XMLSize_t i = 0; i < numAtts; i++)
      {
        string local(XMLString::transcode(attrs.getLocalName(i) ) );
        string value(XMLString::transcode(attrs.getValue(i) ) );
        attributes[local] = value;
        DEBOUT(i);
        DEBOUT(local);
        DEBOUT(value);
      }
      // Checking the member for constness
      if (FindAttribute(attributes, ConstStr, retValue) )
      {
        if (retValue.compare(TrueStr) == 0)
        {
          target->Const(true);
        }
      }
      // Checking the member for staticness
      if (FindAttribute(attributes, StaticStr, retValue) )
      {
        if (retValue.compare(TrueStr) == 0)
        {
          target->Static(true);
        }
      }
      // Checking if the member is a pointer or reference
      if (FindAttribute(attributes, DirecStr, retValue) )
      {
        if (retValue.compare(PtrStr) == 0)
        {
          target->Direc(POINTER);
          DEBOUT("Pointer");
        }
        else
        {
          if (retValue.compare(RefStr) == 0)
          {
            target->Direc(REFERENCE);
            DEBOUT("Reference");
          }
        }
      }
    }
  }
开发者ID:thepresence,项目名称:gpos,代码行数:54,代码来源:GpXmlStateMachine.cpp

示例11: startElement

	void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes)
	{
		where("startElement");
		std::cout << "uri:       " << uri << std::endl
		          << "localName: " << localName << std::endl
		          << "qname:     " << qname << std::endl;
		std::cout << "Attributes: " << std::endl;
		for (int i = 0; i < attributes.getLength(); ++i)
		{
			std::cout << attributes.getLocalName(i) << "=" << attributes.getValue(i) << std::endl;
		}
	}
开发者ID:12307,项目名称:poco,代码行数:12,代码来源:SAXParser.cpp

示例12: setAttributes

void AttributesImpl::setAttributes(const Attributes& attributes)
{
	if (&attributes != this)
	{
		int count = attributes.getLength();
		_attributes.clear();
		_attributes.reserve(count);
		for (int i = 0; i < count; i++)
		{
			addAttribute(attributes.getURI(i), attributes.getLocalName(i), attributes.getQName(i), attributes.getType(i), attributes.getValue(i));
		}
	}
}
开发者ID:Victorcasas,项目名称:georest,代码行数:13,代码来源:AttributesImpl.cpp

示例13: sortedList

// ---------------------------------------------------------------------------
//  SAX2SortAttributesFilter: Overrides of the SAX2XMLFilter interface
// ---------------------------------------------------------------------------
void SAX2SortAttributesFilter::startElement(const   XMLCh* const    uri,
									const   XMLCh* const    localname,
									const   XMLCh* const    qname,
                                    const   Attributes&		attributes)
{
    AttrList sortedList(attributes.getLength());
    for(unsigned int i=0;i<attributes.getLength();i++)
    {
        unsigned int j;
        for(j=0;j<sortedList.getLength();j++)
        {
            if(XMLString::compareString(sortedList.elementAt(j)->qName,attributes.getQName(i))>=0)
                break;
        }
        Attr* pClone=new Attr;
        pClone->qName       = attributes.getQName(i);
        pClone->uri         = attributes.getURI(i);
        pClone->localPart   = attributes.getLocalName(i);
        pClone->value       = attributes.getValue(i);
        pClone->attrType    = attributes.getType(i);
        sortedList.insertElementAt(pClone, j);
    }
    SAX2XMLFilterImpl::startElement(uri, localname, qname, sortedList);
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:27,代码来源:SAX2FilterHandlers.cpp

示例14: startElement

void currencyHandler::startElement(const XMLString& uri,
		const XMLString& localName, const XMLString& qname,
		const Attributes& attributes) {
	//		where("startElement");
	std::cout << "start element uri:       " << uri << std::endl
			<< "localName: " << localName << std::endl << "qname:     "
			<< qname << std::endl;

	if (localName.compare("resource") == 0) {
		std::cout << " Quote starting here.." << std::endl;

		inQuote = true;
	} else if (localName.compare("field") == 0) {
		std::cout << " field starting here.." << std::endl;
		//	std::cout<<" field value is "<<attributes.getValue(i)<<std::endl;
	}

	std::cout << "Attributes: " << std::endl;
	for (int i = 0; i < attributes.getLength(); ++i) {

		std::cout << " attributes.getValue(i) : " << attributes.getValue(i)
				<< std::endl;

		if (attributes.getValue(i).compare("symbol") == 0) {
			currentFieldReading = symbolType;

		} else if (attributes.getValue(i).compare("ts") == 0) {
			currentFieldReading = tsType;

		} else if (attributes.getValue(i).compare("utctime") == 0) {
			currentFieldReading = utctimelType;

		} else if (attributes.getValue(i).compare("volume") == 0) {
			currentFieldReading = volumeType;

		} else if (attributes.getValue(i).compare("price") == 0) {
			currentFieldReading = priceType;

		} else if (attributes.getValue(i).compare("name") == 0) {
			currentFieldReading = nameType;

		} else if (attributes.getValue(i).compare("type") == 0) {
			currentFieldReading = typeType;

		}

	}
}
开发者ID:taabodim,项目名称:QpidClient,代码行数:48,代码来源:currencyHandler.cpp

示例15:

void ThreadParser::SAX2Handler::startElement(const XMLCh *const /*uri*/,
                              const XMLCh *const localname,
                              const XMLCh *const /*qname*/,
                              const Attributes& attributes)
{
    SAX2Instance->addToCheckSum(localname);

    XMLSize_t n = attributes.getLength();
    XMLSize_t i;
    for (i=0; i<n; i++)
    {
        const XMLCh *attNam = attributes.getQName(i);
        SAX2Instance->addToCheckSum(attNam);
        const XMLCh *attVal = attributes.getValue(i);
        SAX2Instance->addToCheckSum(attVal);
    }
}
开发者ID:ideasiii,项目名称:ControllerPlatform,代码行数:17,代码来源:ThreadTest.cpp


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