Ejemplo n.º 1
0
// Load the DB from a DomElement
bool MemDbLoader::load(const QDomElement & elemSource)
{
    _lastError = "";
    
    // Login to the SQLITE memory DB

    if(!QSqlDatabase::isDriverAvailable("QSQLITE")) {
        _lastError = "SQLITE plugin not available - data can't be loaded";
        return false;
    }
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName(":memory:");

    if(!db.open()) {
        _lastError = "Error opening QSQLITE memory database";
        return false;
    }    

    QDomNodeList nlist = elemSource.childNodes();
    for(int i = 0; i < nlist.count(); i++ ) {
        QDomElement it = nlist.item(i).toElement();
        if(it.tagName()=="table") {
            parseTable(it.toElement());
        }
    }
    return _lastError.isEmpty();
}
Ejemplo n.º 2
0
// Load the DB from a DomElement
bool MemDbLoader::load(const QDomElement & elemSource, QSqlDatabase db)
{
    _lastError = "";
    
    // Login to the SQLITE memory DB

	if(db.isOpen()) {
		db.close();
		db.open();
	}

	if(db.databaseName() != memDbName) {
		_lastError = createMemoryDB();
		if(!_lastError.isEmpty()) {
			return false;
		}
		db = QSqlDatabase::database();
		if(!db.open()) {
			_lastError = "Error opening QSQLITE memory database";
			return false;
		}  
	}
	_db = db;

    QDomNodeList nlist = elemSource.childNodes();
    for(int i = 0; i < nlist.count(); i++ ) {
        QDomElement it = nlist.item(i).toElement();
        if(it.tagName()=="table") {
            parseTable(it.toElement());
        }
    }
    return _lastError.isEmpty();
}
Ejemplo n.º 3
0
 BmlDecoder (FILE * fp) {
     m_fp = fp;
     //m_table = new Table ();
     m_nbTags = 0;
     m_root = NULL;
     parseTable ();
     m_root = parseNode ();
 }
Ejemplo n.º 4
0
void OOoReportBuilder::parseDocument()
{
    if (m_doc.isNull())
        return;

    QDomNodeList tables = m_doc.documentElement()
            .elementsByTagName("table:table");

    for (int i = 0; i < tables.count(); i++) {
        parseTable(tables.item(i));
    }
}
Ejemplo n.º 5
0
bool MorkParser::parse()
{
	bool Result = true;
	char cur = 0;

	// Run over mork chars and parse each term
	cur = nextChar();

	int i = 0;

	while ( Result && cur )
	{
		if ( !isWhiteSpace( cur ) )
		{
			i++;
			// Figure out what a term
			switch ( cur )
			{
			case '<':
				// Dict
				Result = parseDict();
				break;
			case '/':
				// Comment
				Result = parseComment();
				break;
			case '{':
				Result = parseTable();
				// Table
				break;
			case '[':
				Result = parseRow( 0, 0 );
				// Row
				break;
			case '@':
				Result = parseGroup();
				// Group
				break;
			default:
				error_ = DefectedFormat;
				Result = false;
				break;
			}
		}

		// Get next char
		cur = nextChar();
	}

	return Result;
}
Ejemplo n.º 6
0
int WikiParser::renderInternal(const String &Source, String &Html)
{
	String Tmp;
	String Text=Source;
	Text.replace("\r\n","\n");

	extractNoWiki(Text);
	extractSourcecode(Text);
	extractDiagrams(Text);

	String Line;

	Array Rows;
	Rows.explode(Text,"\n");
	Array Match;

	for (size_t j=0;j<Rows.size();j++) {
		Line=Rows[j];
		nobr=false;
		parseHeadlines(Line);
		parseLinks(Line);
		parseDoxygen(Line);

		if (parseOL(Line)) continue;
		if (parseUL(Line)) continue;
		if (parseIndent(Line)) continue;


		parseTable(Line);
		parseAutoPRE(Line);		// Zeilen mit Space am Anfang?

		// An bestimmten Stellen wollen wir am Ende kein <br>

		if (Line.pregMatch("/^.*<\\/li>$/i")) nobr=true;
		if (Line.pregMatch("/^.*<nobr>$/i")) {
			Line.pregReplace("/<nobr>$/i","");
			nobr=true;
		}

		Line.trim();
		ret+=Line;
		if (!nobr) ret+="<br>";
		ret+="\n";
	}
	finalize();

	if (indexenabled) buildIndex(Html);	// Index hinzufügen
	Html+=ret;
	return 1;

}
Ejemplo n.º 7
0
static void parseSqlFile (tokenInfo *const token)
{
    do
    {
	readToken (token);
	switch (token->keyword)
	{
	    case KEYWORD_cursor:    parseSimple (token, SQLTAG_CURSOR); break;
	    case KEYWORD_declare:   parseBlock (token, FALSE); break;
	    case KEYWORD_function:  parseSubProgram (token); break;
	    case KEYWORD_package:   parsePackage (token); break;
	    case KEYWORD_procedure: parseSubProgram (token); break;
	    case KEYWORD_subtype:   parseSimple (token, SQLTAG_SUBTYPE); break;
	    case KEYWORD_table:     parseTable (token); break;
	    case KEYWORD_trigger:   parseSimple (token, SQLTAG_TRIGGER); break;
	    case KEYWORD_type:      parseType (token); break;
	    default:                break;
	}
    } while (! isKeyword (token, KEYWORD_end));
}