void MapHelperBase::onCreate(const MapHelper *source) { Inherited::onCreate(source); if(source != NULL) { MapHelper *pThis = static_cast<MapHelper *>(this); pThis->setContainer(source->getContainer()); } }
void EditSFieldHandle<SFChunkBlockPtrMap>::add( FieldContainer *rhs, const std::string &szBindings) { ChunkBlock *pVal = dynamic_cast<ChunkBlock *>(rhs); KeyType oKey = 0x0000; if(pVal == NULL) { MapHelper *pMHelper = dynamic_cast<MapHelper *>(rhs); if(pMHelper != NULL) { pVal = dynamic_cast<ChunkBlock *>(pMHelper->getContainer()); const MapHelper::MFKeysType *pKeys = pMHelper->getMFKeys(); if(pKeys->empty() == false) { KeyType tmpKey = KeyPool::the()->getDefault(); for(UInt32 i = 0; i < pKeys->size(); ++i) { const std::string &szKey = pMHelper->getKeys(i); tmpKey = KeyPool::the()->getAuto(szKey.c_str()); oKey |= tmpKey; } } } } else { if(szBindings.empty() == false) { oKey = KeyPool::the()->getAuto(szBindings.c_str()); } } if(rhs != NULL && pVal == NULL) return; // for whatever reason VS2003 does not like == NULL if(_fAddMethod) { _fAddMethod(pVal, oKey); } }
void MapHelperBase::execSyncV( FieldContainer &oFrom, ConstFieldMaskArg whichField, AspectOffsetStore &oOffsets, ConstFieldMaskArg syncMode, const UInt32 uiSyncInfo) { MapHelper *pThis = static_cast<MapHelper *>(this); pThis->execSync(static_cast<MapHelper *>(&oFrom), whichField, oOffsets, syncMode, uiSyncInfo); }
void EditSFieldHandle<SFAttachmentPtrMap>::add( FieldContainer *rhs, const std::string &szBindings) { Attachment *pVal = dynamic_cast<Attachment *>(rhs); UInt32 uiBindings = 0; if(pVal == NULL) { MapHelper *pMHelper = dynamic_cast<MapHelper *>(rhs); if(pMHelper != NULL) { pVal = dynamic_cast<Attachment *>(pMHelper->getContainer()); if(pMHelper->getMFKeys()->empty() == false) { const std::string &szKey = pMHelper->getKeys(0); uiBindings = TypeTraits<UInt32>::getFromCString(szKey.c_str()); } } } else { if(szBindings.empty() == false) { uiBindings = TypeTraits<UInt32>::getFromCString(szBindings.c_str()); } } if(rhs != NULL && pVal == NULL) return; // for whatever reason VS2003 does not like == NULL if(_fAddMethod) { _fAddMethod(pVal, uiBindings); } }
VError CopyHelper::DoCopy() { ResizeHelper dstRszHlp; VError verr=dstRszHlp.Resize(fDstFd, fSrcSize); if(verr!=VE_OK) return verr; MapHelper srcMapHlp; verr=srcMapHlp.Map(fSrcFd, fSrcSize); if(verr!=VE_OK) return verr; void* srcAddr=srcMapHlp.GetAddr(); MapHelper dstMapHlp; verr=dstMapHlp.SetProtection(MapHelper::WRITE).Map(fDstFd, fSrcSize); if(verr!=VE_OK) { srcMapHlp.UnMap(); return verr; } void* dstAddr=dstMapHlp.GetAddr(); memcpy(dstAddr, srcAddr, fSrcSize); srcMapHlp.UnMap(); dstMapHlp.UnMap(); return verr; }
bool MapUserInteraction::eventFilter(QObject *obj, QEvent *event) { Q_UNUSED(obj); Q_D(MapUserInteraction); Q_ASSERT(d->map); MapHelper *helper = d->map->helper(); // qDebug() << "Event" << event->type() << helper; if (!helper) return false; switch (event->type()) { case QEvent::MouseButtonPress: { QMouseEvent *e = static_cast<QMouseEvent*>(event); if (helper->mouseDown(e)) e->accept(); break; } case QEvent::MouseButtonRelease: { QMouseEvent *e = static_cast<QMouseEvent*>(event); if (helper->mouseUp(e)) e->accept(); break; } case QEvent::MouseMove: { QMouseEvent *e = static_cast<QMouseEvent*>(event); if (helper->mouseMove(e)) e->accept(); break; } case QEvent::Wheel: { QWheelEvent *e = static_cast<QWheelEvent*>(event); if (helper->wheelEvent(e)) e->accept(); break; } case QEvent::KeyPress: { QKeyEvent *e = static_cast<QKeyEvent*>(event); if (helper->keyPress(e)) e->accept(); break; } case QEvent::KeyRelease: { QKeyEvent *e = static_cast<QKeyEvent*>(event); if (helper->keyRelease(e)) e->accept(); break; } case QEvent::Gesture: { #if 0 static bool even = false; even = !even; // ХЗ почему, но ТАП-ХОЛД срабатывает дважды. Чётные срабатывание откидываем if (even) helper->gesture(static_cast<QGestureEvent *>(event)); #endif break; #if 0 if (QGesture *swipe = ge->gesture(Qt::SwipeGesture)) { LogD("GE") << "SwipeGesture"; static_cast<QSwipeGesture *>(swipe); } if (QGesture *pan = ge->gesture(Qt::PanGesture)) { static_cast<QPanGesture *>(pan); LogD("GE") << "PanGesture"; } #endif } case QEvent::TouchBegin: { QTouchEvent *e = static_cast<QTouchEvent *>(event); if (helper->touch(e)) e->accept(); QList<QTouchEvent::TouchPoint> pts = e->touchPoints(); if (pts.size() == 1) { QRectF r = pts.first().sceneRect(); r.moveCenter(r.center() - d->map->position()); } break; } case QEvent::TouchEnd: { QTouchEvent *e = static_cast<QTouchEvent *>(event); if (helper->touch(e)) e->accept(); QList<QTouchEvent::TouchPoint> pts = e->touchPoints(); if (pts.size() == 1) { QRectF r = pts.first().sceneRect(); r.moveCenter(r.center() - d->map->position()); } break; } case QEvent::TouchUpdate: { QTouchEvent *e = static_cast<QTouchEvent *>(event); if (helper->touch(e)) e->accept(); break; } default: return false; break; } // switch (event->type()) return true; }