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


C++ Attributes类代码示例

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


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

示例1: if

void	Node::attributesNamesAndTypesFromVariant(Variant* variant, std::map<std::string, uint8_t> *namestypes, std::string current)
{
  if (!(variant))
    return ;
  if (variant->type() == typeId::List)
    {
      std::list<Variant*> lvariant = variant->value<std::list< Variant*> >();
      std::list<Variant*>::iterator it = lvariant.begin();
      for (; it != lvariant.end(); it++)
	this->attributesNamesAndTypesFromVariant((*it), namestypes, current);
    }
  else if (variant->type() == typeId::Map)
    {
      Attributes mvariant = variant->value<Attributes >();
      Attributes::iterator it = mvariant.begin();
      std::string	abs;
      for (; it != mvariant.end(); it++)
	{
	  if (current.empty())
	    abs = it->first;
	  else
	    abs = current + '.' + it->first;
	  namestypes->insert(std::pair<std::string, uint8_t>(abs, it->second->type()));
	  this->attributesNamesAndTypesFromVariant(it->second, namestypes, abs);
	}
    }  
}
开发者ID:halbbob,项目名称:dff,代码行数:27,代码来源:node.cpp

示例2: getMapAttributes

bool AgentObserverMap::draw()
{
    QList<Attributes *> attribList = getMapAttributes()->values();
    Attributes *attrib = 0;

    qStableSort(attribList.begin(), attribList.end(), sortAttribByType);

    for(int i = 0; i < attribList.size(); i++)
    {
        attrib = attribList.at(i);
        if ( (attrib->getType() != TObsCell)
              && (attrib->getType() != TObsAgent) )
            getPainterWidget()->plotMap(attrib);
    }

    //static int ss = 1;
    //for(int i = 0; i < attribList.size(); i++)
    //{
    //    //attrib = attribList.at(i);
    //    //if ( (attrib->getType() != TObsCell)
    //    //       && (attrib->getType() != TObsAgent) )
    //    //       attrib->getImage()->save("imgs/" + attrib->getName() + QString::number(ss) + ".png");

    //    qDebug() << attrib->getName() << ": " << getSubjectName(attrib->getType());
    //}

    //ss++;
    return true;
}
开发者ID:saraiva3,项目名称:terrame,代码行数:29,代码来源:agentObserverMap.cpp

示例3: getEIC

short BaseColumn::codeGen(Generator * generator)
{
  // if this column has not been added to the map table or
  // it does not have a valid offset, and
  // it has an EIC list, then add it to the map table and
  // assign attributes from the one of the EIC values.
  MapInfo * mapInfo = generator->getMapInfoAsIs(getValueId());
  if ((!mapInfo ||
       !mapInfo->isOffsetAssigned()) &&
      (!getEIC().isEmpty()))
    {
      MapInfo * index_col_map_info;
      short done = 0;
      for (ValueId val_id = getEIC().init();
	   !done && getEIC().next(val_id);
	   getEIC().advance(val_id))
	{
	  if (index_col_map_info = generator->getMapInfoAsIs(val_id))
	    {
	      Attributes * attr = 
		generator->addMapInfo(getValueId(), 0)->getAttr();
	      attr->copyLocationAttrs(index_col_map_info->getAttr());
	      done = -1;
	    }
	}
    }
      
  return 0;
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:29,代码来源:GenItemExpr.cpp

示例4: runtime_error

SAXParser::Handler::Status HandlerPeak::startElement(const string& name, 
                                const Attributes& attributes,
                                stream_offset position)
{
    if (!peak)
        throw runtime_error("[PeakData::HandlerPeak::startElement()]  Null peak.");

    if (name == "peak")
    {
        for (Attributes::attribute_list::const_iterator it=attributes.begin(); it!=attributes.end(); ++it)
        {
            if (it->matchName("id")) peak->id = lexical_cast<int>(it->getValue());
            else if (it->matchName("mz")) peak->mz = lexical_cast<double>(it->getValue(NoXMLUnescape)); 
            else if (it->matchName("retentionTime")) peak->retentionTime = lexical_cast<double>(it->getValue(NoXMLUnescape));
            else if (it->matchName("intensity")) peak->intensity = lexical_cast<double>(it->getValue(NoXMLUnescape));
            else if (it->matchName("area")) peak->area = lexical_cast<double>(it->getValue(NoXMLUnescape));
            else if (it->matchName("error")) peak->error = lexical_cast<double>(it->getValue(NoXMLUnescape));
            else
            {
                Peak::Attribute a = stringToAttribute(it->getName());
                peak->attributes[a] = lexical_cast<double>(it->getValue(NoXMLUnescape)); 
            }
        }

        return Status::Ok;
    }
    else if (name == "data")
    {
        return Status::Ok;
    }

    throw runtime_error(("[HandlerPeak] Unexpected element name: " + name).c_str());
}
开发者ID:AlexandreBurel,项目名称:pwiz-mzdb,代码行数:33,代码来源:PeakData.cpp

示例5: createContext

Context *
createContext(const Visual *_visual, Context *shareContext, Profile profile)
{
    const GlxVisual *visual = static_cast<const GlxVisual *>(_visual);
    GLXContext share_context = NULL;
    GLXContext context;

    if (profile != PROFILE_COMPAT) {
        return NULL;
    }

    if (shareContext) {
        share_context = static_cast<GlxContext*>(shareContext)->context;
    }

    if (glxVersion >= 0x0104 && has_GLX_ARB_create_context) {
        Attributes<int> attribs;
        attribs.add(GLX_RENDER_TYPE, GLX_RGBA_TYPE);
        if (debug) {
            attribs.add(GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB);
        }
        attribs.end();

        context = glXCreateContextAttribsARB(display, visual->fbconfig, share_context, True, attribs);
    } else 
           if (glxVersion >= 0x103) {
        context = glXCreateNewContext(display, visual->fbconfig, GLX_RGBA_TYPE, share_context, True);
    } else {
        context = glXCreateContext(display, visual->visinfo, share_context, True);
    }

    return new GlxContext(visual, profile, context);
}
开发者ID:prahal,项目名称:apitrace,代码行数:33,代码来源:glws_glx.cpp

示例6:

void ILI2Handler::startElement(
        const   XMLCh* const    uri,
        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:GeospatialDaryl,项目名称:VS2013__00_GDAL_111_x64,代码行数:28,代码来源:ili2handler.cpp

示例7: 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

示例8: 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,代码来源:file_parser.cpp

示例9: 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

示例10: istr

void AttributesParserTest::testParser2()
{
	Attributes attrs;
	std::istringstream istr("name=value");
	AttributesParser parser(attrs, istr);
	parser.parse();
	assert (attrs.getString("name") == "value");
}
开发者ID:JoneXie,项目名称:macchina.io,代码行数:8,代码来源:AttributesParserTest.cpp

示例11: Show_attributes

/**
 * Function: Show_attributes
 *
 * Display both the key and value for an Attributes map.
 *
 * Since this is a non-critical message, it is only shown when the debug value
 * is set high enough.
 *
 * Parameter: attributes Defined as std::map<std::string, std::string> pair.
 *            Most commonly found in data as a "name = value" pair.
 */
void Show_attributes(std::ostream& os, Attributes& attributes)
{
	Monday_out(VERBOSE_LEVEL2, os, "- Num attributes: %d\n", attributes.size());
	for(Attributes::iterator i = attributes.begin(); i != attributes.end(); ++i)
	{
		Monday_out(VERBOSE_LEVEL2, os, "  \"%s\" = \"%s\"\n", i->first.c_str(), i->second.c_str());
	}
}
开发者ID:bambams,项目名称:Monday,代码行数:19,代码来源:Debug.cpp

示例12: inferSchema

 ArrayDesc inferSchema(std::vector< ArrayDesc> schemas, boost::shared_ptr< Query> query)
 {
     Attributes outputAttrs;
     outputAttrs.push_back(AttributeDesc(0, "dummy", TID_DOUBLE, AttributeDesc::IS_NULLABLE, 0));
     Dimensions outputDims;
     outputDims.push_back(DimensionDesc("i",0,0,1,0));
     return ArrayDesc("test_cache", outputAttrs, outputDims);
 }
开发者ID:Goon83,项目名称:scidb,代码行数:8,代码来源:LogicalTestCache.cpp

示例13: test_extendQuadrupleCharacterOperator_given_lessThan_should_give_correct_attributes

/* Given                            should become
 *            OperatorToken *                 OperatorToken *
 *            --------------                  --------------
 * type:      TOKEN_OPERATOR_TYPE             TOKEN_OPERATOR_TYPE
 * symbol:       '<'                          '<'
 * arity:         0                           INFIX
 * assoc:         0                           LEFT_TO_RIGHT
 * precedence:    0                           8
 *
 */
void test_extendQuadrupleCharacterOperator_given_lessThan_should_give_correct_attributes(void)
{
  OperatorToken *op = (OperatorToken*)createOperatorToken("<");
  Attributes *attr = &operatorAttributesTable[(int)*(op->symbol)];
  op =(OperatorToken *)attr->extend((Token *)op, attr);

  TEST_ASSERT_EQUAL_ATTRIBUTE_OPERATOR(INFIX, LEFT_TO_RIGHT, 8, "<", op);
}
开发者ID:LouiseSiah,项目名称:ShuntingYard,代码行数:18,代码来源:test_TokenExtend.c

示例14: TEST

TEST(AttributesTest, get_decoded_value)
{
    string s;
    Attributes a;
    a.addFromGFF("foo=hello%20world%2Cplanet");
    a.get("foo", s);
    EXPECT_EQ("hello world,planet", s);
}
开发者ID:abuchanan,项目名称:duncan,代码行数:8,代码来源:Attributes.cpp

示例15: test_extendDoubleCharacterOperator_given_divideEqual_should_give_correct_attributes

/* Given                            should become
 *            OperatorToken *                 OperatorToken *
 *            --------------                  --------------
 * type:      TOKEN_OPERATOR_TYPE             TOKEN_OPERATOR_TYPE
 * symbol:       '/='                          '/='
 * arity:         0                           INFIX
 * assoc:         0                           RIGHT_TO_LEFT
 * precedence:    0                           1
 *
 */
void test_extendDoubleCharacterOperator_given_divideEqual_should_give_correct_attributes(void)
{
  OperatorToken *op = (OperatorToken*)createOperatorToken("/=");
  Attributes *attr = &operatorAttributesTable[(int)*(op->symbol)];
  op =(OperatorToken *)attr->extend((Token *)op, attr);

  TEST_ASSERT_EQUAL_ATTRIBUTE_OPERATOR(INFIX, RIGHT_TO_LEFT, 1, "/=", op);
}
开发者ID:LouiseSiah,项目名称:ShuntingYard,代码行数:18,代码来源:test_TokenExtend.c


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