本文整理汇总了C++中AttributeList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeList::append方法的具体用法?C++ AttributeList::append怎么用?C++ AttributeList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeList
的用法示例。
在下文中一共展示了AttributeList::append方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendDictationResults
/**
* @brief VoiceEndpoint::sendDictationResults
* Important: Pebble accepts only 1 sentence currently, hence need to choose the best one here
*/
void VoiceEndpoint::sendDictationResults()
{
if(m_sessId>0) {
if(m_sesTimer) {
killTimer(m_sesTimer);
m_sesTimer = 0;
m_sesPhase = PhResultSent;
}
quint32 flags = m_appUuid.isNull()?0:FlagAppInitiated;
quint8 result = (m_sesResult.sentences.count()>0)?ResSuccess:ResInvalidRecognizerResponse;
qDebug() << "Sending session recognition result" << result << "for session" << m_sessId << "with content" << m_sesResult.sentences.count() << "for app" << m_appUuid << m_appUuid.isNull();
QByteArray pkt;
WatchDataWriter writer(&pkt);
writer.write<quint8>(CmdDictatResult);
writer.writeLE<quint32>(flags);
writer.writeLE<quint16>(m_sessId);
writer.write<quint8>(result);
AttributeList al;
if(!m_appUuid.isNull())
al.append(Attribute(m_appUuid));
m_sesResult.sort(1);
if(result==ResSuccess)
al.append(Attribute(Transcription(m_sesResult)));
al.writerWrite(writer);
m_watchConnection->writeToPebble(WatchConnection::EndpointVoiceControl,pkt);
qDebug() << "Sent" << pkt.toHex();
}
}
示例2: processMeta
bool HTMLMetaCharsetParser::processMeta(HTMLToken& token)
{
AttributeList attributes;
for (auto& attribute : token.attributes()) {
String attributeName = StringImpl::create8BitIfPossible(attribute.name);
String attributeValue = StringImpl::create8BitIfPossible(attribute.value);
attributes.append(std::make_pair(attributeName, attributeValue));
}
m_encoding = encodingFromMetaAttributes(attributes);
return m_encoding.isValid();
}
示例3: processMeta
bool HTMLMetaCharsetParser::processMeta()
{
const HTMLToken::AttributeList& tokenAttributes = m_token.attributes();
AttributeList attributes;
for (HTMLToken::AttributeList::const_iterator iter = tokenAttributes.begin(); iter != tokenAttributes.end(); ++iter) {
String attributeName = StringImpl::create8BitIfPossible(iter->m_name.data(), iter->m_name.size());
String attributeValue = StringImpl::create8BitIfPossible(iter->m_value.data(), iter->m_value.size());
attributes.append(std::make_pair(attributeName, attributeValue));
}
m_encoding = encodingFromMetaAttributes(attributes);
return m_encoding.isValid();
}
示例4: parseTagAttributeValues
void DTD::parseTagAttributeValues(const QString &name, QString *value) {
AttributeList *attributes = new AttributeList();
QStringList attrLines = QStringList::split("\\end",*value);
QStringList::Iterator lineIt = attrLines.begin();
while (lineIt != attrLines.end()) //iterate through the attribute lines
{
//split the attribute line
QStringList all = QStringList::split(" ", *lineIt);
QStringList::Iterator it = all.begin();
while(it != all.end())
{
Attribute *attr = new Attribute();
attr->name = *it;
//kdDebug() << "Inserting for tag " << name << ": " << *it << endl;
++it;
QString values = *it;
//list of possible values
if ( values.startsWith("(") && values.endsWith(")") )
{
values.remove(0,1);
values.remove(values.length()-1,1);
attr->values = QStringList::split("|", values);
QString s = (attr->values[0]+attr->values[1]).lower();
stripSpaces(&s);
if ((s == "truefalse") || (s == "falsetrue"))
{
attr->type = "check";
} else
{
attr->type = "list";
}
} else
{
attr->values = values;
attr->type = "input";
}
//kdDebug() << " --- values: " << *it << endl;
if (it != all.end())
{
++it;
QString s=*it;
if (s.startsWith("\"") && s.endsWith("\"") && it!=all.end())
{
s.remove(0,1);
s.remove(s.length()-1,1);
attr->defaultValue = s;
}
if (s.startsWith("#") && it != all.end())
{
s.remove(0,1);
attr->status = s.lower();
}
if (*it == "#FIXED" && it != all.end())
{
++it;
attr->values.append(*it);
}
}
if (it != all.end())
{
++it;
}
attributes->append(attr);
}
++lineIt;
}
tagAttributes.insert(name, attributes);
}
示例5:
void ASF::Tag::setAttribute(const String &name, const Attribute &attribute)
{
AttributeList value;
value.append(attribute);
d->attributeListMap.insert(name, value);
}
示例6: saveElement
void saveElement(xmlElementPtr elem, xmlBufferPtr buf)
{
Q_UNUSED(buf);
if (elem)
{
QString elemName = QString((const char*)elem->name);
QFile file( DTD::dirName + elemName + ".tag" );
if ( file.open( IO_WriteOnly ) )
{
QTextStream stream( &file );
stream.setEncoding(QTextStream::UnicodeUTF8);
stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
stream << "<!DOCTYPE TAGS>" << endl
<< "<TAGS>" << endl
<< "<tag name=\"" << elemName << "\">" << endl << endl;
xmlElementPtr el_ptr; /* Pointer to an element description */
xmlAttributePtr at_ptr;
el_ptr = xmlGetDtdElementDesc(DTD::dtd_ptr, elem->name);
AttributeList attributes;
attributes.setAutoDelete(true);
if (el_ptr)
{
at_ptr = el_ptr->attributes;
while (at_ptr) {
Attribute *attr = new Attribute;
attr->name = QString((const char*)at_ptr->name);
switch (at_ptr->def) {
case 1: {attr->status = "optional"; break;} //NONE
case 2: {attr->status = "required"; break;} //REQUIRED
case 3: {attr->status = "implied"; break;} //IMPLIED
case 4: {attr->status = "fixed"; break;} //FIXED
}
attr->defaultValue = QString((const char*)at_ptr->defaultValue);
xmlEnumerationPtr enum_ptr;
enum_ptr = at_ptr->tree;
while (enum_ptr) {
attr->values += QString((const char*)enum_ptr->name);
enum_ptr = enum_ptr->next;
}
QString attrtype;
switch (at_ptr->atype) {
case 9: {attrtype = "list"; break;}
default: {attrtype = "input"; break;} //TODO handle the rest of types
}
attr->type = attrtype;
attributes.append(attr);
at_ptr = at_ptr->nexth;
}
}
if (!attributes.isEmpty())
stream << QuantaCommon::xmlFromAttributes(&attributes);
const xmlChar *list_ptr[MAX_CHILD_ELEMENTS];
int childNum = 0;
childNum = xmlValidGetPotentialChildren(el_ptr->content, list_ptr,
&childNum, MAX_CHILD_ELEMENTS);
if (childNum > 0)
{
stream << "<children>" << endl;
for( int i = 0; i < childNum; i++ )
{
stream << " <child name=\"" << QString((const char*)list_ptr[i]) << "\"";
xmlElementPtr child_ptr = xmlGetDtdElementDesc(DTD::dtd_ptr, list_ptr[i]);
if (child_ptr && child_ptr->content && child_ptr->content->ocur)
{
//if (child_ptr->content->ocur == XML_ELEMENT_CONTENT_PLUS)
//{
// stream << " usage=\"required\"";
// }
QString ocur;
switch (child_ptr->content->ocur)
{
case 1: {ocur = "once"; break;}
case 2: {ocur = "opt"; break;}
case 3: {ocur = "mult"; break;}
case 4: {ocur = "plus"; break;}
}
stream << " usage=\"" << ocur << "\"";
QString name = QString((const char*)child_ptr->content->name);
if (name == "#PCDATA")
name == "#text";
stream << " name2=\"" << name << "\"";
}
stream << " />" << endl;
}
stream << "</children>" << endl;
stream << endl;
}
/*
xmlElementContentPtr content_ptr = el_ptr->content;
if (content_ptr)
{
stream << "<children>" << endl;
while (content_ptr)
{
if (!QString((const char*)content_ptr->name).isEmpty())
{
stream << " <child name=\"" << QString((const char*)content_ptr->name) << "\"";
//.........这里部分代码省略.........