コード例 #1
0
ファイル: fontlock.cpp プロジェクト: sigma/qnet
bool Pattern::match(const QString & text) {
    m_colors.clear();
    bool match = false;
    int offset = 0;

    while( (offset = m_reg.search(text,offset) + 1) ) {
        match = true;
        for(QValueList<MatchPair>::const_iterator it = m_matches.begin(); it != m_matches.end(); ++it) {
            int num = (*it).first;
            int pos = m_reg.pos(num);
            if(pos != -1)
                m_colors << Colorizer(pos, m_reg.cap(num).length(), (*it).second);
        }
    }
    return match;
}
コード例 #2
0
ファイル: Terminal.cpp プロジェクト: MrZoraman/Humbug
Terminal::Terminal() : output_scroll(0), outputLog(OUTPUT_LOG_ROWS, OUTPUT_BUFFER_LENGTH), blocking(false)
{
	initscr();
	noecho();

	//max rows: 25
	//max cols: 80

	getmaxyx(stdscr, max_rows, max_cols);

	input_buffer = new char[INPUT_BUFFER_LENGTH + 1];
	input_buffer[0] = '\0';
	input_window = newwin(1, max_cols, max_rows - 1, 0);
	scrollok(input_window, TRUE);
	keypad(input_window, TRUE);
	input_done.store(false);

	wtimeout(input_window, GETCH_TIMEOUT);

	output_window = newwin(max_rows - 1, max_cols, 0, 0);

	colorizer = Colorizer(output_window);
}