void GUI::YuvFileOpenDialog::hasFinished(int result) { if(result==QDialog::Accepted) { int selectedindex=-1; if(!listView_recentlyUsed_->selectionModel()->selectedIndexes().isEmpty()) { selectedindex=listView_recentlyUsed_->selectionModel()->selectedIndexes().first().row(); } QString fileattributes; if(selectedindex!=-1&&getFilename()==getListModel()->stringList().at(selectedindex)) { bool res=parseAttributes(attributes_[selectedindex]); if(!res) { if((fileattributes=askAttributes()).isEmpty()) { setResult(QDialog::Rejected); return; } } else { fileattributes=attributes_[selectedindex]; } } else { if(getFilename().isEmpty()||(fileattributes=askAttributes()).isEmpty()) { setResult(QDialog::Rejected); return; } } parseAttributes(fileattributes); saveListModel(getFilename(),fileattributes); } }
bool ProcessingInstruction::checkStyleSheet(String& href, String& charset) { if (m_target != "xml-stylesheet" || !document().frame() || parentNode() != document()) return false; // see http://www.w3.org/TR/xml-stylesheet/ // ### support stylesheet included in a fragment of this (or another) document // ### make sure this gets called when adding from javascript bool attrsOk; const HashMap<String, String> attrs = parseAttributes(m_data, attrsOk); if (!attrsOk) return false; HashMap<String, String>::const_iterator i = attrs.find("type"); String type; if (i != attrs.end()) type = i->value; m_isCSS = type.isEmpty() || type == "text/css"; m_isXSL = (type == "text/xml" || type == "text/xsl" || type == "application/xml" || type == "application/xhtml+xml" || type == "application/rss+xml" || type == "application/atom+xml"); if (!m_isCSS && !m_isXSL) return false; href = attrs.get("href"); charset = attrs.get("charset"); String alternate = attrs.get("alternate"); m_alternate = alternate == "yes"; m_title = attrs.get("title"); m_media = attrs.get("media"); return !m_alternate || !m_title.isEmpty(); }
inline bool TamlXmlParser::parseElement( TiXmlElement* pXmlElement, TamlVisitor& visitor ) { // Debug Profiling. PROFILE_SCOPE(TamlXmlParser_ParseElement); // Parse attributes (stop processing if instructed). if ( !parseAttributes( pXmlElement, visitor ) ) return false; // Finish if only the root is needed. if ( visitor.wantsRootOnly() ) return false; // Fetch any children. TiXmlNode* pChildXmlNode = pXmlElement->FirstChild(); // Do we have any element children? if ( pChildXmlNode != NULL && pChildXmlNode->Type() == TiXmlNode::TINYXML_ELEMENT ) { // Iterate children. for ( TiXmlElement* pChildXmlElement = dynamic_cast<TiXmlElement*>( pChildXmlNode ); pChildXmlElement; pChildXmlElement = pChildXmlElement->NextSiblingElement() ) { // Parse element (stop processing if instructed). if ( !parseElement( pChildXmlElement, visitor ) ) return false; } } return true; }
//----------------------------------------------------------------------- ISDPTypes::SDPPtr SDPParser::parse(const char *blob) { if (!blob) return SDPPtr(); SDPPtr sdp(make_shared<SDP>()); sdp->mOriginal = String(blob); std::unique_ptr<char[]> rawBuffer(new char[sdp->mOriginal.length()+1]); sdp->mRawBuffer = std::move(rawBuffer); memset(sdp->mRawBuffer.get(), 0, sizeof(char)*(sdp->mOriginal.length()+1)); memcpy(sdp->mRawBuffer.get(), blob, sizeof(char)*(sdp->mOriginal.length())); try { parseLines(*sdp); parseAttributes(*sdp); validateAttributeLevels(*sdp); parseLinesDetails(*sdp); processFlagAttributes(*sdp); processSessionLevelValues(*sdp); processMediaLevelValues(*sdp); processSourceLevelValues(*sdp); } catch (const SafeIntException &e) { ORTC_THROW_INVALID_PARAMETERS("value found out of legal value range" + string(e.m_code)); } return sdp; }
Lexer::Token Artlink::parse( Lexer* lexer ) { Lexer::Token tok( parseAttributes( lexer ) ); while( tok != Lexer::END ) { if( tok == Lexer::TAG ) { if( lexer->tagId() == Lexer::LINK ) { Link* link( new Link( document, this, document->dataName(), document->lexerLine(), document->lexerCol() ) ); appendChild( link ); link->setNoEndTag(); link->setHypergraphic(); tok = link->parse( lexer ); } else if( lexer->tagId() == Lexer::EARTLINK || lexer->tagId() == Lexer::EUSERDOC ) break; else parseCleanup( lexer, tok ); } else { if( tok != Lexer::WHITESPACE ) printError( ERR1_TAGCONTEXT ); tok = document->getNextToken(); } } return tok; }
void VertexShader::compile() { uncompile(); compileToHLSL(mVertexCompiler); parseAttributes(); parseVaryings(); }
int Tag::parseFurther () { if (m_pTagAttrString) { parseAttributes (m_pTagAttrString); } return m_attrList.size (); }
Lexer::Token P::parse( Lexer* lexer ) { Lexer::Token tok( parseAttributes( lexer ) ); while( tok != Lexer::END && !( tok == Lexer::TAG && lexer->tagId() == Lexer::EUSERDOC ) ) { //may contain inline, not block if( parseInline( lexer, tok ) ) break; } return tok; }
void CModelReaderNode_Slices1507_Segment::parseXML(_In_ CXmlReader * pXMLReader) { // Parse name parseName(pXMLReader); // Parse attribute parseAttributes(pXMLReader); // Parse Content parseContent(pXMLReader); }
void AttributesParser::parse() { const Token* pNext = next(); if (!isEOF(pNext)) { pNext = parseAttributes(pNext); } if (!isEOF(pNext)) throw Poco::SyntaxException("extra tokens found in attribute declaration"); }
void CModelReader_Slice1507_SliceRefModel::parseXML(_In_ CXmlReader * pXMLReader) { // Parse name parseName(pXMLReader); // Parse attribute parseAttributes(pXMLReader); // Parse Content parseContent(pXMLReader); }
void CModelReaderNode093_Components::parseXML(_In_ CXmlReader * pXMLReader) { // Parse name parseName(pXMLReader); // Parse attribute parseAttributes(pXMLReader); // Parse Content parseContent(pXMLReader); }
void COpcPackageRelationshipReader::parseRootNode(_In_ CXmlReader * pXMLReader) { if (pXMLReader == nullptr) throw CNMRException(NMR_ERROR_INVALIDPARAM); parseAttributes(pXMLReader); while (!pXMLReader->IsEOF()) { LPCWSTR pwszLocalName = nullptr; LPCWSTR pwszNameSpaceURI = nullptr; UINT nCount = 0; UINT nNameSpaceCount = 0; eXmlReaderNodeType NodeType; pXMLReader->Read(NodeType); switch (NodeType) { case XMLREADERNODETYPE_STARTELEMENT: pXMLReader->GetLocalName(&pwszLocalName, &nCount); if (!pwszLocalName) throw CNMRException(NMR_ERROR_COULDNOTGETLOCALXMLNAME); pXMLReader->GetNamespaceURI(&pwszNameSpaceURI, &nNameSpaceCount); if (!pwszNameSpaceURI) throw CNMRException(NMR_ERROR_COULDNOTGETNAMESPACE); if (nCount > 0) { if (wcscmp(pwszNameSpaceURI, OPCPACKAGE_SCHEMA_RELATIONSHIPS) == 0) { if (wcscmp(pwszLocalName, OPC_RELS_RELATIONSHIP_NODE) == 0) { parseChildNode(pXMLReader); } } } break; case XMLREADERNODETYPE_ENDELEMENT: pXMLReader->GetLocalName(&pwszLocalName, &nCount); if (!pwszLocalName) throw CNMRException(NMR_ERROR_COULDNOTGETLOCALXMLNAME); if (wcscmp(pwszLocalName, OPC_RELS_RELATIONSHIP_CONTAINER) == 0) { return; } pXMLReader->CloseElement(); break; case XMLREADERNODETYPE_UNKNOWN: break; case XMLREADERNODETYPE_TEXT: break; } } }
void CModelReaderNode100_Vertex::parseXML(_In_ CXmlReader * pXMLReader) { // Parse name parseName(pXMLReader); // Parse attribute parseAttributes(pXMLReader); // Parse Content parseContent(pXMLReader); }
void CModelReaderNode_BeamLattice1702_BeamLattice::parseXML(_In_ CXmlReader * pXMLReader) { // Parse name parseName(pXMLReader); // Parse attribute parseAttributes(pXMLReader); // Parse Content parseContent(pXMLReader); }
void CModelReaderNode_Slices1507_Vertex::parseXML(_In_ CXmlReader * pXMLReader) { // Parse name parseName(pXMLReader); // Parse attribute parseAttributes(pXMLReader); // Parse Content parseContent(pXMLReader); m_pSlice->addVertex(m_x, m_y); }
Lexer::Token Xmp::parse( Lexer* lexer ) { Lexer::Token tok( parseAttributes( lexer ) ); while( tok != Lexer::END && !( tok == Lexer::TAG && lexer->tagId() == Lexer::EUSERDOC)) { if( parseInline( lexer, tok ) ) { if( lexer->tagId() == Lexer::EXMP ) break; else parseCleanup( lexer, tok ); } } return tok; }
// ------------------------------------------------------------------------------- void XMLPersister::parseNode( QDomNode& node, CTreeInformationElement& informationElement ) // ------------------------------------------------------------------------------- { if ( node.isElement() ) { QDomElement elem = node.toElement(); //cout<<"element; tagname= "<<elem.tagName()<<endl; if ( elem.tagName() == "Description" ) { informationElement.setDescription( elem.text() ); parseDescriptionAttributes( elem, informationElement ); } else if ( elem.tagName() == "Information" ) { // QDomText textNode=node.toText(); //std::cout<<"==="<<elem.text()<<std::endl; // determine whether current elemenet contains encrypted data if ( false != bCurrentElementIsBase64Encrypted ) { // do base64 decodeing //std::cout<<"decoding64"<<std::endl; CBase64Coder b64Coder = CBase64Coder::getInstance(); QByteArray encryptedData; b64Coder.decode( encryptedData, elem.text() ); informationElement.setEncryptedData( encryptedData ); } else { informationElement.setInformation( elem.text() ); } } else if ( elem.tagName() == "InformationElement" ) { CTreeInformationElement* e = new CTreeInformationElement( &informationElement ); parseAttributes( elem, *e ); informationElement.addChild( e ); parseChildrenOf( node, *e ); } // cout<<"!!! still guessing for richtext"<<endl; // if ( QStyleSheet::mightBeRichText(informationElement->getInformation()) ) // informationElement->setInformationFormat(&InformationFormat::RTF); // else // informationElement->setInformationFormat(&InformationFormat::ASCII); } }
FastXmlLine(string str) { this->str = str; bool hasSlashAtBeginning = false; bool hasSlashAtEnd = false; bool hasOpen = false; bool hasClosed = false; for(int i = 0; i < str.size(); i++) { if(str[i]=='<') hasOpen = true; else if(str[i]=='>') hasClosed = true; else if(str[i]=='/') { if(i>0 && str[i-1]=='<') hasSlashAtBeginning = true; else hasSlashAtEnd = true; } } if(hasOpen && hasClosed) { if(hasSlashAtBeginning) { type = closeTag; } else if(hasSlashAtEnd) { type = emptyTag; } else { type = openTag; } } else { type = dataTag; } // find tag name if(type==openTag || type==emptyTag) { int start = str.find('<')+1; int spacePos = str.find(' '); int brackPos = str.find('>'); int length = 0; if(spacePos!=-1) length = spacePos - start; else length = brackPos - start; name = str.substr(start, length); } else if(type==closeTag) { int start = str.find('/')+1; int brackPos = str.find('>'); int length = brackPos - start; name = str.substr(start, length); } // find attributes if(type==openTag || type==emptyTag) { parseAttributes(); } }
SketchElement *PathParser::parse(SketchElement *parent, TiXmlElement *element) { Path *path = new Path(parent); parseAttributes(path, element); string data = element->Attribute("d") ? element->Attribute("d") : ""; PathDataParser *pathDataParser = new PathDataParser(path, data); pathDataParser->parse(); delete pathDataParser; return path; }
inline bool AsciiXmlParser::readNextElement() /* this reads in the entire next XML element. false is returned if the end * of the text was reached before a new XML element could be found (or if * no end for the next element could be found). */ { return ( discardToNextTag() && parseTagName( elementName ) && parseAttributes() && recordToEndOfElement() ); }
Lexer::Token Figcap::parse( Lexer* lexer ) { Lexer::Token tok( parseAttributes( lexer) ); while( tok != Lexer::END ) { //may contain inline, not block if( tok == Lexer::WORD ) { Word* word( new Word( document, this, document->dataName(), document->dataLine(), document->dataCol() ) ); appendChild( word ); tok = word->parse( lexer ); } else if( tok == Lexer::ENTITY ) { Entity* entity( new Entity( document, this, document->dataName(), document->dataLine(), document->dataCol() ) ); appendChild( entity ); tok = entity->parse( lexer ); } else if( tok == Lexer::PUNCTUATION ) { Punctuation* punct( new Punctuation( document, this, document->dataName(), document->dataLine(), document->dataCol() ) ); appendChild( punct ); tok = punct->parse( lexer ); } else if( tok == Lexer::WHITESPACE ) { WhiteSpace* ws( new WhiteSpace( document, this, document->dataName(), document->dataLine(), document->dataCol(), Tag::LITERAL ) ); appendChild( ws ); tok = ws->parse( lexer ); } else if( tok == Lexer::COMMAND ) tok = document->processCommand( lexer, this ); else if( tok == Lexer::TAG ) { if( lexer->tagId() == Lexer::EUSERDOC || lexer->tagId() == Lexer::EFIG ) break; else parseCleanup( lexer, tok ); } else if( tok == Lexer::ERROR_TAG ) { document->printError( ERR1_TAGNOTDEF ); tok = document->getNextToken(); } else if( tok == Lexer::ERROR_ENTITY ) { document->printError( ERR1_TAGNOTDEF ); tok = document->getNextToken(); } } return tok; }
void CModelReaderNode100_Colors::parseXML(_In_ CXmlReader * pXMLReader) { // Parse name parseName(pXMLReader); // Parse attribute parseAttributes(pXMLReader); // Use parameter and assign to model Object if (m_nID == 0) throw CNMRException(NMR_ERROR_MISSINGMODELRESOURCEID); // Parse Content parseContent(pXMLReader); }
Element *ContentHandler::parse(QXmlStreamReader &reader) const { Q_ASSERT(reader.isStartElement()); QString value; ContentElement *content = new ContentElement; parseAttributes(content, reader.attributes()); QXmlStreamReader::TokenType currentToken = reader.readNext(); while( !isEndElement(reader,QString("content")) && !reader.hasError() ) { if( currentToken == QXmlStreamReader::Characters ) { value+=reader.text(); } currentToken = reader.readNext(); } content->setValue(value); return content; }
void THtmlParser::parseTag() { // Close-tag if (txt.at(pos) == QLatin1Char('/')) { parseCloseTag(); return; } // p : parent index int p = lastIndex(); while (p > 0) { if (!at(p).tag.isEmpty() && !isElementClosed(p)) { break; } p = at(p).parent; } THtmlElement &he = appendNewElement(p); he.tag = parseWord(); // Parses the attributes he.attributes.clear(); if (pos < txt.length()) { he.attributes = parseAttributes(); } // Tag closed? if (txt.at(pos) == QLatin1Char('/')) { const QRegExp rx("(\\s*/[^>]*)>"); // "/>" or "//-->" int idx = rx.indexIn(txt, pos - 1); if (idx == pos || idx == pos - 1) { he.selfCloseMark = rx.cap(1); pos = idx + rx.cap(1).length(); } } if (txt.at(pos) == QLatin1Char('>')) { ++pos; } else { // coding error Q_ASSERT(0); } if (isElementClosed(lastIndex())) { appendNewElement(he.parent); } }
Lexer::Token Fn::parse( Lexer* lexer ) { Lexer::Token tok( parseAttributes( lexer ) ); // bool done( false ); while( tok != Lexer::END && !( tok == Lexer::TAG && lexer->tagId() == Lexer::EUSERDOC)) { if( lexer->tagId() == Lexer::EFN ) { tok = Tag::parseAttributes( lexer ); break; } else if( parseInline( lexer, tok ) ) { if( parseBlock( lexer, tok ) ) { if( parseListBlock( lexer, tok ) ) parseCleanup( lexer, tok ); } } } return tok; }
void CModelReaderNode_Slices1507_Polygon::parseXML(_In_ CXmlReader * pXMLReader) { m_PolygonIndex = m_pSlice->beginPolygon(); // Parse name parseName(pXMLReader); // Parse attribute parseAttributes(pXMLReader); m_pSlice->addPolygonIndex(m_PolygonIndex, m_StartV); // Parse Content parseContent(pXMLReader); if (!m_pSlice->isPolygonValid(m_PolygonIndex)) { throw CNMRException(NMR_ERROR_CLOSED_SLICE_POLYGON_IS_LINE); } }
Lexer::Token SlLi::parse( Lexer* lexer ) { Lexer::Token tok( parseAttributes( lexer ) ); while( tok != Lexer::END && !( tok == Lexer::TAG && lexer->tagId() == Lexer::EUSERDOC ) ) { if( parseInline( lexer, tok ) ) { if( lexer->tagId() == Lexer::LI ) break; else if( lexer->tagId() == Lexer::LP ) { Element* elt( new P( document, this, document->dataName(), document->dataLine(), document->dataCol() ) ); appendChild( elt ); tok = elt->parse( lexer ); } else if( parseBlock( lexer, tok ) ) break; } } return tok; }
bool ShaderD3D::compile(gl::Compiler *compiler, const std::string &source) { uncompile(); CompilerD3D *compilerD3D = GetImplAs<CompilerD3D>(compiler); ShHandle compilerHandle = compilerD3D->getCompilerHandle(mShaderType); mCompilerOutputType = ShGetShaderOutputType(compilerHandle); compileToHLSL(compilerHandle, source); if (mShaderType == GL_VERTEX_SHADER) { parseAttributes(compilerHandle); } parseVaryings(compilerHandle); if (mShaderType == GL_FRAGMENT_SHADER) { std::sort(mVaryings.begin(), mVaryings.end(), CompareVarying); const std::string &hlsl = getTranslatedSource(); if (!hlsl.empty()) { mActiveOutputVariables = *GetShaderVariables(ShGetOutputVariables(compilerHandle)); FilterInactiveVariables(&mActiveOutputVariables); } } #if ANGLE_SHADER_DEBUG_INFO == ANGLE_ENABLED mDebugInfo += std::string("// ") + GetShaderTypeString(mShaderType) + " SHADER BEGIN\n"; mDebugInfo += "\n// GLSL BEGIN\n\n" + source + "\n\n// GLSL END\n\n\n"; mDebugInfo += "// INITIAL HLSL BEGIN\n\n" + getTranslatedSource() + "\n// INITIAL HLSL END\n\n\n"; // Successive steps will append more info #else mDebugInfo += getTranslatedSource(); #endif return !getTranslatedSource().empty(); }
Lexer::Token I1::parse( Lexer* lexer ) { Lexer::Token tok( parseAttributes( lexer ) ); std::wstring txt; while( tok != Lexer::END && !( tok == Lexer::TAG && lexer->tagId() == Lexer::EUSERDOC)) { if( tok == Lexer::WORD ) txt += lexer->text(); else if( tok == Lexer::ENTITY ) { const std::wstring* exp( document->nameit( lexer->text() ) ); if( exp ) txt += *exp; else { try { wchar_t ch( document->entity( lexer->text() ) ); txt += ch; } catch( Class2Error& e ) { document->printError( e.code ); } } } else if( tok == Lexer::PUNCTUATION ) txt += lexer->text(); else if( tok == Lexer::WHITESPACE ) { if( lexer->text()[0] == L'\n' ) { tok = document->getNextToken(); break; } txt+= lexer->text(); } else break; tok = document->getNextToken(); } if( txt.empty() ) document->printError( ERR2_INOTEXT ); else if( txt.size() > 255 ) document->printError( ERR2_TEXTTOOLONG ); primary->setText( txt ); return tok; }