bool PMXMLParser::initDocument( ) { if( !m_pDoc ) { m_pDoc = new QDomDocument( "KPOVMODELER" ); if( m_pDoc->setContent( m_pDevice ) ) return true; else { printError( i18n( "Could not load the documents data!" ) ); setFatalError( ); return false; } } return true; }
void PMXMLParser::topParse( ) { if( initDocument( ) ) { QDomElement e = m_pDoc->documentElement( ); // read the format number // assume 1.0 on error QString fstring = e.attribute( "majorFormat", "1" ); bool ok = true; int format = fstring.toInt( &ok ); if( !ok || ( format < 1 ) ) format = 1; m_majorDocumentFormat = format; fstring = e.attribute( "minorFormat", "0" ); ok = true; format = fstring.toInt( &ok ); if( !ok || ( format < 0 ) ) format = 0; m_minorDocumentFormat = format; if( ( m_majorDocumentFormat > c_majorDocumentFormat ) || ( m_majorDocumentFormat == c_majorDocumentFormat ) && ( m_minorDocumentFormat > c_minorDocumentFormat ) ) printWarning( i18n( "This document was created with a newer version of KPovModeler. " "The whole document may not be loaded correctly." ) ); if( e.tagName( ) == "objects" ) { parseChildObjects( e, 0 ); } else if( e.tagName( ) == "scene" ) { PMScene* scene = new PMScene( m_pPart ); insertChild( scene, 0 ); PMXMLHelper hlp( e, m_pPart, this, m_majorDocumentFormat, m_minorDocumentFormat ); scene->readAttributes( hlp ); parseChildObjects( e, scene ); } else { printError( i18n( "Wrong top level tag" ) ); setFatalError( ); } } }
Socket* SSLTCPSocket::accept() { if (endPoint != LISTENER) return NULL; SOCKET client; client = AcceptConnection(sock); if (client == -1 && !wouldBlock()) { setFatalError(); return NULL; } else if (client == -1 && wouldBlock()) { return NULL; } SSLTCPSocket* sslClient = new SSLTCPSocket(SERVER); if (!sslClient->setFD(client)) { delete sslClient; return NULL; } return sslClient; }