当前位置: 首页>>代码示例>>C++>>正文


C++ Change类代码示例

本文整理汇总了C++中Change的典型用法代码示例。如果您正苦于以下问题:C++ Change类的具体用法?C++ Change怎么用?C++ Change使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Change类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

/// Performs an document-change undo.
void TextUndoStack::undoDocumentChange()
{
    // first make sure ALL controller-changes are back to the document change-level
    QMap<TextEditorController*, int>::iterator itr;
    for( itr = controllerIndexMap_.begin(); itr != controllerIndexMap_.end(); ++itr) {
        TextEditorController* controller = itr.key();
        while( undoControllerChange(controller) ) {};  // undo all controller operations
    }

    // next perform an undo of the document operations
    Change* change = findUndoChange();
    if( change ) {
        Q_ASSERT( change->controllerContext() == 0 );
        change->revert( documentRef_ );

        // next move the pointers to first 'related' change
        for( itr = controllerIndexMap_.begin(); itr != controllerIndexMap_.end(); ++itr) {
            TextEditorController* controller = itr.key();
            controllerIndexMap_[controller] = findUndoIndex( changeIndex_-1, controller ) + 1; // +1 because the pointer points AFTER the found index
        }

        // and finally move the document pointer
        setChangeIndex( findUndoIndex( changeIndex_-1 ) + 1 );  // +1 because the pointer points AFTER the found index
        emit undoExecuted( change);
    }

}
开发者ID:letmefly,项目名称:edbee-lib,代码行数:28,代码来源:textundostack.cpp

示例2: main

int main()
{
    cout << "\n";
    
    Create create;
    Change change;
    
    create.fillPointerBuffer();

    cout << "main()---------------------------------" << endl;
    //cout << "create.num:     " << create.num << endl;
    cout << "create.bufferPtr:  " << create.bufferPtr << endl;
    cout << "change.process(create.bufferPtr, create.size)" << endl;
    cout << "---------------------------------------" << endl;
    cout << "\n";
    
    change.process(create.bufferPtr, create.size);
    
    cout << "\n";
    cout << "main()---------------------------------" << endl;
    cout << "create.bufferPtr:  " << create.bufferPtr << endl;
    cout << "create.size: " << create.size << endl;
    cout << "---------------------------------------" << endl;
    cout << "\n";
    cout << "----------SUMMARY-------------" << endl;
    cout << "create.bufferPtr: " << create.bufferPtr << endl;
    cout << "create.size: " << create.size << endl;
    for (int i=0; i<create.size; i++) {
        cout << "create.bufferPtr[" << i << "]: " << create.bufferPtr[i] << endl;
    }
    cout << "------------------------------" << endl;
    cout << "\n";
    
    return 0;
}
开发者ID:MeOwen,项目名称:sogm_opdrachten,代码行数:35,代码来源:main.cpp

示例3: _txnClose

void WiredTigerRecoveryUnit::_abort() {
    try {
        bool notifyDone = !_prepareTimestamp.isNull();
        if (_session && _isActive()) {
            _txnClose(false);
        }
        _setState(State::kAborting);

        if (MONGO_FAIL_POINT(WTAlwaysNotifyPrepareConflictWaiters)) {
            notifyDone = true;
        }

        if (notifyDone) {
            _sessionCache->notifyPreparedUnitOfWorkHasCommittedOrAborted();
        }

        for (Changes::const_reverse_iterator it = _changes.rbegin(), end = _changes.rend();
             it != end;
             ++it) {
            Change* change = it->get();
            LOG(2) << "CUSTOM ROLLBACK " << redact(demangleName(typeid(*change)));
            change->rollback();
        }
        _changes.clear();
    } catch (...) {
        std::terminate();
    }

    _setState(State::kInactive);
}
开发者ID:ajdavis,项目名称:mongo,代码行数:30,代码来源:wiredtiger_recovery_unit.cpp

示例4: Change

void Reduce::on_pushButton_clicked()
{
    Change *win = new Change() ;
    win->show();
    win->setWindowTitle("bazgasht");
    win->resize(700,600);
    close();
}
开发者ID:z-momeni,项目名称:Accounting,代码行数:8,代码来源:reduce.cpp

示例5: pass_mock_by_ref

 void pass_mock_by_ref()
 {
     Mock<Change> mock;
     Change* change = &mock.get();
     When(Method(mock, change)).AlwaysReturn();
     change->change(1, 2, 3);
     assertChanged(mock, 1, 2, 3);
 }
开发者ID:hartness,项目名称:FakeIt,代码行数:8,代码来源:miscellaneous_tests.cpp

示例6: updateChanges

void KConfigPropagator::commit()
{
  updateChanges();

  Change *c;
  for( c = mChanges.first(); c; c = mChanges.next() ) {
    c->apply();
  }
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例7: move

 void Movebase::move(Change &change) {
     timer.start();
     timer_move.start();
     cnt++;
     change.clear();
     _move(change);
     if (change.empty())
         timer.stop();
     timer_move.stop();
 }
开发者ID:gitesei,项目名称:faunus,代码行数:10,代码来源:move.cpp

示例8: at

/// This method finds the index of the given stackitem from the given index
/// @param  index the previous index
/// @param controller the controller context
/// @return the previous index -1, if there's no previous index
int TextUndoStack::findUndoIndex( int index, TextEditorController* controller)
{
    if( index > 0 ) {
        for( --index; index >= 0; --index ) {
            Change* change = at(index);
            TextEditorController* context = change->controllerContext();
            if( context == 0 || context == controller ) { return index; }
        }
    }
    return -1;
}
开发者ID:letmefly,项目名称:edbee-lib,代码行数:15,代码来源:textundostack.cpp

示例9: Q_ASSERT

/// This method undos the given controller change. This method does NOT undo document changes
/// @param controller the controller to undo the change form
/// @return true if a change has been undone.
bool TextUndoStack::undoControllerChange(TextEditorController* controller)
{
    Q_ASSERT(controller);
    int changeIdx = controllerIndexMap_.value(controller)-1;    // -1, because the index is directly AFTER the item
    Change* changeToUndo = findUndoChange( controller );

    if( changeToUndo && changeToUndo->controllerContext() ) {
        Q_ASSERT( changeToUndo->controllerContext() == controller );
        changeToUndo->revert( documentRef_ );
        controllerIndexMap_[controller] = findUndoIndex( changeIdx, controller )+1;
        emit undoExecuted( changeToUndo );
        return true;
    }
    return false;
}
开发者ID:letmefly,项目名称:edbee-lib,代码行数:18,代码来源:textundostack.cpp

示例10: ChangeHeuristic

		//calculate the heuristic value of a pile of change
		inline int ChangeHeuristic( const Change& change, const int* heuristic ) const 
		{
			int score = 0;
			for (const Coin *c=&COINLIST[0];c!=&COINLIST[COIN_COUNT];++c){
				score += *heuristic++ * change.GetCount(*c);
			}
			return score;
		}
开发者ID:NextGenIntelligence,项目名称:coinfight-framework,代码行数:9,代码来源:thad.cpp

示例11:

  bool
  operator== (const Change& x, const Change& y)
  {
    if (!(x.effects () == y.effects ()))
      return false;

    if (!(x.script () == y.script ()))
      return false;

    if (!(x.extension () == y.extension ()))
      return false;

    if (!(x.type () == y.type ()))
      return false;

    if (!(x.object () == y.object ()))
      return false;

    return true;
  }
开发者ID:invy,项目名称:mjklaim-freewindows,代码行数:20,代码来源:change.cpp

示例12: _txnClose

void TerarkDbRecoveryUnit::_abort() {
    try {
        if (_active) {
            _txnClose(false);
        }

        for (Changes::const_reverse_iterator it = _changes.rbegin(), end = _changes.rend();
             it != end;
             ++it) {
            Change* change = *it;
            LOG(2) << "CUSTOM ROLLBACK " << demangleName(typeid(*change));
            change->rollback();
        }
        _changes.clear();

        invariant(!_active);
    } catch (...) {
        std::terminate();
    }
}
开发者ID:CovariantStudio,项目名称:terark-db,代码行数:20,代码来源:terarkdb_recovery_unit.cpp

示例13: AFX_MANAGE_STATE

IChange* Changes::Item(LONG Index)
{
	AFX_MANAGE_STATE(AfxGetAppModuleState());

	if (m_pDocument == NULL)
	{
		AfxThrowOleDispatchException(1100, L"The object has been deleted.");
	}

	if (Index <= 0 || Index > GetCount())
		AfxThrowOleDispatchException(1103, L"Index out of range.");

	if (m_vChanges[Index-1] == NULL)
	{
		Change* pChange = new Change(m_pDocument, Index-1);
		pChange->InternalAddRef();
		m_vChanges[Index - 1] = pChange;
	}

	return m_vChanges[Index-1]->GetComObject();
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:21,代码来源:Changes.cpp

示例14: currentIndex

/// returns true if the undo-stack is on a persisted index
bool TextUndoStack::isPersisted()
{
    int curIdx = currentIndex();
    if( persistedIndex_ == curIdx ) { return true; }
    if( persistedIndex_ < 0 ) { return false;}

    // check if all changes are non-persistable
    int startIdx = qMax( 0, qMin( curIdx, persistedIndex_ ));
    int endIdx   = qMin( qMax( curIdx, persistedIndex_ ), changeList_.size());

    for( int idx=startIdx; idx<endIdx; ++idx ) {
        Change* change = changeList_.at(idx);

        // only check document changes
        if( change->isDocumentChange() ) {
            if( change->isPersistenceRequired() ) {
                return false;
            }
        }
    }
    return true;
}
开发者ID:letmefly,项目名称:edbee-lib,代码行数:23,代码来源:textundostack.cpp

示例15: findRedoIndex

/// redo a document change
void TextUndoStack::redoDocumentChange()
{
    // first find the redo operation
    int redoIndex = findRedoIndex( currentIndex(0), 0 );
    Change* redo = findRedoChange(0);
    if( redo ) { ++redoIndex; }

    // first move all controller redo-operation to the given redo found redo location
    QMap<TextEditorController*, int>::iterator itr;
    for( itr = controllerIndexMap_.begin(); itr != controllerIndexMap_.end(); ++itr) {
        TextEditorController* controller = itr.key();
        while( redoControllerChange(controller) ) {};  // undo all controller operations
        itr.value() = redoIndex;    // move the position after the DOC operation
    }

    // is there a document redo? execute it
    if( redo ) {
        redo->execute(documentRef_);
        setChangeIndex(redoIndex);
        emit redoExecuted( redo );
    }
}
开发者ID:letmefly,项目名称:edbee-lib,代码行数:23,代码来源:textundostack.cpp


注:本文中的Change类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。