本文整理汇总了C++中parseAttribute函数的典型用法代码示例。如果您正苦于以下问题:C++ parseAttribute函数的具体用法?C++ parseAttribute怎么用?C++ parseAttribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseAttribute函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fromXElement
bool LyricAttributes::fromXElement( std::ostream& message, xml::XElement& xelement )
{
const char* const className = "LyricAttributes";
bool isSuccess = true;
auto it = xelement.attributesBegin();
auto endIter = xelement.attributesEnd();
for( ; it != endIter; ++it )
{
if( parseAttribute( message, it, className, isSuccess, number, hasNumber, "number" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, name, hasName, "name" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, justify, hasJustify, "justify", &parseLeftCenterRight ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, defaultX, hasDefaultX, "default-x" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, defaultY, hasDefaultY, "default-y" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, relativeX, hasRelativeX, "relative-x" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, relativeY, hasRelativeY, "relative-y" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, placement, hasPlacement, "placement", &parseAboveBelow ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, color, hasColor, "color" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, printObject, hasPrintObject, "print-object", &parseYesNo ) ) { continue; }
}
return isSuccess;
}
开发者ID:Webern,项目名称:MxProg,代码行数:25,代码来源:LyricAttributes.cpp
示例2: fromXElement
bool BookmarkAttributes::fromXElement( std::ostream& message, xml::XElement& xelement )
{
const char* const className = "BookmarkAttributes";
bool isSuccess = true;
bool isIdFound = false;
auto it = xelement.attributesBegin();
auto endIter = xelement.attributesEnd();
for( ; it != endIter; ++it )
{
if( parseAttribute( message, it, className, isSuccess, id, isIdFound, "id" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, name, hasName, "name" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, element, hasElement, "element" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, position, hasPosition, "position" ) ) { continue; }
}
if( !isIdFound )
{
isSuccess = false;
message << className << ": 'number' is a required attribute but was not found" << std::endl;
}
return isSuccess;
}
开发者ID:Webern,项目名称:MxProg,代码行数:25,代码来源:BookmarkAttributes.cpp
示例3: eatChar
bool XmlReader::parseXmlHeader () {
eatChar ('?');
char * name = getNextToken ();
if (name == NULL || strcmp (name, "xml") != 0) {
free (name);
MESSAGE ("Error: XML must start with a valid xml declaration <?xml ?> !'\n");
m_failure = true;
return false;
}
free (name);
XmlAttribute * attr = parseAttribute ();
while (attr != NULL) {
if (m_iconv == NULL && strcmp (attr->m_name, "encoding") == 0 && strcmp (attr->m_value, "UTF-8") != 0) {
// Setup caracter conversion as encoding is not UTF-8
m_iconv = iconv_open ("UTF-8", attr->m_value);
if (m_iconv == (iconv_t)-1) { // unsupported target encoding
MESSAGE ("Error: unsupported encoding in xml declaration: %s\n", attr->m_value);
return false;
}
}
delete attr;
attr = parseAttribute ();
}
if (eatChar ('?') && eatChar ('>')) {
return true;
}
MESSAGE ("Error: <?xml declaration must end with a valid '?>' value !'\n");
return false;
}
开发者ID:jperrot,项目名称:MeMoPlayer,代码行数:29,代码来源:XmlReader.cpp
示例4: parseAttribute
Slot* Parser::parseSlot(Node *_parent,const xmlDocPtr &_doc, xmlNodePtr _cur, std::map<std::string, std::string> *_map)
{
Slot *s = 0;
xmlChar *name,*type, *var;
name = parseAttribute(_cur, "name");
type = parseAttribute(_cur, "type");
var = parseAttribute(_cur, "var");
EnumParser<SVariable> p;
EnumParser<Stype> p2;
s = new Slot(
_parent,
(const char*)name,
p2.parseEnum((const char*)_cur->name),
p.parseEnum((const char*)var)
);
_cur=_cur->children;
while(_cur !=NULL)
{
if(!xmlStrcmp(_cur->name, (const xmlChar *)SLOTSOURCE))
{
std::cout<<"in source slot"<<'\n';
std::string output, input;
input = _parent->getName()+"."+ _parent->getID()+"."+ (char *)name;
output = parseSource(_cur, _map);
_map->insert(std::pair<std::string, std::string>(input, output));
}
_cur=_cur->next;
}
xmlFree(name);
xmlFree(type);
xmlFree(var);
return s;
}
开发者ID:skirk,项目名称:3rdYearMajor,代码行数:33,代码来源:Parser.cpp
示例5: parseAttribute
const Token* AttributesParser::parseAttributes(const Token* pNext)
{
pNext = parseAttribute(pNext);
while (isOperator(pNext, OperatorToken::OP_COMMA) || isIdentifier(pNext))
{
if (!isIdentifier(pNext)) pNext = next();
pNext = parseAttribute(pNext);
}
return pNext;
}
开发者ID:12307,项目名称:poco,代码行数:10,代码来源:AttributesParser.cpp
示例6: iter
void
TooltipManager::parse(XmlReader& reader)
{
XmlReader::AttributeIterator iter(reader);
while(iter.next()) {
const char* attribute = (const char*) iter.getName();
const char* value = (const char*) iter.getValue();
if(parseAttribute(attribute, value)) {
continue;
} else {
std::cerr << "Skipping unknown attribute '" << attribute
<< "' in TooltipManager.\n";
}
}
int depth = reader.getDepth();
while(reader.read() && reader.getDepth() > depth) {
if(reader.getNodeType() == XML_READER_TYPE_ELEMENT) {
const char* element = (const char*) reader.getName();
std::cerr << "Skipping unknown child '" << element
<< "in TooltipManager.\n";
}
}
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:25,代码来源:TooltipManager.cpp
示例7: fnCompoundAttribute
void AttributeParser::parseCompoundAttribute(MFnDependencyNode & node, MObject & attr, std::set<String>& parsedAttributes)
{
MStatus status;
MFnCompoundAttribute fnCompoundAttribute(attr, &status);
if (!status) return;
unsigned int numChildren = fnCompoundAttribute.numChildren(&status);
if (!status) return;
MPlug plug = node.findPlug(attr, &status);
if (!status) return;
MFnAttribute fnAttr(attr, &status);
if (!status) return;
MString name = fnAttr.name(&status);
if (!status) return;
onCompoundAttribute(plug, name);
// Recurse children
for (unsigned int i = 0; i < fnCompoundAttribute.numChildren(); ++i)
{
MObject child = fnCompoundAttribute.child(i, &status);
if (!status) return;
MFnAttribute childFnAttr(child);
parsedAttributes.insert(childFnAttr.name().asChar());
parseAttribute(node, child, parsedAttributes);
}
}
开发者ID:dabiaoluo,项目名称:OpenCOLLADA,代码行数:33,代码来源:COLLADAMayaAttributeParser.cpp
示例8: iter
void
LCPBar::parse(XmlReader& reader)
{
XmlReader::AttributeIterator iter(reader);
while(iter.next()) {
const char* name = (const char*) iter.getName();
const char* value = (const char*) iter.getValue();
if(parseAttribute(name, value)) {
continue;
} else {
std::cerr << "Unknown attribute '" << name
<< "' skipped in PBar.\n";
}
}
if(getName() == "PBar")
{
//LCPBarInstance = this; //FIXME old code compability hack
LCPBarPage1 = this;
}
else if(getName() == "PBar2nd")
{ LCPBarPage2 = this;}
else
{ std::cerr << "Unknown LCBar component '" << getName() << "' found.\n";}
Component* component = parseEmbeddedComponent(reader);
addChild(component);
width = component->getWidth();
height = component->getHeight();
}
开发者ID:okosan,项目名称:lincity-xg,代码行数:32,代码来源:PBar.cpp
示例9: parseWhitespace
void Parser::parseXMLDeclaration( Node *node )
{
if( !doesStreamMatchString( "<?xml" ) )
return;
Node *thisNode = new Node;
thisNode->setNodeType( XMLDeclaration );
try
{
do
parseWhitespace();
while( parseAttribute( thisNode ) );
parseWhitespace();
if( !doesStreamMatchString( "?>" ) )
reportError( "XML declaration does not end with ?>" );
}
catch( ... )
{
delete thisNode;
throw;
}
node->addNode( thisNode );
}
开发者ID:BackupTheBerlios,项目名称:iris-svn,代码行数:26,代码来源:xml.cpp
示例10: iter
void
Gradient::parse(XmlReader& reader)
{
XmlReader::AttributeIterator iter(reader);
while(iter.next()) {
const char* attribute = (const char*) iter.getName();
const char* value = (const char*) iter.getValue();
if(parseAttribute(attribute, value)) {
continue;
} else if(strcmp(attribute, "from") == 0) {
from.parse(value);
} else if(strcmp(attribute, "to") == 0) {
to.parse(value);
} else if (strcmp(attribute, "direction") == 0) {
if(strcmp(value, "left-right") == 0) {
direction = LEFT_RIGHT;
} else if (strcmp(value, "top-bottom") == 0) {
direction = TOP_BOTTOM;
} else {
std::stringstream msg;
msg << "Invalid gradient direction '" << value << "'.";
throw std::runtime_error(msg.str());
}
} else {
std::cerr << "Skipping unknown attribute '"
<< attribute << "'.\n";
}
}
flags |= FLAG_RESIZABLE;
}
开发者ID:SirIvanMoReau,项目名称:lincity-ng,代码行数:32,代码来源:Gradient.cpp
示例11: parseAttribute
//! [font_translate]
void FontTranslator::translate(ScriptCompiler* compiler, const AbstractNodePtr& node)
{
ObjectAbstractNode* obj = static_cast<ObjectAbstractNode*>(node.get());
// Must have a name - unless we are in legacy mode. Then the class is the name.
if (obj->name.empty() && obj->cls == "font")
{
compiler->addError(ScriptCompiler::CE_OBJECTNAMEEXPECTED, obj->file, obj->line,
"font must be given a name");
return;
}
String& name = obj->cls == "font" ? obj->name : obj->cls;
FontPtr font = FontManager::getSingleton().create(name, compiler->getResourceGroup());
font->_notifyOrigin(obj->file);
for (auto& c : obj->children)
{
if (c->type == ANT_PROPERTY)
{
parseAttribute(compiler, font, static_cast<PropertyAbstractNode*>(c.get()));
}
}
}
开发者ID:terakuran,项目名称:ogre,代码行数:26,代码来源:OgreOverlayTranslator.cpp
示例12: setCatalogAttributes
Boolean FSIParser::setCatalogAttributes(ParsedSystemId &parsedSysid)
{
Boolean hadPublic = 0;
parsedSysid.maps.resize(parsedSysid.maps.size() + 1);
parsedSysid.maps.back().type = ParsedSystemIdMap::catalogDocument;
for (;;) {
StringC token, value;
Boolean gotValue;
if (!parseAttribute(token, gotValue, value)) {
mgr_.message(EntityManagerMessages::fsiSyntax, StringMessageArg(str_));
return 0;
}
if (token.size() == 0)
break;
if (matchKey(token, "PUBLIC")) {
if (hadPublic)
mgr_.message(EntityManagerMessages::fsiDuplicateAttribute,
StringMessageArg(idCharset_.execToDesc("PUBLIC")));
else if (gotValue) {
convertMinimumLiteral(value, parsedSysid.maps.back().publicId);
parsedSysid.maps.back().type = ParsedSystemIdMap::catalogPublic;
}
else
mgr_.message(EntityManagerMessages::fsiMissingValue,
StringMessageArg(token));
hadPublic = 1;
}
else
mgr_.message(gotValue
? EntityManagerMessages::fsiUnsupportedAttribute
: EntityManagerMessages::fsiUnsupportedAttributeToken,
StringMessageArg(token));
}
return 1;
}
开发者ID:juddy,项目名称:edcde,代码行数:35,代码来源:ExtendEntityManager.C
示例13: parseAttribute
bool QQuickStyledTextPrivate::parseOrderedListAttributes(const QChar *&ch, const QString &textIn)
{
bool valid = false;
List listItem;
listItem.level = 0;
listItem.type = Ordered;
listItem.format = Decimal;
QPair<QStringRef,QStringRef> attr;
do {
attr = parseAttribute(ch, textIn);
if (attr.first == QLatin1String("type")) {
valid = true;
if (attr.second == QLatin1String("a"))
listItem.format = LowerAlpha;
else if (attr.second == QLatin1String("A"))
listItem.format = UpperAlpha;
else if (attr.second == QLatin1String("i"))
listItem.format = LowerRoman;
else if (attr.second == QLatin1String("I"))
listItem.format = UpperRoman;
}
} while (!ch->isNull() && !attr.first.isEmpty());
listStack.push(listItem);
return valid;
}
开发者ID:Sagaragrawal,项目名称:2gisqt5android,代码行数:28,代码来源:qquickstyledtext.cpp
示例14: skipSpaces
XmlNode * XmlReader::parseTag (char c) {
c = skipSpaces (); // '<' has been eaten to check for a comment
bool closing = false;
if (c == '/') { // ending tag
closing = true;
c = getNextChar ();
}
char * name = getNextToken ();
if (name == NULL) {
MESSAGE ("Error: XML tags must start with an alpha caracter !'");
m_failure = true;
return NULL;
}
XmlNode * e = new XmlNode (name, closing ? CLOSE_TAG : OPEN_TAG);
if (!closing) { // may have some attributes
XmlAttribute * attr = parseAttribute ();
while (attr != NULL) {
e->addAttribute (attr);
attr = parseAttribute ();
}
}
// final '>'
c = getChar ();
if (c == '/') { // self tag
if (closing) {
delete e;
MESSAGE ("Error: closing is also self closing: %s", e->m_name);
m_failure = true;
return NULL;
}
e->m_type = SELF_TAG;
c = getNextChar ();
}
// check for nodes that shoudl be self closing: BR, HR, IMG
// if (m_htmlMode && e->m_type == OPEN_TAG) {
// e.m_type = checkHtmlSelfClosing(e.m_name);
// }
if (c != '>') { // ending tag
delete e;
MESSAGE ("Error: got '%c' instead of '>'", c);
m_failure = true;
return NULL;
}
getNextChar (); // eat '>'
return e;
}
开发者ID:jperrot,项目名称:MeMoPlayer,代码行数:47,代码来源:XmlReader.cpp
示例15: fromXElement
bool MidiDeviceAttributes::fromXElement( std::ostream& message, xml::XElement& xelement )
{
const char* const className = "MidiDeviceAttributes";
bool isSuccess = true;
auto it = xelement.attributesBegin();
auto endIter = xelement.attributesEnd();
for( ; it != endIter; ++it )
{
if( parseAttribute( message, it, className, isSuccess, port, hasPort, "port" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, id, hasId, "id" ) ) { continue; }
}
return isSuccess;
}
开发者ID:Webern,项目名称:MxProg,代码行数:17,代码来源:MidiDeviceAttributes.cpp
示例16: fromXElement
bool DirectionAttributes::fromXElement( std::ostream& message, xml::XElement& xelement )
{
const char* const className = "DirectionAttributes";
bool isSuccess = true;
auto it = xelement.attributesBegin();
auto endIter = xelement.attributesEnd();
for( ; it != endIter; ++it )
{
if( parseAttribute( message, it, className, isSuccess, placement, hasPlacement, "placement", &parseAboveBelow ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, directive, hasDirective, "directive", &parseYesNo ) ) { continue; }
}
return isSuccess;
}
开发者ID:Webern,项目名称:MxProg,代码行数:17,代码来源:DirectionAttributes.cpp
示例17: parseDwarfInfo
static int
parseDwarfInfo(char *line, Dwarf_Die *lastCreatedDie, Dwarf_Die *currentDie,
size_t *lastIndent, unordered_map<Dwarf_Die *, Dwarf_Off> *refToPopulate,
Dwarf_Error *error)
{
int ret = DW_DLV_OK;
/* There are two possible formats for a line. Every second line
* is blank. Non-blank lines either begin with
* "0x[address]: [whitespace...] TAG_*" to represent a new Die org/legal/epl-v10
* "[whitespae...] AT_*( {[optional address]} ( [value] ) ) for a die attribute.
* The amount of whitespace varies to indicate parent-child relationships
* between Die's.
*/
if (0 == strncmp("0x", line, 2)) {
/* Find the end of the address and number of spaces. Amount of indentation
* represents parent-child relationship between Dwarf_Die's.
*/
char *endOfAddress = NULL;
Dwarf_Off address = strtoul(line, &endOfAddress, 16);
size_t spaces = 0;
if (NULL != endOfAddress) {
endOfAddress += 1;
spaces = strspn(endOfAddress, " ");
}
/* The string "TAG_[tag]" or "Compile Unit:" or "NULL" should be next. */
if (0 == strncmp(endOfAddress + spaces, "Compile Unit: ", 14)) {
cleanUnknownDiesInCU(Dwarf_CU_Context::_currentCU);
ret = parseCompileUnit(endOfAddress + spaces + 14, lastIndent, error);
lastCreatedDie = NULL;
} else if (0 == strncmp(endOfAddress + spaces, "TAG_", 4)) {
ret = parseDwarfDie(endOfAddress + spaces + 4, lastCreatedDie, currentDie, lastIndent, spaces, error);
if (DW_DLV_OK == ret && DW_TAG_unknown != (*lastCreatedDie)->_tag) {
Dwarf_Die_s::refMap[address] = *lastCreatedDie;
}
} else if (0 == strncmp(endOfAddress + spaces, "NULL", 4)) {
/* A "NULL" line indicates going up one level in the Die tree.
* Process it only if the current level contained a Die that was
* processed.
*/
if (spaces <= *lastIndent) {
*lastCreatedDie = (*lastCreatedDie)->_parent;
}
} else {
ret = DW_DLV_ERROR;
setError(error, DW_DLE_VMM);
}
} else if ((0 == strncmp(" ", line, 2)) && (NULL != *currentDie)) {
/* Die attribute lines begin with "[whitespace...] AT_". To belong
* to the last Die to be created, it must contain 12 spaces more
* than the last indentation (For the size of the Die offset text).
*/
size_t spaces = strspn(line, " ");
if ((spaces == *lastIndent + 12) && (0 == strncmp(line + spaces, "AT_", 3))) {
ret = parseAttribute(line + spaces + 3, lastCreatedDie, refToPopulate, error);
}
}
return ret;
}
开发者ID:jduimovich,项目名称:omr,代码行数:58,代码来源:DwarfParser.cpp
示例18: fromXElement
bool BeamAttributes::fromXElement( std::ostream& message, xml::XElement& xelement )
{
const char* const className = "BeamAttributes";
bool isSuccess = true;
auto it = xelement.attributesBegin();
auto endIter = xelement.attributesEnd();
for( ; it != endIter; ++it )
{
if( parseAttribute( message, it, className, isSuccess, number, hasNumber, "number" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, repeater, hasRepeater, "repeater", &parseYesNo ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, fan, hasFan, "fan", &parseFan ) ) { continue; }
}
return isSuccess;
}
开发者ID:Webern,项目名称:MxProg,代码行数:18,代码来源:BeamAttributes.cpp
示例19: iter
void EconomyGraph::parse( XmlReader& reader ){
XmlReader::AttributeIterator iter( reader );
while(iter.next()) {
const char* name = (const char*) iter.getName();
const char* value = (const char*) iter.getValue();
if(parseAttribute(name, value)){
continue;
} else if(strcmp(name, "width") == 0) {
if(sscanf(value, "%f", &width) != 1) {
std::stringstream msg;
msg << "Couldn't parse width attribute (" << value << ").";
throw std::runtime_error(msg.str());
}
} else if(strcmp(name, "height") == 0) {
if(sscanf(value, "%f", &height) != 1) {
std::stringstream msg;
msg << "Couldn't parse height attribute (" << value << ").";
throw std::runtime_error(msg.str());
}
} else {
std::cerr << "Unknown attribute '" << name
<< "' skipped in EconomyGraph.\n";
}
}
//Generate Labels for Sustainability Graph
Style labelStyle;
labelStyle.font_family = "sans";
labelStyle.font_size = 10;
TTF_Font* font = fontManager->getFont( labelStyle );
SDL_Surface* labelXXX;
/* MIN=Mining, PRT=Import/export from port,
MNY=Money, POP=Population, TEC=Technology,
FIR=Fire coverage
*/
labelXXX = TTF_RenderUTF8_Blended( font, _("Mining"), labelStyle.text_color.getSDLColor() );
labelTextureMIN = texture_manager->create( labelXXX );
labelXXX = TTF_RenderUTF8_Blended( font, _("Trade"), labelStyle.text_color.getSDLColor() );
labelTexturePRT = texture_manager->create( labelXXX );
labelXXX = TTF_RenderUTF8_Blended( font, _("Money"), labelStyle.text_color.getSDLColor() );
labelTextureMNY = texture_manager->create( labelXXX );
labelXXX = TTF_RenderUTF8_Blended( font, _("Popul."), labelStyle.text_color.getSDLColor() );
labelTexturePOP = texture_manager->create( labelXXX );
labelXXX = TTF_RenderUTF8_Blended( font, _("Techn."), labelStyle.text_color.getSDLColor() );
labelTextureTEC = texture_manager->create( labelXXX );
labelXXX = TTF_RenderUTF8_Blended( font, _("Fire"), labelStyle.text_color.getSDLColor() );
labelTextureFIR = texture_manager->create( labelXXX );
labelXXX = TTF_RenderUTF8_Blended( font, _("Economy Overview:"), labelStyle.text_color.getSDLColor() );
labelTextureEconomy = texture_manager->create( labelXXX );
labelXXX = TTF_RenderUTF8_Blended( font, _("Sustainability:"), labelStyle.text_color.getSDLColor() );
labelTextureSustainability = texture_manager->create( labelXXX );
labelXXX = TTF_RenderUTF8_Blended( font, _("Frames per Second:"), labelStyle.text_color.getSDLColor() );
labelTextureFPS = texture_manager->create( labelXXX );
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:57,代码来源:EconomyGraph.cpp
示例20: fromXElement
bool BarlineAttributes::fromXElement( std::ostream& message, xml::XElement& xelement )
{
const char* const className = "BarlineAttributes";
bool isSuccess = true;
auto it = xelement.attributesBegin();
auto endIter = xelement.attributesEnd();
for( ; it != endIter; ++it )
{
if( parseAttribute( message, it, className, isSuccess, location, hasLocation, "location", &parseRightLeftMiddle ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, segno, hasSegno, "segno" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, coda, hasCoda, "coda" ) ) { continue; }
if( parseAttribute( message, it, className, isSuccess, divisions, hasDivisions, "divisions" ) ) { continue; }
}
return isSuccess;
}
开发者ID:Webern,项目名称:MxProg,代码行数:19,代码来源:BarlineAttributes.cpp
注:本文中的parseAttribute函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论