本文整理汇总了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" ;
}
}
示例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());
}
示例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);
}
示例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));
}
示例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));
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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);
}
示例13: bind_parameters
void Connection::bind_parameters( sqlite3_stmt *ppStmt,
const AttributeList ¶meters ) {
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;
}
}
示例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;
}
示例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 ");
}