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


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

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


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

示例1: CheckForRelations

void NASReader::CheckForRelations( const char *pszElement,
                                   const Attributes &attrs,
                                   char **ppszCurField )

{
    GMLFeature *poFeature = GetState()->m_poFeature;

    CPLAssert( poFeature  != NULL );

    int nIndex;
    XMLCh  Name[100];

    tr_strcpy( Name, "xlink:href" );
    nIndex = attrs.getIndex( Name );

    if( nIndex != -1 )
    {
        char *pszHRef = tr_strdup( attrs.getValue( nIndex ) );

        if( EQUALN(pszHRef,"urn:adv:oid:", 12 ) )
        {
            poFeature->AddOBProperty( pszElement, pszHRef );
            CPLFree( *ppszCurField );
            *ppszCurField = CPLStrdup( pszHRef + 12 );
        }

        CPLFree( pszHRef );
    }
}
开发者ID:drownedout,项目名称:datamap,代码行数:29,代码来源:nasreader.cpp

示例2: PushFeature

void NASReader::PushFeature( const char *pszElement, 
                             const Attributes &attrs )

{
    int iClass;

/* -------------------------------------------------------------------- */
/*      Find the class of this element.                                 */
/* -------------------------------------------------------------------- */
    for( iClass = 0; iClass < GetClassCount(); iClass++ )
    {
        if( EQUAL(pszElement,GetClass(iClass)->GetElementName()) )
            break;
    }

/* -------------------------------------------------------------------- */
/*      Create a new feature class for this element, if there is no     */
/*      existing class for it.                                          */
/* -------------------------------------------------------------------- */
    if( iClass == GetClassCount() )
    {
        CPLAssert( !IsClassListLocked() );

        GMLFeatureClass *poNewClass = new GMLFeatureClass( pszElement );

        AddClass( poNewClass );
    }

/* -------------------------------------------------------------------- */
/*      Create a feature of this feature class.                         */
/* -------------------------------------------------------------------- */
    GMLFeature *poFeature = new GMLFeature( GetClass( iClass ) );

/* -------------------------------------------------------------------- */
/*      Create and push a new read state.                               */
/* -------------------------------------------------------------------- */
    GMLReadState *poState;

    poState = new GMLReadState();
    poState->m_poFeature = poFeature;
    PushState( poState );

/* -------------------------------------------------------------------- */
/*      Check for gml:id, and if found push it as an attribute named    */
/*      gml_id.                                                         */
/* -------------------------------------------------------------------- */
    int nFIDIndex;
    XMLCh   anFID[100];

    tr_strcpy( anFID, "gml:id" );
    nFIDIndex = attrs.getIndex( anFID );
    if( nFIDIndex != -1 )
    {
        char *pszFID = tr_strdup( attrs.getValue( nFIDIndex ) );
        SetFeatureProperty( "gml_id", pszFID );
        CPLFree( pszFID );
    }

}
开发者ID:actian-geospatial,项目名称:ogr-ingres,代码行数:59,代码来源:nasreader.cpp

示例3: startElement

    void XTandemInfileXMLHandler::startElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname, const Attributes & attributes)
    {

      tag_.push_back(String(sm_.convert(qname)));

      if (tag_.back() == "note")
      {
        int type_idx = attributes.getIndex(sm_.convert("type"));
        int label_idx = attributes.getIndex(sm_.convert("label"));

        if (type_idx != -1)
        {
          actual_note_.note_type = String(sm_.convert(attributes.getValue(type_idx)));
        }
        if (label_idx != -1)
        {
          actual_note_.note_label = String(sm_.convert(attributes.getValue(label_idx)));
        }
      }

    }
开发者ID:chahuistle,项目名称:OpenMS,代码行数:21,代码来源:XTandemInfileXMLHandler.cpp

示例4: CheckForFID

void NASReader::CheckForFID( const Attributes &attrs,
                             char **ppszCurField )

{
    int nIndex;
    XMLCh  Name[100];

    tr_strcpy( Name, "fid" );
    nIndex = attrs.getIndex( Name );

    if( nIndex != -1 )
    {
        char *pszFID = tr_strdup( attrs.getValue( nIndex ) );
        CPLString osCurField = *ppszCurField;

        osCurField += pszFID;
        CPLFree( pszFID );

        CPLFree( *ppszCurField );
        *ppszCurField = CPLStrdup(osCurField);
    }
}
开发者ID:afarnham,项目名称:gdal,代码行数:22,代码来源:nasreader.cpp

示例5: startElement


//.........这里部分代码省略.........
            m_poReader->SetFeaturePropertyDirectly(
                "safeToIgnore", CPLStrdup(m_osLastSafeToIgnore) );
        }
        else if( EQUAL( pszLast, "Update" ) )
        {
            //CPLAssert( m_osLastEnded != "" );
            //CPLAssert( m_osLastOccasion != "" );
            m_poReader->SetFeaturePropertyDirectly(
                "endet", CPLStrdup(m_osLastEnded) );
            m_poReader->SetFeaturePropertyDirectly(
                "anlass", CPLStrdup(m_osLastOccasion) );
            m_osLastEnded = "";
            m_osLastOccasion = "";
        }

        return;
    }

/* -------------------------------------------------------------------- */
/*      Is it a feature?  If so push a whole new state, and return.     */
/* -------------------------------------------------------------------- */
    else if( m_poReader->IsFeatureElement( szElementName ) )
    {
        m_osLastTypeName = szElementName;

        const char* pszFilteredClassName = m_poReader->GetFilteredClassName();

        pszLast = m_poReader->GetState()->GetLastComponent();
        if( pszLast != NULL && EQUAL(pszLast,"Replace") )
        {
            XMLCh  Name[100];

            tr_strcpy( Name, "gml:id" );
            int nIndex = attrs.getIndex( Name );

            if( nIndex == -1 || m_osLastReplacingFID !="" )
            {
                CPLError( CE_Failure, CPLE_AssertionFailed,
                          "nIndex == -1 || m_osLastReplacingFID !=\"\"" );

                m_bIgnoreFeature = true;
                m_nDepthFeature = m_nDepth;
                m_nDepth ++;

                return;
            }

            // Capture "gml:id" attribute as part of the property value -
            // primarily this is for the wfsext:Replace operation's attribute.
            char *pszReplacingFID = tr_strdup( attrs.getValue( nIndex ) );
            m_osLastReplacingFID = pszReplacingFID;
            CPLFree( pszReplacingFID );

#ifdef DEBUG_VERBOSE
            CPLDebug( "NAS", "%*s### Replace typeName=%s replacedBy=%s",
                      m_nDepth, "", m_osLastTypeName.c_str(),
                      m_osLastReplacingFID.c_str() );
#endif
        }

        if ( pszFilteredClassName != NULL &&
             strcmp(szElementName, pszFilteredClassName) != 0 )
        {
            m_bIgnoreFeature = true;
            m_nDepthFeature = m_nDepth;
            m_nDepth ++;
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:67,代码来源:nashandler.cpp

示例6:

void LoadDaisy3Smil2Handle::startElement(const XMLCh* const uri,
										 const XMLCh* const localname,
										 const XMLCh* const qname,
										 const Attributes& att)
{
	char* message1 = XMLString::transcode(localname);
	char* message2;

	//////////////////////////////////////////////////////////////////////////////////////
	// smil                                                            infinite element //
	//////////////////////////////////////////////////////////////////////////////////////
	if  ( !strcmp(message1,"smil")  
		||!strcmp(message1,"Smil") 
		||!strcmp(message1,"SMIL"))
	{
		//xmlns (CDATA, FIXED) "http://www.w3.org/2001/Smil2/": Specifies the default XML namespace for all elements in SMIL. See [XML-Namespaces] for details on namespaces. This attribute and its value (given in DTD) must be explicitly specified in the document instance. 
		//strDaisy3Smil2HeadXmlNs = XMLString::transcode(att.getValue(XMLString::transcode("xmlns")));
		strDaisy3Smil2HeadXmlNs = "http://www.w3.org/2001/SMIL20/";     //Fixed.

		//This is infinite element but I don't setup variable for checking the SMIL level for this version.
		return;
	}

	//////////////////////////////////////////////////////////////////////////////////////
	// meta (without scheme)                                             finite element //
	//////////////////////////////////////////////////////////////////////////////////////
	if  ( !strcmp(message1,"meta")  
		||!strcmp(message1,"Meta") 
		||!strcmp(message1,"META"))
	{
		//µÃǨÊͺ·Õè name ¡è͹¶éÒäÁèÁÕ name ¡ç¶×ÍÇèÒäÁèÁÕ meta ¹Ñé¹àÅÂ
		if (att.getIndex(XMLString::transcode("name")) != -1 )
		{
			//name (CDATA, REQUIRED) 
			try
			{
				message2 = XMLString::transcode(att.getValue(XMLString::transcode("name")));
				vecDaisy3Smil2HeadMetaName.push_back(message2);
			}
			catch(...)
			{
				//Push "EmPtY" for ordering reason and detects there is no data.
				vecDaisy3Smil2HeadMetaName.push_back("EmPtY");
				cout << "<Warning::LoadDaisy3Smil2Handle::startElement::meta> This SMIL has empty name in meta tag." << endl;
				cout << "<Warning::LoadDaisy3Smil2Handle::startElement::meta> This is a serious warning on programming syntax please contact programmer" << endl;
			}

			//content (CDATA, #IMPLIED) 
			try
			{
				message2 = XMLString::transcode(att.getValue(XMLString::transcode("content")));
				vecDaisy3Smil2HeadMetaContent.push_back(message2);
			}
			catch(...)
			{
				//Push "EmPtY" for ordering reason and detects there is no data.
				vecDaisy3Smil2HeadMetaContent.push_back("EmPtY"); 
				cout << "<Warning::LoadDaisy3Smil2Handle::startElement::meta> This SMIL has empty content in meta tag." << endl;
			}
		}
		else
		{
			cout << "<Warning::LoadDaisy3Smil2Handle::startElement::meta> Skip this meta in SMIL because it has empty name in meta tag." << endl;
		}
		return;
	}

	//////////////////////////////////////////////////////////////////////////////////////
	// region	                                                         finite element //
	//////////////////////////////////////////////////////////////////////////////////////
	if  ( !strcmp(message1,"region")  
		||!strcmp(message1,"Region") 
		||!strcmp(message1,"REGION"))
	{
		//µÃǨÊͺ·Õè id ¡è͹¶éÒäÁèÁÕ id ¡ç¶×ÍÇèÒäÁèÁÕ region ¹Ñé¹àÅÂ
		if (att.getIndex(XMLString::transcode("id")) != -1 )
		{
			//id (ID, REQUIRED) Value of region attribute on media object references the id on appropriate region element. 
			try
			{
				message2 = XMLString::transcode(att.getValue(XMLString::transcode("id")));
				vecDaisy3Smil2HeadRegionId.push_back(message2);		
			}
			catch(...)
			{
				//Push "EmPtY" for ordering reason and detects there is no data.
				vecDaisy3Smil2HeadRegionId.push_back("EmPtY");
				cout << "<Warning::LoadDaisy3Smil2Handle::startElement::region> This SMIL has empty id in region tag." << endl;
				cout << "<Warning::LoadDaisy3Smil2Handle::startElement::region> This is a serious warning on programming syntax please contact programmer" << endl;
			}
		
			//bottom (CDATA, 'auto') Locates region in display space. See SMIL 2.0 for details. 
			try
			{
				message2 = XMLString::transcode(att.getValue(XMLString::transcode("bottom")));
				vecDaisy3Smil2HeadRegionBottom.push_back(message2);
			}
			catch(...)
			{
				//Push "EmPtY" for ordering reason and detects there is no data.
//.........这里部分代码省略.........
开发者ID:kom2002,项目名称:TAB_Converter_x64,代码行数:101,代码来源:LoadDaisy3Smil2Handle_old.cpp


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