コード例 #1
0
// only tests single TCHAR characters (but of those, tests all of them)
bool cEncoder::OnlyOneCatagoryPerChar() const
{
    // TODO:BAM - man, is there a better way to do this?
    TCHAR ch = std::numeric_limits<TCHAR>::min();
    TSTRING ach(1,ch);

    if( ch != std::numeric_limits<TCHAR>::max() )
    {
        do
        {
            bool fFailedATest = false;

            ach[0] = ch;
            for( sack_type::const_iterator atE = m_encodings.begin(); atE != m_encodings.end(); atE++ )
            {
                if( (*atE)->NeedsEncoding( ach.begin(), ach.end() ) )
                {
                    if( fFailedATest )
                        return false; // each char can only fail one test
                    else
                        fFailedATest = true;
                }
            }
            ch++;
        }
        while( ch != std::numeric_limits<TCHAR>::max() );
    }
    return true;
}
コード例 #2
0
ファイル: editmode.cpp プロジェクト: jeromelebleu/qlcplus
void EditMode::slotAddChannelClicked()
{
    AddChannelsDialog ach(m_mode->fixtureDef()->channels(), m_mode->channels());
    if (ach.exec() != QDialog::Accepted)
        return;

    QList <QLCChannel *> newChannelList = ach.getModeChannelsList();

    // clear the previous list
    m_mode->removeAllChannels();

    // Append the channels
    foreach(QLCChannel *ch, newChannelList)
        m_mode->insertChannel(ch, m_mode->channels().size());

    // Easier to refresh the whole list
    refreshChannelList();
}