这篇教程C++ zone函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中zone函数的典型用法代码示例。如果您正苦于以下问题:C++ zone函数的具体用法?C++ zone怎么用?C++ zone使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了zone函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: tybuilder/// <summary>/// <list type="number">/// <item>Set output type of PrologueI.</item>/// <item>Load parameters</item>/// </list>/// </summary>void Builder::SetUpMethodBody(Function& fun, MethodDef& method_def) { auto const pPrologueI = fun.GetStartBB()->GetFirstI(); auto const pRefI = pPrologueI->GetNext(); auto const pBB = pPrologueI->GetBBlock(); auto& v1 = *pPrologueI->GetVd(); ValuesTypeBuilder tybuilder( method_def.IsStatic() ? method_def.CountParams() : method_def.CountParams() + 1); auto nth = 0; // "this" parameter. if (!method_def.IsStatic()) { tybuilder.Append(method_def.owner_class_def().GetClass()); nth++; } foreach (MethodDef::EnumParam, oEnum, method_def) { auto const pParamDef = oEnum.Get(); auto& var = pParamDef->GetVariable(); auto& varty = var.GetTy(); tybuilder.Append(varty); DEBUG_FORMAT("%s %s", varty, var); auto& cell_class = Ty_ClosedCell->Construct(varty); //auto& r2 = *NewOutput(varty).StaticCast<Register>(); auto& r2 = *NewOutput(varty).StaticCast<Register>(); r2.SetVariable(var); auto const pSelectI = new(zone()) SelectI(varty, r2, v1, nth); pSelectI->SetSourceInfo(pParamDef->GetSourceInfo()); pBB->InsertBeforeI(*pSelectI, pRefI); auto& r3 = NewRegister(); auto& vardef_inst = *new(zone()) VarDefI(cell_class, r3, var, r2); vardef_inst.set_source_info(pParamDef->source_info()); pBB->InsertBeforeI(vardef_inst, pRefI); ++nth; }
开发者ID:eval1749,项目名称:evm,代码行数:48,
示例2: zone//// createZone//void BSPScene::createZone( shared_ptr<Geometry> geometry, unsigned int uiMaximumDepth, unsigned int uiMinimumTriCount ){ // Constructs a BSP given the geometry // TODO: Worry about the textures/materials for the BSP // This creates a new zone with the given geometry. shared_ptr<Zone> zone( new Zone( getNextZoneID(), geometry, uiMaximumDepth, uiMinimumTriCount ) ); // Adds the zone to our collection of zones to render addZone( zone );}
开发者ID:ejabx,项目名称:katana,代码行数:14,
示例3: EmitIconst Register& Builder::EmitI(Op const opcode, const Type& outy, const Operand& src1, const Operand& src2) { auto& inst = Instruction::New(zone(), opcode); auto& out = *NewOutput(outy).StaticCast<Register>(); inst.set_output(out); inst.set_output_type(outy); inst.AppendOperand(src1); inst.AppendOperand(src2); EmitI(inst); return out;}
开发者ID:eval1749,项目名称:evm,代码行数:11,
示例4: FatalErrorInvoid Foam::overlapGgiPolyPatch::calcLocalParallel() const{ // Calculate patch-to-zone addressing if (localParallelPtr_) { FatalErrorIn("void overlapGgiPolyPatch::calcLocalParallel() const") << "Local parallel switch already calculated" << abort(FatalError); } // If running in serial, all GGIs are local parallel // HJ, 1/Jun/2011 localParallelPtr_ = new bool(false); bool& emptyOrComplete = *localParallelPtr_; // If running in serial, all GGIs are expanded to zone size. // This happens on decomposition and reconstruction where // size and shadow size may be zero, but zone size may not // HJ, 1/Jun/2011 if (!Pstream::parRun()) { emptyOrComplete = false; } else { // Calculate localisation on master and shadow emptyOrComplete = ( zone().size() == size() && shadow().zone().size() == shadow().size() ) || (size() == 0 && shadow().size() == 0); reduce(emptyOrComplete, andOp<bool>()); } if (debug && Pstream::parRun()) { Info<< "Overlap GGI patch Master: " << name() << " Slave: " << shadowName() << " is "; if (emptyOrComplete) { Info<< "local parallel" << endl; } else { Info<< "split between multiple processors" << endl; } }}
开发者ID:CFDEMproject,项目名称:OpenFOAM-1.6-ext,代码行数:51,
示例5: PollardRhoint PollardRho(verylong zalpha, verylong zbeta, verylong zn, verylong zp, verylong *zx){ long i = 2, j; static verylong za0 = 0, za1 = 0, za2 = 0, za3 = 0; static verylong zb0 = 0, zb1 = 0, zb2 = 0, zb3 = 0; static verylong zx0 = 0, zx1 = 0, zx2 = 0, zx3 = 0; static verylong zr = 0, zri = 0; zone(&zx0); zzero(&za0); zzero(&zb0); zfi(zalpha, zbeta, zp, zx0, &zx1); zai(za0, zn, zx0, &za1); zbi(zb0, zn, zx0, &zb1); zfi(zalpha, zbeta, zp, zx1, &zx2); zai(za1, zn, zx1, &za2); zbi(zb1, zn, zx1, &zb2); zcopy(za1, &za0); zcopy(zb1, &zb0); zcopy(zx1, &zx0); for (;;) { zfi(zalpha, zbeta, zp, zx0, &zx1); zai(za0, zn, zx0, &za1); zbi(zb0, zn, zx0, &zb1); zcopy(za1, &za2); zcopy(zb1, &zb2); zcopy(zx1, &zx2); i++; for (j = 0; j < i; j++) { zfi(zalpha, zbeta, zp, zx2, &zx3); zai(za2, zn, zx2, &za3); zbi(zb2, zn, zx2, &zb3); zcopy(za3, &za2); zcopy(zb3, &zb2); zcopy(zx3, &zx2); } if (zcompare(zx1, zx3) == 0) { zsubmod(zb1, zb3, zn, &zr); if (zscompare(zr, 0) == 0) return 0; zinvmod(zr, zn, &zri); zsub(za3, za1, &za0); zmulmod(za0, zri, zn, zx); return 1; } zcopy(za1, &za0); zcopy(zb1, &zb0); zcopy(zx1, &zx0); }}
开发者ID:oghenez,项目名称:mycila,代码行数:50,
示例6: uid// Exporting Event data to map. Using the same// encoding as ODateBookAccessBackend_xml does..// Thus, we could remove the stuff there and use this// for it and for all other places..// Encoding should happen at one place, only ! (eilers)QMap<int, QString> OEvent::toMap()const { QMap<int, QString> retMap; retMap.insert( OEvent::FUid, QString::number( uid() ) ); retMap.insert( OEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) )); retMap.insert( OEvent::FDescription, Qtopia::escapeString( description() ) ); retMap.insert( OEvent::FLocation, Qtopia::escapeString( location() ) ); retMap.insert( OEvent::FType, isAllDay() ? "AllDay" : "" ); OPimAlarm alarm = notifiers().alarms()[0]; retMap.insert( OEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) ); retMap.insert( OEvent::FSound, (alarm.sound() == OPimAlarm::Loud) ? "loud" : "silent" ); OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() ); retMap.insert( OEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OTimeZone::utc() ) ) ) ); retMap.insert( OEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OTimeZone::utc() ) ) ) ); retMap.insert( OEvent::FNote, Qtopia::escapeString( note() ) ); retMap.insert( OEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() ); if( parent() ) retMap.insert( OEvent::FRecParent, QString::number( parent() ) ); if( children().count() ){ QArray<int> childr = children(); QString buf; for ( uint i = 0; i < childr.count(); i++ ) { if ( i != 0 ) buf += " "; buf += QString::number( childr[i] ); } retMap.insert( OEvent::FRecChildren, buf ); } // Add recurrence stuff if( hasRecurrence() ){ ORecur recur = recurrence(); QMap<int, QString> recFields = recur.toMap(); retMap.insert( OEvent::FRType, recFields[ORecur::RType] ); retMap.insert( OEvent::FRWeekdays, recFields[ORecur::RWeekdays] ); retMap.insert( OEvent::FRPosition, recFields[ORecur::RPosition] ); retMap.insert( OEvent::FRFreq, recFields[ORecur::RFreq] ); retMap.insert( OEvent::FRHasEndDate, recFields[ORecur::RHasEndDate] ); retMap.insert( OEvent::FREndDate, recFields[ORecur::EndDate] ); retMap.insert( OEvent::FRCreated, recFields[ORecur::Created] ); retMap.insert( OEvent::FRExceptions, recFields[ORecur::Exceptions] ); } else { ORecur recur = recurrence(); QMap<int, QString> recFields = recur.toMap(); retMap.insert( OEvent::FRType, recFields[ORecur::RType] ); } return retMap;}
开发者ID:opieproject,项目名称:opie,代码行数:54,
示例7: namestd::ostream& operator<<(std::ostream &s, const LLViewerRegion ®ion){ s << "{ "; s << region.mHost; s << " mOriginGlobal = " << region.getOriginGlobal()<< "/n"; std::string name(region.getName()), zone(region.getZoning()); if (! name.empty()) { s << " mName = " << name << '/n'; } if (! zone.empty()) { s << " mZoning = " << zone << '/n'; } s << "}"; return s;}
开发者ID:mightymarc,项目名称:kittyviewer,代码行数:17,
示例8: zonevoid GRIBUIDialog::OnRequest( wxCommandEvent& event ){ double lonmax=m_vp->lon_max; double lonmin=m_vp->lon_min; if( ( fabs( m_vp->lat_max ) < 90. ) && ( fabs( lonmax ) < 360. ) ) { if( lonmax < -180. ) lonmax += 360.; if( lonmax > 180. ) lonmax -= 360.; } if( ( fabs( m_vp->lat_min ) < 90. ) && ( fabs( lonmin ) < 360. ) ) { if( lonmin < -180. ) lonmin += 360.; if( lonmin > 180. ) lonmin -= 360.; } wxString zone( toSAILDOC( 1, 1, m_vp->lat_max ) + wxT(",") + toSAILDOC( 1, 2, m_vp->lat_min ) + wxT(",") + toSAILDOC( 2, 2, lonmin ) + wxT(",") + toSAILDOC( 2, 1, lonmax ) ); GribRequestSetting *req_Dialog = new GribRequestSetting( this, pPlugIn->GetRequestConfig(), zone, pPlugIn->GetMailAdresse() ); if( req_Dialog->ShowModal() == wxID_SAVE ) { req_Dialog->m_RequestConfigBase.SetChar( 2, (char) ( req_Dialog->m_pModel->GetCurrentSelection() + '0' ) ); if( req_Dialog->m_pModel->GetCurrentSelection() == 0 ) { req_Dialog->m_RequestConfigBase.SetChar( 3, (char) ( req_Dialog->m_pResolution->GetCurrentSelection() + '0' ) ); req_Dialog->m_pWaves->IsChecked() ? req_Dialog->m_RequestConfigBase.SetChar( 8, 'X' ) : req_Dialog->m_RequestConfigBase.SetChar( 8, '.' ); req_Dialog->m_pRainfall->IsChecked() ? req_Dialog->m_RequestConfigBase.SetChar( 9, 'X' ) : req_Dialog->m_RequestConfigBase.SetChar( 9, '.' ); req_Dialog->m_pCloudCover->IsChecked() ? req_Dialog->m_RequestConfigBase.SetChar( 10, 'X' ) : req_Dialog->m_RequestConfigBase.SetChar( 10, '.' ); req_Dialog->m_pAirTemp->IsChecked() ? req_Dialog->m_RequestConfigBase.SetChar( 11, 'X' ) : req_Dialog->m_RequestConfigBase.SetChar( 11, '.' ); req_Dialog->m_pSeaTemp->IsChecked() ? req_Dialog->m_RequestConfigBase.SetChar( 12, 'X' ) : req_Dialog->m_RequestConfigBase.SetChar( 12, '.' ); req_Dialog->m_pCurrent->IsChecked() ? req_Dialog->m_RequestConfigBase.SetChar( 13, 'X' ) : req_Dialog->m_RequestConfigBase.SetChar( 13, '.' ); } else if( req_Dialog->m_pModel->GetCurrentSelection() == 1 ) req_Dialog->m_RequestConfigBase.SetChar( 3, (char) ( req_Dialog->m_pResolution->GetCurrentSelection() + '0' ) ); req_Dialog->m_RequestConfigBase.SetChar( 6, 'X' ); //must be always selected req_Dialog->m_RequestConfigBase.SetChar( 7, 'X' ); req_Dialog->m_RequestConfigBase.SetChar( 4, (char) ( req_Dialog->m_pInterval->GetCurrentSelection() + '0' ) ); req_Dialog->m_RequestConfigBase.SetChar( 5, (char) ( req_Dialog->m_pTimeRange->GetCurrentSelection() + '0' ) ); pPlugIn->SetRequestConfig( req_Dialog->m_RequestConfigBase ); } req_Dialog->Destroy();}
开发者ID:bingcheng,项目名称:OpenCPN,代码行数:44,
示例9: zonebool EditPanel::CommandPaste(ImageInfoPtr newValue ){ if ( mImageInfo == NULL ) { return false; } wxRect zone( mCursor, newValue->GetSize() ); ImageInfoPtr old = mImageInfo->CopyToImageInfo( zone ); if (old) { ImagePasteCommand* paste = new ImagePasteCommand(this, old->Clone(), newValue->Clone(), mCursor ); return COMMAND->Submit( paste ); } return false;}
开发者ID:old-games,项目名称:universal-translators-tool,代码行数:19,
示例10: zone// FIXME: Use OEvent::fromMap() which makes this obsolete.. (eilers)void ODateBookAccessBackend_XML::finalizeRecord( OEvent& ev ) { /* AllDay is alway in UTC */ if ( ev.isAllDay() ) { OTimeZone utc = OTimeZone::utc(); ev.setStartDateTime( utc.fromUTCDateTime( start ) ); ev.setEndDateTime ( utc.fromUTCDateTime( end ) ); ev.setTimeZone( "UTC"); // make sure it is really utc } else { /* to current date time */ // qWarning(" Start is %d", start ); OTimeZone zone( ev.timeZone().isEmpty() ? OTimeZone::current() : ev.timeZone() ); QDateTime date = zone.toDateTime( start ); qWarning(" Start is %s", date.toString().latin1() ); ev.setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) ); date = zone.toDateTime( end ); ev.setEndDateTime ( zone.toDateTime( date, OTimeZone::current() ) ); } if ( rec && rec->doesRecur() ) { OTimeZone utc = OTimeZone::utc(); ORecur recu( *rec ); // call copy c'tor; recu.setEndDate ( utc.fromUTCDateTime( rp_end ).date() ); recu.setCreatedDateTime( utc.fromUTCDateTime( created ) ); recu.setStart( ev.startDateTime().date() ); ev.setRecurrence( recu ); } if (alarmTime != -1 ) { QDateTime dt = ev.startDateTime().addSecs( -1*alarmTime*60 ); OPimAlarm al( snd , dt ); ev.notifiers().add( al ); } if ( m_raw.contains( ev.uid() ) || m_rep.contains( ev.uid() ) ) { qWarning("already contains assign uid"); ev.setUid( 1 ); } qWarning("addind %d %s", ev.uid(), ev.description().latin1() ); if ( ev.hasRecurrence() ) m_rep.insert( ev.uid(), ev ); else m_raw.insert( ev.uid(), ev );}
开发者ID:opieproject,项目名称:opie,代码行数:44,
示例11: zonevoid GRIBUIDialog::OnRequest( wxCommandEvent& event ){ double lonmax=m_vp->lon_max; double lonmin=m_vp->lon_min; if( ( fabs( m_vp->lat_max ) < 90. ) && ( fabs( lonmax ) < 360. ) ) { if( lonmax < -180. ) lonmax += 360.; if( lonmax > 180. ) lonmax -= 360.; } if( ( fabs( m_vp->lat_min ) < 90. ) && ( fabs( lonmin ) < 360. ) ) { if( lonmin < -180. ) lonmin += 360.; if( lonmin > 180. ) lonmin -= 360.; } wxString zone( toSAILDOC( 1, 1, m_vp->lat_max ) + wxT(",") + toSAILDOC( 1, 2, m_vp->lat_min ) + wxT(",") + toSAILDOC( 2, 2, lonmin ) + wxT(",") + toSAILDOC( 2, 1, lonmax ) ); ShowSendRequest( zone );}
开发者ID:IgorMikhal,项目名称:OpenCPN,代码行数:19,
示例12: zoneFoam::label Foam::overlapGgiPolyPatch::zoneIndex() const{ if (zoneIndex_ == -1 && zoneName_ != Foam::word::null) { // Grab zone patch index faceZoneID zone(zoneName_, boundaryMesh().mesh().faceZones()); if (!zone.active()) { FatalErrorIn("label overlapGgiPolyPatch::zoneIndex() const") << "Face zone name " << zoneName_ << " not found. Please check your GGI interface definition." << abort(FatalError); } zoneIndex_ = zone.index(); } return zoneIndex_;}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:20,
示例13: sub_changed_hook/* This function rerenders the subliminal window's entire sub_buffer. It loops * through all inferior windows, calling their 'draw_to_sub' function to get them * to draw onto its own sub_buffer. After doing this, it alerts any derived * classes's hooks. */void window_sub::update_sub(){ // If we are not capable of having our sub-buffer updated, return if (!sub_buffer || !visible() || !flag(sys_active)) return; // If we are at all clipped, clear our sub-buffer so the clipped portions don't // get filled with junk. if (flag(vis_positive_clip) || flag(vis_negative_clip)) clear_to_color(sub_buffer, 0); // Loop through all inferior windows that we are visible to us for (base_window* loop = get_parent(); loop && loop != this; loop = loop->superior()) { if (loop->visible() && loop->flag(sys_active)) { // If they are visible and active, draw themselves to us loop->draw_to_sub(this, &loop->clipped(), false); } } // Call the hook to inform it our entire surface has been drawn to! sub_changed_hook(&zone(0, 0, w(), h()));}
开发者ID:taliesinb,项目名称:penguin,代码行数:27,
示例14: can_insert_into_block// This routine checks whether a poylgon can be inserted into a block such that the interior of the polygon does not at all overlap with used space// in the block. We COULD do this using boolean operations (E.g. is the intersection of the used block space and our polygon empty?) but we do NOT want// to. Why? Time to do a boolean op is a function of BOTH polygons, and in a lot of cases the block will be HUGELY complex (imagine a giant forest expanse// with lots of crap already inserted into it) and our test block will be TINY (a quad). In this case, we get better performance by doing a piece-wise per-side// test. // Side note: using the bulk locator totally violates this principle...we will probably need to replace it with a walk location strategy.// So we use the zone utility to see what we'll hit as we go along our edges. bool can_insert_into_block( Block_2& block, const Polygon_2& bounds){ // Run a bulk location on the entire block...TBD: there may be blocks where sweeping is worse than marching. // Anyway, we get a bunch of pairs of the locate point and the actual part of the arrangement we hit. vector<pair<Point_2, CGAL::Object> > pts; CGAL::locate(block, bounds.vertices_begin(), bounds.vertices_end(), back_inserter(pts)); // Quick check: if ANY of our points are inside a non empty face, we are by definition hosed. // We can see this now just from the location data. Block_2::Face_const_handle ff; for(int n = 0; n < pts.size(); ++n) if(CGAL::assign(ff,pts[n].second)) if(ff->data().usage != usage_Empty) return false; for(int n = 0; n < pts.size(); ++n) { // We are now going to go through each side and do a zone test. This will check whether it is // either running along a full area or crashing through it. int m = (n+1)%pts.size(); check_block_visitor v; v.cv = Block_2::X_monotone_curve_2(Segment_2(pts[n].first, pts[m].first)); CGAL::Arrangement_zone_2<Block_2,check_block_visitor> zone(block, &v); if(v.cv.is_directed_right()) zone.init_with_hint(v.cv,pts[n].second); else zone.init_with_hint(v.cv,pts[m].second); zone.compute_zone(); if(!v.ok) return false; } return true;}
开发者ID:highattack30,项目名称:xptools,代码行数:46,
示例15: check_block void check_block(void **reference, void *block) { if (block == _block) { if (_thread) { intptr_t offset = (intptr_t)reference - (intptr_t)_thread_range.end(); agc_reference_t ref = { (vm_address_t)block, (vm_address_t)_thread_range.end(), offset }; _callback(_callback_ctx, ref); } else if (!reference) { // ??? } else { void *owner = zone()->block_start((void*)reference); if (owner) { intptr_t offset = (intptr_t)reference - (intptr_t)owner; agc_reference_t ref = { (vm_address_t)block, (vm_address_t)owner, offset }; _callback(_callback_ctx, ref); } else { agc_reference_t ref = { (vm_address_t)block, (vm_address_t)reference, 0 }; _callback(_callback_ctx, ref); } } } MemoryScanner::check_block(reference, block); }
开发者ID:takuma104,项目名称:iphone-macruby,代码行数:23,
示例16: new_playerPlayer *new_player(EntitySet * others, Camera * cam, InputState * is, Level world, Control * halter){ Player * player = (Player *) zone(sizeof(Player)); Entity * body = load_entity(PLAYER_PATH, player, &player_user_input_response, &player_destructor); player->body = body; player->others = others; player->cam = cam; player->is = is; player->world = world; player->health = 100; player->halter = halter; player->score = 0; player->fire = Mix_LoadWAV(FIRE_PATH); player->attack_timer = new_expirer(PLAYER_ATTACK_FREQUENCY); entity_set_speed(body, 3); entity_set_direction(body, 0, 0); register_entity(others, body); return player;}
开发者ID:johnny-morrice,项目名称:house-of-dangerous-kittens,代码行数:23,
示例17: mainint main (){ Arrangement_2 arr; Segment_2 segs[N_SEGMENTS]; std::size_t zone_expected_comp[N_SEGMENTS]; int k; segs[0] = Segment_2 (Point_2 (-2, -2), Point_2 (-1, -1)); segs[1] = Segment_2 (Point_2 (-1, 1), Point_2 (1, 1)); segs[2] = Segment_2 (Point_2 (0, 0), Point_2 (3, 0)); zone_expected_comp[0] = 1; zone_expected_comp[1] = 3; zone_expected_comp[2] = 4; insert(arr, Segment_2(Point_2(0, 0), Point_2(2, 0))); insert(arr, Segment_2(Point_2(2, 0), Point_2(2, 2))); insert(arr, Segment_2(Point_2(2, 2), Point_2(0, 2))); insert(arr, Segment_2(Point_2(0, 2), Point_2(0, 0))); for (k = 0; k < N_SEGMENTS; k++) { std::list<CGAL::Object> zone_elems; zone(arr, segs[k], std::back_inserter(zone_elems)); std::size_t zone_actual_comp = zone_elems.size(); std::cout << "Segment: " << segs[k]; std::cout << " Expected: " << zone_expected_comp[k]; std::cout << " Actual: " << zone_actual_comp << std::endl; if (zone_expected_comp[k] != zone_actual_comp) return (1); } return (0);}
开发者ID:2php,项目名称:cgal,代码行数:36,
示例18: zoneconst KstTimezone *KstTimezones::local(){ const KstTimezone *local = 0; // First try the simplest solution of checking for well-formed TZ setting. char *envZone = ::getenv("TZ"); if (envZone) { if (envZone[0] == '/0') { return m_UTC; } else if (envZone[0] == ':') { envZone++; } local = zone(envZone); } if (local) return local; // Try to match /etc/localtime against the list of zoneinfo files. QFile f; f.setName("/etc/localtime"); if (f.open(IO_ReadOnly)) { // Compute the MD5 sum of /etc/localtime. KMD5 context(""); context.reset(); context.update(f); QIODevice::Offset referenceSize = f.size(); QString referenceMd5Sum = context.hexDigest(); f.close(); if (!m_zoneinfoDir.isEmpty()) { // Compare it with each zoneinfo file. for (ZoneMap::Iterator it = m_zones->begin(); it != m_zones->end(); ++it) { KstTimezone *zone = it.data(); f.setName(m_zoneinfoDir + '/' + zone->name()); if (f.open(IO_ReadOnly)) { QIODevice::Offset candidateSize = f.size(); QString candidateMd5Sum; if (candidateSize == referenceSize) { // Only do the heavy lifting for file sizes which match. context.reset(); context.update(f); candidateMd5Sum = context.hexDigest(); } f.close(); if (candidateMd5Sum == referenceMd5Sum) { local = zone; break; } } } } } if (local) return local; // BSD support. QString fileZone; f.setName("/etc/timezone"); if (!f.open(IO_ReadOnly)) { // Solaris support using /etc/default/init. f.setName("/etc/default/init"); if (f.open(IO_ReadOnly)) { QTextStream ts(&f); ts.setEncoding(QTextStream::Latin1); // Read the last line starting "TZ=". while (!ts.atEnd()) { fileZone = ts.readLine(); if (fileZone.startsWith("TZ=")) { fileZone = fileZone.mid(3); local = zone(fileZone); } } f.close(); } } else { QTextStream ts(&f); ts.setEncoding(QTextStream::Latin1); // Read the first line. if (!ts.atEnd()) { fileZone = ts.readLine();//.........这里部分代码省略.........
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:101,
示例19: setUidvoid OEvent::fromMap( const QMap<int, QString>& map ){ // We just want to set the UID if it is really stored. if ( !map[OEvent::FUid].isEmpty() ) setUid( map[OEvent::FUid].toInt() ); setCategories( idsFromString( map[OEvent::FCategories] ) ); setDescription( map[OEvent::FDescription] ); setLocation( map[OEvent::FLocation] ); if ( map[OEvent::FType] == "AllDay" ) setAllDay( true ); else setAllDay( false ); int alarmTime = -1; if( !map[OEvent::FAlarm].isEmpty() ) alarmTime = map[OEvent::FAlarm].toInt(); int sound = ( ( map[OEvent::FSound] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); if ( ( alarmTime != -1 ) ){ QDateTime dt = startDateTime().addSecs( -1*alarmTime*60 ); OPimAlarm al( sound , dt ); notifiers().add( al ); } if ( !map[OEvent::FTimeZone].isEmpty() && ( map[OEvent::FTimeZone] != "None" ) ){ setTimeZone( map[OEvent::FTimeZone] ); } time_t start = (time_t) map[OEvent::FStart].toLong(); time_t end = (time_t) map[OEvent::FEnd].toLong(); /* AllDay is always in UTC */ if ( isAllDay() ) { OTimeZone utc = OTimeZone::utc(); setStartDateTime( utc.fromUTCDateTime( start ) ); setEndDateTime ( utc.fromUTCDateTime( end ) ); setTimeZone( "UTC"); // make sure it is really utc }else { /* to current date time */ // qWarning(" Start is %d", start ); OTimeZone zone( timeZone().isEmpty() ? OTimeZone::current() : timeZone() ); QDateTime date = zone.toDateTime( start ); qWarning(" Start is %s", date.toString().latin1() ); setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) ); date = zone.toDateTime( end ); setEndDateTime ( zone.toDateTime( date, OTimeZone::current() ) ); } if ( !map[OEvent::FRecParent].isEmpty() ) setParent( map[OEvent::FRecParent].toInt() ); if ( !map[OEvent::FRecChildren].isEmpty() ){ QStringList list = QStringList::split(' ', map[OEvent::FRecChildren] ); for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { addChild( (*it).toInt() ); } } // Fill recurrence stuff and put it directly into the ORecur-Object using fromMap.. if( !map[OEvent::FRType].isEmpty() ){ QMap<int, QString> recFields; recFields.insert( ORecur::RType, map[OEvent::FRType] ); recFields.insert( ORecur::RWeekdays, map[OEvent::FRWeekdays] ); recFields.insert( ORecur::RPosition, map[OEvent::FRPosition] ); recFields.insert( ORecur::RFreq, map[OEvent::FRFreq] ); recFields.insert( ORecur::RHasEndDate, map[OEvent::FRHasEndDate] ); recFields.insert( ORecur::EndDate, map[OEvent::FREndDate] ); recFields.insert( ORecur::Created, map[OEvent::FRCreated] ); recFields.insert( ORecur::Exceptions, map[OEvent::FRExceptions] ); ORecur recur( recFields ); setRecurrence( recur ); }}
开发者ID:opieproject,项目名称:opie,代码行数:77,
示例20: mainint main(int argc, char* argv[]){ terrama2::core::initializeTerraMA(); { QUrl uri; uri.setScheme("postgis"); uri.setHost(QString::fromStdString(TERRAMA2_DATABASE_HOST)); uri.setPort(std::stoi(TERRAMA2_DATABASE_PORT)); uri.setUserName(QString::fromStdString(TERRAMA2_DATABASE_USERNAME)); uri.setPassword(QString::fromStdString(TERRAMA2_DATABASE_PASSWORD)); uri.setPath(QString::fromStdString("/"+TERRAMA2_DATABASE_DBNAME)); //DataProvider information terrama2::core::DataProvider* dataProvider = new terrama2::core::DataProvider(); terrama2::core::DataProviderPtr dataProviderPtr(dataProvider); dataProvider->uri = uri.url().toStdString(); dataProvider->intent = terrama2::core::DataProviderIntent::COLLECTOR_INTENT; dataProvider->dataProviderType = "POSTGIS"; dataProvider->active = true; //DataSeries information terrama2::core::DataSeries* dataSeries = new terrama2::core::DataSeries(); terrama2::core::DataSeriesPtr dataSeriesPtr(dataSeries); auto& semanticsManager = terrama2::core::SemanticsManager::getInstance(); dataSeries->semantics = semanticsManager.getSemantics("OCCURRENCE-postgis"); //DataSet information terrama2::core::DataSetOccurrence* dataSet = new terrama2::core::DataSetOccurrence(); dataSet->active = true; dataSet->format.emplace("table_name", "fires"); dataSet->format.emplace("timestamp_property", "data_pas"); dataSet->format.emplace("geometry_property", "geom"); dataSeries->datasetList.emplace_back(dataSet); //accessing data terrama2::core::DataAccessorOccurrencePostGis accessor(dataProviderPtr, dataSeriesPtr); //empty filter terrama2::core::Filter filter; boost::local_time::time_zone_ptr zone(new boost::local_time::posix_time_zone("+00")); filter.lastValue = true; std::string boundingBoxWkt = "POLYGON((-51.11 -17.74, -41.11 -17.74, -41.11 -20.83, -51.11 -20.83, -51.11 -17.74))"; te::gm::Geometry* geometry = te::gm::WKTReader::read(boundingBoxWkt.c_str()); geometry->setSRID(4326); filter.region = std::shared_ptr<te::gm::Geometry>(geometry); terrama2::core::OccurrenceSeriesPtr occurrenceSeries = accessor.getOccurrenceSeries(filter); assert(occurrenceSeries->occurrencesMap().size() == 1); auto teDataSet = (*occurrenceSeries->occurrencesMap().begin()).second.syncDataSet->dataset(); //Print column names and types (DateTime/Double) int dateColumn = -1; int geomColumn = -1; std::string names, types; for(int i = 0; i < teDataSet->getNumProperties(); ++i) { std::string name = teDataSet->getPropertyName(i); names+= name + "/t"; if(name == "data_pas") { types+= "DataTime/t"; dateColumn = i; } else if(name == "geom") { types+= "Geometry/t"; geomColumn = i; } else types+= "Int/t"; } std::cout << names << std::endl; std::cout << types << std::endl; //Print values teDataSet->moveBeforeFirst(); while(teDataSet->moveNext()) { for(int i = 0; i < teDataSet->getNumProperties(); ++i) { if(teDataSet->isNull(i)) { std::cout << "NULL"; continue; } if(i == dateColumn) { std::shared_ptr<te::dt::DateTime> dateTime = teDataSet->getDateTime(i); std::cout << dateTime->toString(); } else if(i == geomColumn)//.........这里部分代码省略.........
开发者ID:edelatin,项目名称:terrama2,代码行数:101,
示例21: mature_object_p bool mature_object_p() const { return zone() == MatureObjectZone; }
开发者ID:Energy0124,项目名称:rubinius,代码行数:3,
示例22: young_object_p bool young_object_p() const { return zone() == YoungObjectZone; }
开发者ID:Energy0124,项目名称:rubinius,代码行数:3,
示例23: QString// read zone file, allowing for zones with or without end datesbool HrZones::read(QFile &file){ defaults_from_user = false; scheme.zone_default.clear(); scheme.zone_default_is_pct.clear(); scheme.zone_default_name.clear(); scheme.zone_default_desc.clear(); scheme.zone_default_trimp.clear(); scheme.nzones_default = 0; ranges.clear(); // set up possible warning dialog warning = QString(); int warning_lines = 0; const int max_warning_lines = 100; // macro to append lines to the warning #define append_to_warning(s) / if (warning_lines < max_warning_lines) / warning.append(s); / else if (warning_lines == max_warning_lines) / warning.append(".../n"); / warning_lines ++; // read using text mode takes care of end-lines if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { err = "can't open file"; return false; } QTextStream fileStream(&file); QRegExp commentrx("//s*#.*$"); QRegExp blankrx("^[ /t]*$"); QRegExp rangerx[] = { QRegExp("^//s*(?:from//s+)?" // optional "from" "((//d//d//d//d)[-/](//d{1,2})[-/](//d{1,2})|BEGIN)" // begin date "//s*([,:]?//s*(LT)//s*=//s*(//d+))?" // optional {LT = integer (optional %)} "//s*([,:]?//s*(RestHr)//s*=//s*(//d+))?" // optional {RestHr = integer (optional %)} "//s*([,:]?//s*(MaxHr)//s*=//s*(//d+))?" // optional {MaxHr = integer (optional %)} "//s*:?//s*$", // optional : Qt::CaseInsensitive), QRegExp("^//s*(?:from//s+)?" // optional "from" "((//d//d//d//d)[-/](//d{1,2})[-/](//d{1,2})|BEGIN)" // begin date "//s+(?:until|to|-)//s+" // until "((//d//d//d//d)[-/](//d{1,2})[-/](//d{1,2})|END)?" // end date "//s*:?,?//s*((LT)//s*=//s*(//d+))?" // optional {LT = integer (optional %)} "//s*:?,?//s*((RestHr)//s*=//s*(//d+))?" // optional {RestHr = integer (optional %)} "//s*:?,?//s*((MaxHr)//s*=//s*(//d+))?" // optional {MaxHr = integer (optional %)} "//s*:?//s*$", // optional : Qt::CaseInsensitive) }; QRegExp zonerx("^//s*([^ ,][^,]*),//s*([^ ,][^,]*),//s*" "(//d+)//s*(%?)//s*(?:,//s*(//d+(//.//d+)?)//s*)?$", Qt::CaseInsensitive);// QRegExp zonedefaultsx("^//s*(?:zone)?//s*defaults?//s*:?//s*$", Qt::CaseInsensitive); int lineno = 0; // the current range in the file // ZoneRange *range = NULL; bool in_range = false; QDate begin = date_zero, end = date_infinity; int lt = 0; int restHr = 0; int maxHr = 0; QList<HrZoneInfo> zoneInfos; // true if zone defaults are found in the file (then we need to write them) bool zones_are_defaults = false; while (! fileStream.atEnd() ) { ++lineno; QString line = fileStream.readLine(); int pos = commentrx.indexIn(line, 0); if (pos != -1) line = line.left(pos); if (blankrx.indexIn(line, 0) == 0) goto next_line; // check for default zone range definition (may be followed by hr zone definitions) if (zonedefaultsx.indexIn(line, 0) != -1) { zones_are_defaults = true; // defaults are allowed only at the beginning of the file if (ranges.size()) { err = "HR Zone defaults must be specified at head of hr.zones file"; return false; } // only one set of defaults is allowed if (scheme.nzones_default) { err = "Only one set of zone defaults may be specified in hr.zones file"; return false; } goto next_line; }//.........这里部分代码省略.........
开发者ID:BryanF1947,项目名称:GoldenCheetah,代码行数:101,
示例24: QString// read zone file, allowing for zones with or without end datesbool Zones::read(QFile &file){ defaults_from_user = false; scheme.zone_default.clear(); scheme.zone_default_is_pct.clear(); scheme.zone_default_name.clear(); scheme.zone_default_desc.clear(); scheme.nzones_default = 0; ranges.clear(); // set up possible warning dialog warning = QString(); int warning_lines = 0; const int max_warning_lines = 100; int defaultwprime = 20000; // default to 20kJ int defaultpmax = 1000; // macro to append lines to the warning #define append_to_warning(s) / if (warning_lines < max_warning_lines) { / warning.append(s); } / else if (warning_lines == max_warning_lines) { / warning.append(".../n"); } / warning_lines++; // read using text mode takes care of end-lines if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { err = "can't open file"; return false; } QTextStream fileStream(&file); QRegExp commentrx("//s*#.*$"); QRegExp blankrx("^[ /t]*$"); QRegExp rangerx[] = { QRegExp("^//s*(?:from//s+)?" // optional "from" "((//d//d//d//d)[-/](//d{1,2})[-/](//d{1,2})|BEGIN)" // begin date "//s*([,:]?//s*(FTP|CP)//s*=//s*(//d+))?" // optional {CP/FTP = integer (optional %)} "//s*:?//s*$", // optional : Qt::CaseInsensitive), QRegExp("^//s*(?:from//s+)?" // optional "from" "((//d//d//d//d)[-/](//d{1,2})[-/](//d{1,2})|BEGIN)" // begin date "//s+(?:until|to|-)//s+" // until "((//d//d//d//d)[-/](//d{1,2})[-/](//d{1,2})|END)?" // end date "//s*:?,?//s*((FTP|CP)//s*=//s*(//d+))?" // optional {CP/FTP = integer (optional %)} "//s*:?//s*$", // optional : Qt::CaseInsensitive) }; QRegExp ftpx("^FTP=(//d+)$"); QRegExp wprimerx("^W'=(//d+)$"); QRegExp pmaxx("^Pmax=(//d+)$"); QRegExp zonerx("^//s*([^ ,][^,]*),//s*([^ ,][^,]*),//s*" "(//d+)//s*(%?)//s*(?:,//s*(//d+|MAX)//s*(%?)//s*)?$", Qt::CaseInsensitive); QRegExp zonedefaultsx("^//s*(?:zone)?//s*defaults?//s*:?//s*$", Qt::CaseInsensitive); int lineno = 0; // the current range in the file // ZoneRange *range = NULL; bool in_range = false; QDate begin = date_zero, end = date_infinity; int cp=0; int ftp=0; int wprime=0; int pmax=0; QList<ZoneInfo> zoneInfos; // true if zone defaults are found in the file (then we need to write them) bool zones_are_defaults = false; while (!fileStream.atEnd() ) { ++lineno; QString line = fileStream.readLine(); int pos = commentrx.indexIn(line, 0); if (pos != -1) line = line.left(pos); if (blankrx.indexIn(line, 0) == 0) goto next_line; // check for default zone range definition (may be followed by zone definitions) if (zonedefaultsx.indexIn(line, 0) != -1) { zones_are_defaults = true; // defaults are allowed only at the beginning of the file if (ranges.size()) { err = "Zone defaults must be specified at head of power.zones file"; return false; } // only one set of defaults is allowed if (scheme.nzones_default) { err = "Only one set of zone defaults may be specified in power.zones file"; return false; } goto next_line; } // check for range specification (may be followed by zone definitions)//.........这里部分代码省略.........
开发者ID:JanDeVisser,项目名称:GoldenCheetah,代码行数:101,
注:本文中的zone函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ zone_page_state函数代码示例 C++ zmw_get_wlan_dev函数代码示例 |