void writeStrAttribute(H5::Group &location, const std::string &name, const std::string &value) { StrType attrType(0, H5T_VARIABLE); DataSpace attrSpace(H5S_SCALAR); auto groupAttr = location.createAttribute(name, attrType, attrSpace); groupAttr.write(attrType, value); }
void CBookmarksView::OpenAttribute(std::_tstring line, int column, std::_tstring module, std::_tstring attribute, std::_tstring attributeType) { std::_tstring attrType(attributeType); IAttributeType *type = CreateIAttributeType(attrType); int row = boost::lexical_cast<int>(line); std::wstring m(module); std::wstring a(attribute); GetIMainFrame()->OpenAttribute(m, a, type, row, column); }
XSDOper *XSDOperationFactory::getBaseRef() { XSDOper *oper = new XSDOper(); addAnnotation(oper); QPair<QString, QString> attrName(IO_ELEMENT_ATTR_NAME, XSDOperationParameters::TokenName); oper->attributesToAdd << attrName; QPair<QString, QString> attrType(IO_ELEMENT_ATTR_TYPE, XSDOperationParameters::TokenType); oper->attributesToAdd << attrType; oper->attributesToRemove << IO_ELEMENT_ATTR_REF; return oper; }
// ----------------------------------------------------------------------------- // CNATFWUNSAFMessageFactory::DecodeL // Mandatory UNSAF attributes must be understood. Optional attributes are // ignored when not understood. // ----------------------------------------------------------------------------- // EXPORT_C CNATFWUNSAFMessage* CNATFWUNSAFMessageFactory::DecodeL( const TDesC8& aNATFWUNSAFMessage) const { __TEST_INVARIANT; CNATFWUNSAFMessage* msg = DecodeHeaderLC(aNATFWUNSAFMessage); NATFWUNSAF_BYTESTREAMLOG("CNATFWUNSAFMessageFactory::DecodeL data", aNATFWUNSAFMessage); TInt msgLengthExcludingHeader = MessageLength(aNATFWUNSAFMessage); TInt pos(0); while (pos < msgLengthExcludingHeader) { TPtrC8 msgBody = aNATFWUNSAFMessage.Mid( CNATFWUNSAFMessage::EHeaderSize + pos); //Can't use the enum, as attribute type could have an unrecognized //value TUint16 attrType(0); TUint16 attrTotalLength(0); //includes type, length, value CNATFWUNSAFAttribute::ParseTypeAndLengthL(msgBody, attrType, attrTotalLength); TDecodeFnPtr decodeFn = iAttributeLookupTable->Find(attrType); if (decodeFn) { //After detecting this is a known attribute, check it is allowed to //be present in this msgType, if not, ignore it w/o decoding. if (msg->IsAllowed(attrType)) { CNATFWUNSAFAttribute* attr = (*decodeFn)(msgBody); CleanupStack::PushL(attr); msg->AddAttributeL(attr); CleanupStack::Pop(attr); } } else { if (CNATFWUNSAFAttribute::IsMandatory(attrType)) { msg->UnknownMandatoryAttributeFound(); } } pos += attrTotalLength; } CleanupStack::Pop(msg); return msg; }
std::string AAttribute::attrTypeStr() const { std::string r("unknown"); switch (attrType()) { case aNumeric: r = "numeric"; break; case aEnum: r = "enum"; break; case aString: r = "string"; break; case aCompound: r = "compound"; break; default: break; } return r; }
void AstAttrOf::dump(ostream& str) { this->AstNode::dump(str); str<<" ["<<attrType().ascii()<<"]"; }
bool AAttribute::isCompound() const { return attrType() == aCompound; }
bool AAttribute::isString() const { return attrType() == aString; }
bool AAttribute::isEnum() const { return attrType() == aEnum; }
bool AAttribute::isNumeric() const { return attrType() == aNumeric; }