本文整理汇总了C++中Groups类的典型用法代码示例。如果您正苦于以下问题:C++ Groups类的具体用法?C++ Groups怎么用?C++ Groups使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Groups类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createScore
Score* NoteGroups::createScore(int n, TDuration::DurationType t, std::vector<Chord*>* chords)
{
MCursor c;
c.setTimeSig(_sig);
c.createScore("score8");
c.addPart("voice");
c.move(0, 0);
c.addKeySig(0);
TimeSig* nts = c.addTimeSig(_sig);
GroupNode node {0, 0};
Groups ng;
ng.push_back(node);
nts->setGroups(ng);
for (int i = 0; i < n; ++i) {
Chord* chord = c.addChord(67, t);
int tick = chord->rtick();
chord->setBeamMode(_groups.beamMode(tick, t));
chords->push_back(chord);
}
c.score()->parts().front()->setLongName("");
c.score()->style()->set(ST_linearStretch, 1.1);
return c.score();
}
示例2: InsertGroups
void CVoxSQLite::InsertGroups( const char* username, Groups& rList )
{
for ( Groups::iterator iter = rList.begin(); iter != rList.end(); iter++ )
{
InsertGroup( username, (*iter) );
}
}
示例3: createScore
Score* NoteGroups::createScore(int n, TDuration::DurationType t, std::vector<Chord*>* chords)
{
MCursor c;
c.setTimeSig(_sig);
c.createScore("score8");
c.addPart("voice");
c.move(0, 0);
c.addKeySig(Key::C);
TimeSig* nts = c.addTimeSig(_sig);
GroupNode node {0, 0};
Groups ng;
ng.push_back(node);
nts->setGroups(ng);
for (int i = 0; i < n; ++i) {
Chord* chord = c.addChord(67, t);
int tick = chord->rtick();
chord->setBeamMode(_groups.beamMode(tick, t));
chords->push_back(chord);
}
c.score()->pageFormat()->setEvenLeftMargin(0.0);
c.score()->pageFormat()->setOddLeftMargin(0.0);
c.score()->parts().front()->setLongName("");
c.score()->style().set(StyleIdx::linearStretch, 1.3);
c.score()->style().set(StyleIdx::MusicalSymbolFont, QString("Bravura"));
c.score()->style().set(StyleIdx::MusicalTextFont, QString("Bravura Text"));
return c.score();
}
示例4: Listener
void gkGroupManager::attachGroupToScene(gkScene* scene, gkGameObjectGroup* group)
{
class Listener : public gkResourceManager::ResourceListener
{
public:
gkGroupManager* m_this;
public:
Listener(gkGroupManager* par) : m_this(par) {}
virtual ~Listener() {}
void notifyResourceDestroyed(gkResource* res)
{
if (gkGroupManager::getSingletonPtr())
m_this->m_attachements.erase((gkScene*)res);
}
};
if (!m_sceneListener)
{
m_sceneListener = new Listener(this);
gkSceneManager::getSingleton().addResourceListener(m_sceneListener);
}
UTsize pos;
if ((pos = m_attachements.find(scene)) != UT_NPOS)
m_attachements.at(pos).push_back(group);
else
{
Groups groups;
groups.push_back(group);
m_attachements.insert(scene, groups);
}
}
示例5: QDialog
TimeSigProperties::TimeSigProperties(TimeSig* t, QWidget* parent)
: QDialog(parent)
{
setupUi(this);
setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
timesig = t;
zText->setText(timesig->numeratorString());
nText->setText(timesig->denominatorString());
Fraction nominal = timesig->sig() * timesig->stretch();
nominal.reduce();
zNominal->setValue(nominal.numerator());
nNominal->setValue(nominal.denominator());
zActual->setValue(timesig->sig().numerator());
nActual->setValue(timesig->sig().denominator());
switch (timesig->timeSigType()) {
case TSIG_NORMAL:
textButton->setChecked(true);
break;
case TSIG_FOUR_FOUR:
fourfourButton->setChecked(true);
break;
case TSIG_ALLA_BREVE:
allaBreveButton->setChecked(true);
break;
}
Groups g = t->groups();
if (g.empty())
g = Groups::endings(timesig->sig()); // initialize with default
groups->setSig(timesig->sig(), g);
}
示例6: off
/** Finds inferior cells, builds vcs. Sets moves to consider to all
empty cells. If fillin causes terminal state, sets
m_fillinCausedWin to true and recomputes fillin/vcs with ice
temporarily turned off (so it can pass the players a non-empty
consider set).
*/
HexPoint BenzenePlayer::InitSearch(HexBoard& brd, HexColor color,
bitset_t& consider, double& score)
{
// Resign if the game is already over
Groups groups;
GroupBuilder::Build(brd.GetPosition(), groups);
if (groups.IsGameOver())
{
score = IMMEDIATE_LOSS;
return RESIGN;
}
StoneBoard original(brd.GetPosition());
brd.ComputeAll(color);
m_fillinCausedWin = false;
m_fillinWinner = EMPTY;
if (brd.GetGroups().IsGameOver())
{
// Fillin caused win, remove and re-compute without ice.
m_fillinCausedWin = true;
m_fillinWinner = brd.GetGroups().GetWinner();
LogInfo() << "Captured cells caused win! Removing...\n";
brd.GetPosition().SetPosition(original);
bool oldUseIce = brd.UseICE();
brd.SetUseICE(false);
brd.ComputeAll(color);
brd.SetUseICE(oldUseIce);
BenzeneAssert(!brd.GetGroups().IsGameOver());
}
consider = brd.GetPosition().GetEmpty();
score = 0;
return INVALID_POINT;
}
示例7: sig
void TimeDialog::paletteChanged(int idx)
{
TimeSig* e = static_cast<TimeSig*>(sp->element(idx));
if (!e || e->type() != Element::TIMESIG) {
zNominal->setEnabled(false);
nNominal->setEnabled(false);
zText->setEnabled(false);
nText->setEnabled(false);
groups->setEnabled(false);
addButton->setEnabled(false);
return;
}
zNominal->setEnabled(true);
nNominal->setEnabled(true);
zText->setEnabled(true);
nText->setEnabled(true);
groups->setEnabled(true);
addButton->setEnabled(true);
Fraction sig(e->sig());
Groups g = e->groups();
if (g.empty())
g = Groups::endings(sig);
groups->setSig(sig, g);
zNominal->setValue(sig.numerator());
nNominal->setCurrentIndex(denominator2Idx(sig.denominator()));
zText->setText(e->numeratorString());
nText->setText(e->denominatorString());
}
示例8: groups
Groups NoteGroups::groups()
{
Groups g;
for (Chord* chord : chords8)
g.addStop(chord->rtick(), chord->durationType().type(), chord->beamMode());
for (Chord* chord : chords16)
g.addStop(chord->rtick(), chord->durationType().type(), chord->beamMode());
for (Chord* chord : chords32)
g.addStop(chord->rtick(), chord->durationType().type(), chord->beamMode());
return g;
}
示例9: Build
void GroupBuilder::Build(const StoneBoard& brd, Groups& groups)
{
bitset_t visited;
groups.m_brd = const_cast<StoneBoard*>(&brd);
groups.m_groups.clear();
groups.m_group_index.resize(FIRST_INVALID);
for (BoardIterator p(brd.Const().EdgesAndInterior()); p; ++p)
{
if (visited.test(*p))
continue;
bitset_t nbs, members;
HexColor color = brd.GetColor(*p);
Flow(brd, *p, color, members, nbs);
HexAssert((visited & members).none());
visited |= members;
for (BitsetIterator m(members); m; ++m)
groups.m_group_index[*m] = groups.m_groups.size();
groups.m_groups.push_back(Group(&groups, color, *p, members, nbs));
}
for (std::size_t i = 0; i < groups.m_groups.size(); ++i)
{
Group& g = groups.m_groups[i];
g.m_nbs = groups.CaptainizeBitset(g.m_nbs);
for (BitsetIterator p(g.m_nbs); p; ++p)
g.m_nbs_index.push_back(groups.m_group_index[*p]);
}
}
示例10: GetGroups
void CVoxSQLite::GetGroups( const char* username, Groups& rList )
{
CppSQLite3Buffer buf;
buf.format( "SELECT * from [Group] WHERE [username] = %Q;", username );
try
{
CppSQLite3Statement stmt = m_db.compileStatement( (const char*)buf );
int nContactId = 0;
std::string type = "";
CppSQLite3Query q = stmt.execQuery();
Group grp;
//Process record set.
while (!q.eof())
{
grp.setUsername( q.getStringField( 0 ) );
grp.setName ( q.getStringField( 1 ) );
rList.Add( &grp );
q.nextRow();
}
stmt.reset();
}
catch (CppSQLite3Exception& e)
{
e.errorCode();
}
}
示例11: AddComponentAndGroupToXMLFile
int XMLManager::SaveXML(string fileName, Components components, Groups groups){
//創建檔案
xmlFile.open(fileName.c_str(),ios::out);
if(xmlFile.is_open()){
AddComponentAndGroupToXMLFile(components.GetAllComponent(),groups.GetAllGroups());
this->xmlFilePath = fileName; //把路徑記錄下來
xmlFile.close();
return XMLErrorCode::OK;
}
else{ //創建後如果無開啟 代表可能有錯誤
xmlFile.close();
return XMLErrorCode::Save_PathError;
}
}
示例12: getProperty
QVariant getProperty(P_ID id, XmlReader& e)
{
switch(propertyType(id)) {
case P_TYPE::BOOL:
return QVariant(bool(e.readInt()));
case P_TYPE::SUBTYPE:
case P_TYPE::INT:
return QVariant(e.readInt());
case P_TYPE::REAL:
case P_TYPE::SPATIUM:
case P_TYPE::SP_REAL:
case P_TYPE::TEMPO:
return QVariant(e.readDouble());
case P_TYPE::FRACTION:
return QVariant::fromValue(e.readFraction());
case P_TYPE::COLOR:
return QVariant(e.readColor());
case P_TYPE::POINT:
return QVariant(e.readPoint());
case P_TYPE::SCALE:
case P_TYPE::SIZE:
return QVariant(e.readSize());
case P_TYPE::STRING:
return QVariant(e.readElementText());
case P_TYPE::DIRECTION:
{
QString value(e.readElementText());
if (value == "up")
return QVariant(int(MScore::Direction::UP));
else if (value == "down")
return QVariant(int(MScore::Direction::DOWN));
else if (value == "auto")
return QVariant(int(MScore::Direction::AUTO));
}
break;
case P_TYPE::DIRECTION_H:
{
QString value(e.readElementText());
if (value == "left" || value == "1")
return QVariant(int(MScore::DirectionH::LEFT));
else if (value == "right" || value == "2")
return QVariant(int(MScore::DirectionH::RIGHT));
else if (value == "auto")
return QVariant(int(MScore::DirectionH::AUTO));
}
break;
case P_TYPE::LAYOUT_BREAK: {
QString value(e.readElementText());
if (value == "line")
return QVariant(int(LayoutBreak::Type::LINE));
if (value == "page")
return QVariant(int(LayoutBreak::Type::PAGE));
if (value == "section")
return QVariant(int(LayoutBreak::Type::SECTION));
qDebug("getProperty: invalid P_TYPE::LAYOUT_BREAK: <%s>", qPrintable(value));
}
break;
case P_TYPE::VALUE_TYPE: {
QString value(e.readElementText());
if (value == "offset")
return QVariant(int(Note::ValueType::OFFSET_VAL));
else if (value == "user")
return QVariant(int(Note::ValueType::USER_VAL));
}
break;
case P_TYPE::PLACEMENT: {
QString value(e.readElementText());
if (value == "above")
return QVariant(int(Element::Placement::ABOVE));
else if (value == "below")
return QVariant(int(Element::Placement::BELOW));
}
break;
case P_TYPE::BEAM_MODE: // TODO
return QVariant(int(0));
case P_TYPE::GROUPS:
{
Groups g;
g.read(e);
return QVariant::fromValue(g);
}
case P_TYPE::POINT_MM:
case P_TYPE::SIZE_MM:
case P_TYPE::SYMID:
case P_TYPE::TEXT_STYLE:
return QVariant();
}
return QVariant();
}
示例13: getProperty
//.........这里部分代码省略.........
case P_TYPE::COLOR:
return QVariant(e.readColor());
case P_TYPE::POINT:
return QVariant(e.readPoint());
case P_TYPE::SCALE:
case P_TYPE::SIZE:
return QVariant(e.readSize());
case P_TYPE::STRING:
return QVariant(e.readElementText());
case P_TYPE::GLISSANDO_STYLE: {
QString value(e.readElementText());
if ( value == "whitekeys")
return QVariant(int(MScore::GlissandoStyle::WHITE_KEYS));
else if ( value == "blackkeys")
return QVariant(int(MScore::GlissandoStyle::BLACK_KEYS));
else if ( value == "diatonic")
return QVariant(int(MScore::GlissandoStyle::DIATONIC));
else // e.g., normally "Chromatic"
return QVariant(int(MScore::GlissandoStyle::CHROMATIC));
}
break;
case P_TYPE::ORNAMENT_STYLE: {
QString value(e.readElementText());
if ( value == "baroque")
return QVariant(int(MScore::OrnamentStyle::BAROQUE));
return QVariant(int(MScore::OrnamentStyle::DEFAULT));
}
case P_TYPE::DIRECTION:
return QVariant::fromValue(Direction(e.readElementText()));
case P_TYPE::DIRECTION_H:
{
QString value(e.readElementText());
if (value == "left" || value == "1")
return QVariant(int(MScore::DirectionH::LEFT));
else if (value == "right" || value == "2")
return QVariant(int(MScore::DirectionH::RIGHT));
else if (value == "auto")
return QVariant(int(MScore::DirectionH::AUTO));
}
break;
case P_TYPE::LAYOUT_BREAK: {
QString value(e.readElementText());
if (value == "line")
return QVariant(int(LayoutBreak::Type::LINE));
if (value == "page")
return QVariant(int(LayoutBreak::Type::PAGE));
if (value == "section")
return QVariant(int(LayoutBreak::Type::SECTION));
qDebug("getProperty: invalid P_TYPE::LAYOUT_BREAK: <%s>", qPrintable(value));
}
break;
case P_TYPE::VALUE_TYPE: {
QString value(e.readElementText());
if (value == "offset")
return QVariant(int(Note::ValueType::OFFSET_VAL));
else if (value == "user")
return QVariant(int(Note::ValueType::USER_VAL));
}
break;
case P_TYPE::PLACEMENT: {
QString value(e.readElementText());
if (value == "above")
return QVariant(int(Element::Placement::ABOVE));
else if (value == "below")
return QVariant(int(Element::Placement::BELOW));
}
break;
case P_TYPE::BARLINE_TYPE: {
bool ok;
const QString& val(e.readElementText());
int ct = val.toInt(&ok);
if (ok)
return QVariant(ct);
else {
BarLineType t = BarLine::barLineType(val);
return QVariant::fromValue(t);
}
}
break;
case P_TYPE::BEAM_MODE: // TODO
return QVariant(int(0));
case P_TYPE::GROUPS:
{
Groups g;
g.read(e);
return QVariant::fromValue(g);
}
case P_TYPE::POINT_MM: // not supported
case P_TYPE::TDURATION:
case P_TYPE::SIZE_MM:
case P_TYPE::SYMID:
case P_TYPE::TEXT_STYLE:
case P_TYPE::INT_LIST:
return QVariant();
}
return QVariant();
}
示例14: IsGameOver
bool GameUtil::IsGameOver(const Game& game)
{
Groups groups;
GroupBuilder::Build(game.Board(), groups);
return groups.IsGameOver();
}
示例15: QDialog
TimeSigProperties::TimeSigProperties(TimeSig* t, QWidget* parent)
: QDialog(parent)
{
setupUi(this);
setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
timesig = t;
zText->setText(timesig->numeratorString());
nText->setText(timesig->denominatorString());
// set validators for numerator and denominator strings
// which only accept '+', '(', ')', digits and some time symb conventional representations
QRegExp rx("[0-9+CO()\\x00A2\\x00D8]*");
QValidator *validator = new QRegExpValidator(rx, this);
zText->setValidator(validator);
nText->setValidator(validator);
Fraction nominal = timesig->sig() / timesig->stretch();
nominal.reduce();
zNominal->setValue(nominal.numerator());
nNominal->setValue(nominal.denominator());
Fraction sig(timesig->sig());
zActual->setValue(sig.numerator());
nActual->setValue(sig.denominator());
zNominal->setEnabled(false);
nNominal->setEnabled(false);
// TODO: fix http://musescore.org/en/node/42341
// for now, editing of actual (local) time sig is disabled in dialog
// but more importantly, the dialog should make it clear that this is "local" change only
// and not normally the right way to add 7/4 to a score
zActual->setEnabled(false);
nActual->setEnabled(false);
switch (timesig->timeSigType()) {
case TimeSigType::NORMAL:
textButton->setChecked(true);
break;
case TimeSigType::FOUR_FOUR:
fourfourButton->setChecked(true);
break;
case TimeSigType::ALLA_BREVE:
allaBreveButton->setChecked(true);
break;
}
// set ID's of other symbols
static const SymId prolatioSymbols[] = {
SymId::mensuralProlation1, // tempus perfectum, prol. perfecta
SymId::mensuralProlation2, // tempus perfectum, prol. imperfecta
SymId::mensuralProlation3, // tempus perfectum, prol. imperfecta, dimin.
SymId::mensuralProlation4, // tempus perfectum, prol. perfecta, dimin.
SymId::mensuralProlation5, // tempus imperf. prol. perfecta
// SymId::mensuralProlation6, // same shape as common time
SymId::mensuralProlation7, // tempus imperf., prol. imperfecta, reversed
SymId::mensuralProlation8, // tempus imperf., prol. perfecta, dimin.
// SymId::mensuralProlation9, // same shape as alla breve
SymId::mensuralProlation10, // tempus imperf., prol imperfecta, dimin., reversed
SymId::mensuralProlation11, // tempus inperf., prol. perfecta, reversed
};
ScoreFont* scoreFont = t->score()->scoreFont();
int idx = 0;
for (SymId symId : prolatioSymbols) {
const QString& str = scoreFont->toString(symId);
if (str.size() > 0) {
otherCombo->setItemData(idx, (int)symId);
// if time sig matches this symbol string, set as selected
if (timesig->timeSigType() == TimeSigType::NORMAL && timesig->denominatorString().isEmpty()
&& timesig->numeratorString() == str) {
textButton->setChecked(false);
otherButton->setChecked(true);
otherCombo->setCurrentIndex(idx);
}
}
idx++;
}
Groups g = t->groups();
if (g.empty())
g = Groups::endings(timesig->sig()); // initialize with default
groups->setSig(timesig->sig(), g);
}