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


C++ parseAttribute函数代码示例

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


在下文中一共展示了parseAttribute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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