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


C++ AttributeList类代码示例

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


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

示例1: BackgroundStart

// deal with "background" items
void SAX_TRSHandlers::BackgroundStart(const XMLCh* const name, AttributeList& attr)
{
	nbBackground ++ ;

	string startTime = trans(attr.getValue("time"));
	float start = atof(startTime.c_str());

	//> Create background if not at 0 time
	//  if 0 time, will be created at next background border
	float lastTime = atof(lastBackgroundTime.c_str());
	if (lastTime!=0)
	{
//		prevBackgroundId = dataModel->addBackgroundSegment(0, lastTime, -1, formatBackgrounds(lastBackgroundType), lastBackgroundLevel, tag::DataModel::ADJUST_PREVIOUS, false) ;
		prevBackgroundId = dataModel->insertMainstreamBaseElement(prevBackgroundId, lastTime);
		dataModel->setElementProperty(prevBackgroundId, "type", formatBackgrounds(lastBackgroundType), false);
		dataModel->setElementProperty(prevBackgroundId, "level", lastBackgroundLevel, false);
	}

	lastBackgroundTime = startTime ;
	string level = trans(attr.getValue("level"));
	string type = trans(attr.getValue("type"));

	if (level!="off")
	{
		lastBackgroundLevel = level ;
		lastBackgroundType = type ;
	}
	else
	{
		lastBackgroundLevel = "low" ;
		lastBackgroundType = "none" ;
	}
}
开发者ID:eroux,项目名称:transcriber-ag,代码行数:34,代码来源:SAX_TRSHandlers.cpp

示例2: TEST

/* ****************************************************************************
*
* mongoGetContextElementResponses_fail -
*/
TEST(mongoOntimeintervalOperations, mongoGetContextElementResponses_fail)
{
    HttpStatusCode ms;

    /* Forge the parameters */
    EntityIdVector enV;
    EntityId en("E5", "T", "false");
    enV.push_back(&en);
    AttributeList attrL;
    attrL.push_back("A1");
    attrL.push_back("A2");
    attrL.push_back("A3");
    attrL.push_back("A4");
    ContextElementResponseVector cerV;
    std::string err;

    /* Prepare database */
    prepareDatabase();

    /* Do operation */
    ms = mongoGetContextElementResponses(enV, attrL, &cerV, &err);

    /* Check results */
    EXPECT_EQ(SccOk, ms);
    ASSERT_EQ(0, cerV.size());
}
开发者ID:PascaleBorscia,项目名称:fiware-orion,代码行数:30,代码来源:mongoOntimeintervalOperations_test.cpp

示例3: HandleAddressSpaceTypeAttribute

/// HandleAddressSpaceTypeAttribute - Process an address_space attribute on the
/// specified type.  The attribute contains 1 argument, the id of the address
/// space for the type.
static void HandleAddressSpaceTypeAttribute(QualType &Type, 
                                            const AttributeList &Attr, Sema &S){
  // If this type is already address space qualified, reject it.
  // Clause 6.7.3 - Type qualifiers: "No type shall be qualified by qualifiers
  // for two or more different address spaces."
  if (Type.getAddressSpace()) {
    S.Diag(Attr.getLoc(), diag::err_attribute_address_multiple_qualifiers);
    return;
  }
  
  // Check the attribute arguments.
  if (Attr.getNumArgs() != 1) {
    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
    return;
  }
  Expr *ASArgExpr = static_cast<Expr *>(Attr.getArg(0));
  llvm::APSInt addrSpace(32);
  if (!ASArgExpr->isIntegerConstantExpr(addrSpace, S.Context)) {
    S.Diag(Attr.getLoc(), diag::err_attribute_address_space_not_int)
      << ASArgExpr->getSourceRange();
    return;
  }

  unsigned ASIdx = static_cast<unsigned>(addrSpace.getZExtValue()); 
  Type = S.Context.getAddrSpaceQualType(Type, ASIdx);
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例4: HandleX86ForceAlignArgPointerAttr

static void HandleX86ForceAlignArgPointerAttr(Decl *D,
                                              const AttributeList& Attr,
                                              Sema &S) {
  // Check the attribute arguments.
  if (Attr.getNumArgs() != 0) {
    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
    return;
  }

  // If we try to apply it to a function pointer, don't warn, but don't
  // do anything, either. It doesn't matter anyway, because there's nothing
  // special about calling a force_align_arg_pointer function.
  ValueDecl *VD = dyn_cast<ValueDecl>(D);
  if (VD && VD->getType()->isFunctionPointerType())
    return;
  // Also don't warn on function pointer typedefs.
  TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D);
  if (TD && (TD->getUnderlyingType()->isFunctionPointerType() ||
             TD->getUnderlyingType()->isFunctionType()))
    return;
  // Attribute can only be applied to function types.
  if (!isa<FunctionDecl>(D)) {
    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
      << Attr.getName() << /* function */0;
    return;
  }

  D->addAttr(::new (S.Context) X86ForceAlignArgPointerAttr(Attr.getRange(),
                                                           S.Context));
}
开发者ID:acgessler,项目名称:clang,代码行数:30,代码来源:TargetAttributesSema.cpp

示例5: produceCompactUnwindFrame

static bool produceCompactUnwindFrame(MachineFunction &MF) {
  const AArch64Subtarget &Subtarget = MF.getSubtarget<AArch64Subtarget>();
  AttributeList Attrs = MF.getFunction()->getAttributes();
  return Subtarget.isTargetMachO() &&
         !(Subtarget.getTargetLowering()->supportSwiftError() &&
           Attrs.hasAttrSomewhere(Attribute::SwiftError));
}
开发者ID:eliben,项目名称:llvm,代码行数:7,代码来源:AArch64FrameLowering.cpp

示例6:

AttributeList
OGR_Feature::getAttributes() const
{
    AttributeTable attrs;

    if ( !store_attrs_loaded )
    {
        const_cast<OGR_Feature*>(this)->loadAttributes();
    }

    // accumulate the attrs from the store:
    for( AttributeTable::const_iterator i = store_attrs.begin(); i != store_attrs.end(); i++ )
    {
        attrs[ (*i).first ] = (*i).second;
    }

    // finally add in the user attrs (overwriting the store attrs if necessary)
    for( AttributeTable::const_iterator i = getUserAttrs().begin(); i != getUserAttrs().end() ; i++ )
        attrs[ (*i).first ] = (*i).second;

    // shove it all into a list
    AttributeList result;
    for( AttributeTable::const_iterator i = attrs.begin(); i != attrs.end(); i++ )
        result.push_back( (*i).second );

    return result;
}
开发者ID:aarnchng,项目名称:osggis,代码行数:27,代码来源:OGR_Feature.cpp

示例7: startElement

void SAXPrintHandlers::startElement(const   XMLCh* const    name
                                    ,       AttributeList&  attributes)
{
    // The name has to be representable without any escapes
    fFormatter  << XMLFormatter::NoEscapes
                << chOpenAngle << name;

    unsigned int len = attributes.getLength();
    for (unsigned int index = 0; index < len; index++)
    {
        //
        //  Again the name has to be completely representable. But the
        //  attribute can have refs and requires the attribute style
        //  escaping.
        //
        fFormatter  << XMLFormatter::NoEscapes
                    << chSpace << attributes.getName(index)
                    << chEqual << chDoubleQuote
                    << XMLFormatter::AttrEscapes
		            << attributes.getValue(index)
                    << XMLFormatter::NoEscapes
                    << chDoubleQuote;
    }
    fFormatter << chCloseAngle;
}
开发者ID:xin3liang,项目名称:platform_external_xerces-cpp,代码行数:25,代码来源:SAXPrintHandlers.cpp

示例8:

void rise::parser::on_start_element(const Glib::ustring &_name,
                    		    const AttributeList &_attributes)
{
    Glib::ustring prefix, name = _name;
    auto pos = _name.find(':');
    if(pos != Glib::ustring::npos)
    {
	prefix = _name.substr(0, pos);
	name = _name.substr(pos + 1);
    }

    auto *el = doc.get_root_node();
    if(!el) el = doc.create_root_node();
    else el = context.top()->add_child(name, prefix);
    context.push(el);

    for(auto itr = _attributes.begin(); itr != _attributes.end(); ++itr)
    {
	Glib::ustring name = itr->name;
	Glib::ustring value = itr->value;
	auto pos = name.find(':');
	if(pos == Glib::ustring::npos)
	{
	    if(name == "xmlns") el->set_namespace_declaration(value);
	    else el->set_attribute(name, value);
	}
	else
	{
	    Glib::ustring prefix = name.substr(0, pos);
	    Glib::ustring suffix = name.substr(pos + 1);
	    if(prefix == "xmlns") el->set_namespace_declaration(value, suffix);
	    else el->set_attribute(suffix, value, prefix);
	}
    }
}
开发者ID:ierofant,项目名称:rise,代码行数:35,代码来源:parser.cpp

示例9: LoadError

void SAX_TransAGHandler::AGSetStart
(const XMLCh* const name, AttributeList& attr)
{
	string id = trans(attr.getValue("id")) ;
	string version = trans(attr.getValue("version")) ;

	try  {
		prevId = CreateAGSet(id);
		agIds.clear();    // erase ids of previous load
		agSetIds.push_back(prevId);

		a_version = version ;
		a_agId =  id ;

		StartStack.push(&SAX_TransAGHandler::AGSetSubStart);
		EndStack.push(&SAX_TransAGHandler::dummyEnd);
	}
	catch ( AGException e ) {
		throw agfio::LoadError(e.error());
	}
	catch ( ... ) {
		string msg = "AGSetStart : id '" + id + "'already exists ";
		throw agfio::LoadError(msg);
	}

}
开发者ID:eroux,项目名称:transcriber-ag,代码行数:26,代码来源:SAX_TransAGHandler.cpp

示例10: if

// invoked at the start of a subelement of AGSet
void SAX_TransAGHandler::AGSetSubStart
(const XMLCh* const name, AttributeList& attr)
{
  string tag = trans(name);

  if (!a_agId.empty() && !a_version.empty())
  	SetFeature(a_agId, "version", a_version) ;

  // if Metadata element is found
  if (tag == "Metadata") {
    StartStack.push(&SAX_TransAGHandler::MetadataSubStart);
    EndStack.push(&SAX_TransAGHandler::dummyEnd);
  }
  // if Timeline element is found
  else if (tag == "Timeline") {
    prevId = CreateTimeline(trans(attr.getValue("id")));
    StartStack.push(&SAX_TransAGHandler::TimelineSubStart);
    EndStack.push(&SAX_TransAGHandler::dummyEnd);
  }
  // if AG element is found
  else if (tag == "AG") {
    prevId = CreateAG(trans(attr.getValue("id")),
                      trans(attr.getValue("timeline")));

    agIds.push_back(prevId);
    StartStack.push(&SAX_TransAGHandler::AGSubStart);
    EndStack.push(&SAX_TransAGHandler::dummyEnd);
  }
}
开发者ID:eroux,项目名称:transcriber-ag,代码行数:30,代码来源:SAX_TransAGHandler.cpp

示例11: encodingFromMetaAttributes

TextEncoding HTMLMetaCharsetParser::encodingFromMetaAttributes(const AttributeList& attributes)
{
    bool gotPragma = false;
    Mode mode = None;
    String charset;

    for (AttributeList::const_iterator iter = attributes.begin(); iter != attributes.end(); ++iter) {
        const AtomicString& attributeName = iter->first;
        const String& attributeValue = iter->second;

        if (attributeName == http_equivAttr) {
            if (equalIgnoringCase(attributeValue, "content-type"))
                gotPragma = true;
        } else if (charset.isEmpty()) {
            if (attributeName == charsetAttr) {
                charset = attributeValue;
                mode = Charset;
            } else if (attributeName == contentAttr) {
                charset = extractCharset(attributeValue);
                if (charset.length())
                    mode = Pragma;
            }
        }
    }

    if (mode == Charset || (mode == Pragma && gotPragma))
        return TextEncoding(stripLeadingAndTrailingHTMLSpaces(charset));

    return TextEncoding();
}
开发者ID:dog-god,项目名称:iptv,代码行数:30,代码来源:HTMLMetaCharsetParser.cpp

示例12:

void SAX_TransAGHandler::structuredMetaStart
(const XMLCh* const name, AttributeList& attr)
{
  string s;
  // if start-of-element is reported,
  // store structured element as XML string in feature value
  // and push structuredMetaEnd handler
  //  storeMetaValueStart(name, attr);
  if ( ! prevValue.empty() ) prevValue += " ";
  prevValue += "<";
  prevValue += set_string(s, name);
  for ( int i = 0; i < attr.getLength(); ++i ) {
    prevValue += " ";
    prevValue += set_string(s, attr.getName(i));
    prevValue += "=\"";
    prevValue += set_string(s, attr.getValue(i));
    prevValue += "\"";
  }

  prevValue += ">";
  prevPos = prevValue.length();

  StartStack.push(&SAX_TransAGHandler::structuredMetaStart);
  EndStack.push(&SAX_TransAGHandler::structuredMetaEnd);
}
开发者ID:eroux,项目名称:transcriber-ag,代码行数:25,代码来源:SAX_TransAGHandler.cpp

示例13: bind_parameters

void Connection::bind_parameters( sqlite3_stmt *ppStmt,
                                  const AttributeList &parameters ) {
  int i = 0;
  for( AttributeList::const_iterator it = parameters.begin();
       it != parameters.end();
       ++it ) {
    switch( it->which() ) {
    case integer: {
      int value = boost::get< int >( *it );
      sqlite3_bind_int( ppStmt, i + 1, value );
      break;
    }
    case text: {
      string value = boost::get< std::string >( *it );
      sqlite3_bind_text( ppStmt, i + 1, value.c_str(), value.size(), 0 );
      break;
    }
    case floating_point: {
      double value = boost::get< double >( *it );
      sqlite3_bind_double( ppStmt, i + 1, value );
      break;
    }
    case date: {
      Date value = boost::get< Date >( *it );
      string s   = value.to_string();
      sqlite3_bind_text( ppStmt, i + 1, s.c_str(), s.size(), 0 );
      break;
    }
    default: {
      throw ActiveRecordException( "Type not implemented", __FILE__, __LINE__ );
    }
    }
    ++i;
  }
}
开发者ID:tomferreira,项目名称:cpp-active-record,代码行数:35,代码来源:connection.cpp

示例14: Attribute

AttributeList
SunPyInstance::build_preedit_attribs (const IPreeditString* ppd)
{
    AttributeList attrs;
    const int sz = ppd->charTypeSize();
    for (int i = 0; i < sz; ) {
        const int ct = ppd->charTypeAt(i);
        if (ct & IPreeditString::ILLEGAL) {
            const int start = i;
            for (++i; (i<sz) && (ppd->charTypeAt(i) & IPreeditString::ILLEGAL); ++i) ;
            attrs.push_back( Attribute(start, i-start,
                                       SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_REVERSE));
        } else if (ct & IPreeditString::NORMAL_CHAR) {
            if (ct & IPreeditString::USER_CHOICE) {
                const int start = i;
                for (++i; (i<sz) && (ppd->charTypeAt(i) & IPreeditString::USER_CHOICE); ++i) ;
                attrs.push_back( Attribute(start, i-start,
                                           SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_UNDERLINE));
            } else {
                ++i;
            }
        } else {
            ++i;
        }
    }
    return attrs;
}
开发者ID:Abioy,项目名称:sunpinyin,代码行数:27,代码来源:sunpinyin_imengine.cpp

示例15: SectionStart

/*
 * invoked at the start of a section
 *
 * We can't create the section because the children are not created yet.
 * So we keep the section data and we'll create it as soon as the children are
 * built.
 *
 * Take care:
 * We can create base element (sync tag) only when we arrive at the following
 * element tag (to get the split timestamp). As we need to wait for the base
 * element to be created for creating all parents (like sections), we always create
 * the previous section after encountering a section tag.
 * Therefore, at a section tag, we need to keep data of the previous section and data
 * of the current section.
 */
void SAX_TRSHandlers::SectionStart (const XMLCh* const name, AttributeList& attr)
{
	O_TRACE("IN SectionStart ");

	nbSections++ ;

	// -- As soon as we are at the 2nd section, we can indicates that we'll need
	//	  to create the previous one as soon as the children are built.
	if (nbSections > 1)
		sectionNeeded = true ;


	//>  keep data for the turn that will be created
	lastSectionType = currentSectionType ;
	lastSectionTopic = currentSectionTopic ;

	//>  Keep current data
	const string& topicId = trans(attr.getValue("topic")) ;
	currentSectionType = trans(attr.getValue("type")) ;
	currentSectionTopic = topics[topicId] ;

	if (nbSections==1)
	{
		dataModel->setElementProperty(m_sectId[0], "type", currentSectionType, false) ;
		dataModel->setElementProperty(m_sectId[0], "desc", currentSectionTopic, false) ;

		lastSectionType = currentSectionType ;
		lastSectionTopic = currentSectionTopic ;
	}

	StartStack.push(&SAX_TRSHandlers::TurnStart);
	EndStack.push(&SAX_TRSHandlers::dummyEnd);
	O_TRACE("OUT SectionStart ");
}
开发者ID:eroux,项目名称:transcriber-ag,代码行数:49,代码来源:SAX_TRSHandlers.cpp


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