本文整理汇总了C++中builder函数的典型用法代码示例。如果您正苦于以下问题:C++ builder函数的具体用法?C++ builder怎么用?C++ builder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了builder函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: input
dsp* FaustgenFactory::createDSPAux(FaustAudioPluginInstance* instance)
{
dsp* dsp = nullptr;
std::string error;
String logStr;
// Factory already allocated
if (fDSPfactory)
{
dsp = fDSPfactory->createDSPInstance();
logStr << "Factory already allocated, " << dsp->getNumInputs() << " input(s), " << dsp->getNumOutputs() << " output(s)";
goto end;
}
// Tries to create from bitcode
if (fBitCode.length() > 0)
{
fDSPfactory = createFactoryFromBitcode();
if (fDSPfactory)
{
dsp = fDSPfactory->createDSPInstance();
logStr << "Compilation from bitcode succeeded, " << dsp->getNumInputs() << " input(s), " << dsp->getNumOutputs() << " output(s)";
goto end;
}
}
// Otherwise tries to create from source code
if (fSourceCode.length() > 0)
{
fDSPfactory = createFactoryFromSourceCode(instance);
if (fDSPfactory)
{
dsp = fDSPfactory->createDSPInstance();
logStr << "Compilation from source code succeeded, " << dsp->getNumInputs() << " input(s), " << dsp->getNumOutputs() << " output(s)";
goto end;
}
}
// Otherwise creates default DSP keeping the same input/output number
fDSPfactory = createDSPFactoryFromString("default", DEFAULT_CODE, 0, 0, getTarget(), error, LLVM_OPTIMIZATION);
jassert(fDSPfactory);
if (fDSPfactory)
{
dsp = fDSPfactory->createDSPInstance();
logStr << "Allocation of default DSP succeeded, " << dsp->getNumInputs() << " input(s), " << dsp->getNumOutputs() << " output(s)";
}
end:
LOG(logStr);
jassert(dsp);
// Prepare JSON
JSONUI builder(dsp->getNumInputs(), dsp->getNumOutputs());
dsp->metadata(&builder);
dsp->buildUserInterface(&builder);
fJSON = String(builder.JSON());
//LOG(fJSON);
return dsp;
}
开发者ID:olilarkin,项目名称:juce_faustllvm,代码行数:62,代码来源:FaustGenFactory.cpp
示例2: TEST_F
TEST_F(FontBuilderInitTest, NotDirty)
{
FontBuilder builder(document());
ASSERT_FALSE(builder.fontDirty());
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:5,代码来源:FontBuilderTest.cpp
示例3: tr
QgsGraph* RgShortestPathWidget::getPath( QgsPoint& p1, QgsPoint& p2 )
{
if ( mFrontPointLineEdit->text().isNull() || mBackPointLineEdit->text().isNull() )
{
QMessageBox::critical( this, tr( "Point not selected" ), tr( "First, select start and stop points." ) );
return NULL;
}
QgsGraphBuilder builder(
mPlugin->iface()->mapCanvas()->mapSettings().destinationCrs(),
mPlugin->iface()->mapCanvas()->mapSettings().hasCrsTransformEnabled(),
mPlugin->topologyToleranceFactor() );
{
const QgsGraphDirector *director = mPlugin->director();
if ( director == NULL )
{
QMessageBox::critical( this, tr( "Plugin isn't configured" ), tr( "Plugin isn't configured!" ) );
return NULL;
}
connect( director, SIGNAL( buildProgress( int, int ) ), mPlugin->iface()->mainWindow(), SLOT( showProgress( int, int ) ) );
connect( director, SIGNAL( buildMessage( QString ) ), mPlugin->iface()->mainWindow(), SLOT( showStatusMessage( QString ) ) );
QVector< QgsPoint > points;
QVector< QgsPoint > tiedPoint;
points.push_back( mFrontPoint );
points.push_back( mBackPoint );
director->makeGraph( &builder, points, tiedPoint );
p1 = tiedPoint[ 0 ];
p2 = tiedPoint[ 1 ];
// not need
delete director;
}
if ( p1 == QgsPoint( 0.0, 0.0 ) )
{
QMessageBox::critical( this, tr( "Tie point failed" ), tr( "Start point doesn't tie to the road!" ) );
return NULL;
}
if ( p2 == QgsPoint( 0.0, 0.0 ) )
{
QMessageBox::critical( this, tr( "Tie point failed" ), tr( "Stop point doesn't tie to the road!" ) );
return NULL;
}
QgsGraph *graph = builder.graph();
int startVertexIdx = graph->findVertex( p1 );
if ( startVertexIdx < 0 )
{
mPlugin->iface()->messageBar()->pushMessage(
tr( "Cannot calculate path" ),
tr( "Could not find start vertex. Please check your input data." ),
QgsMessageBar::WARNING,
mPlugin->iface()->messageTimeout()
);
delete graph;
return NULL;
}
int criterionNum = 0;
if ( mCriterionName->currentIndex() > 0 )
criterionNum = 1;
if ( graph->vertexCount() == 0 )
{
mPlugin->iface()->messageBar()->pushMessage(
tr( "Cannot calculate path" ),
tr( "The created graph is empty. Please check your input data." ),
QgsMessageBar::WARNING,
mPlugin->iface()->messageTimeout()
);
delete graph;
return NULL;
}
QgsGraph* shortestpathTree = QgsGraphAnalyzer::shortestTree( graph, startVertexIdx, criterionNum );
delete graph;
if ( shortestpathTree->findVertex( p2 ) == -1 )
{
delete shortestpathTree;
QMessageBox::critical( this, tr( "Path not found" ), tr( "Path not found" ) );
return NULL;
}
return shortestpathTree;
}
开发者ID:dakcarto,项目名称:QGIS,代码行数:91,代码来源:shortestpathwidget.cpp
示例4: while
// internal
int asCScriptFunction::ParseListPattern(asSListPatternNode *&target, const char *decl, asCScriptNode *listNodes)
{
asSListPatternNode *node = target;
listNodes = listNodes->firstChild;
while( listNodes )
{
if( listNodes->nodeType == snIdentifier )
{
asCString token(&decl[listNodes->tokenPos], listNodes->tokenLength);
if( token == "repeat" )
{
node->next = asNEW(asSListPatternNode)(asLPT_REPEAT);
node = node->next;
}
else if( token == "repeat_same" )
{
// TODO: list: Should make sure this is a sub-list
node->next = asNEW(asSListPatternNode)(asLPT_REPEAT_SAME);
node = node->next;
}
else
{
// Shouldn't happen as the parser already reported the error
asASSERT(false);
}
}
else if( listNodes->nodeType == snDataType )
{
asCDataType dt;
asCBuilder builder(engine, 0);
asCScriptCode code;
code.SetCode("", decl, 0, false);
dt = builder.CreateDataTypeFromNode(listNodes, &code, engine->defaultNamespace, false, returnType.GetObjectType());
node->next = asNEW(asSListPatternDataTypeNode)(dt);
node = node->next;
}
else if( listNodes->nodeType == snListPattern )
{
node->next = asNEW(asSListPatternNode)(asLPT_START);
node = node->next;
// Recursively parse the child
int r = ParseListPattern(node, decl, listNodes);
if( r < 0 )
return r;
node->next = asNEW(asSListPatternNode)(asLPT_END);
node = node->next;
}
else
{
// Unexpected token in the list, the parser shouldn't have allowed
asASSERT( false );
return -1;
}
listNodes = listNodes->next;
}
target = node;
return 0;
}
开发者ID:AnotherFoxGuy,项目名称:ror-server,代码行数:65,代码来源:as_scriptfunction.cpp
示例5: attribFilter
void dgPolygonSoupDatabaseBuilder::OptimizeByGroupID()
{
dgTree<int, int> attribFilter(m_allocator);
dgPolygonSoupDatabaseBuilder builder(m_allocator);
dgPolygonSoupDatabaseBuilder builderAux(m_allocator);
dgPolygonSoupDatabaseBuilder builderLeftOver(m_allocator);
builder.Begin();
dgInt32 polygonIndex = 0;
for (dgInt32 i = 0; i < m_faceCount; i++)
{
dgInt32 attribute = m_vertexIndex[polygonIndex];
if (!attribFilter.Find(attribute))
{
attribFilter.Insert(attribute, attribute);
builder.OptimizeByGroupID(*this, i, polygonIndex, builderLeftOver);
for (dgInt32 j = 0; builderLeftOver.m_faceCount && (j < 64); j++)
{
builderAux.m_faceVertexCount[builderLeftOver.m_faceCount] = 0;
builderAux.m_vertexIndex[builderLeftOver.m_indexCount] = 0;
builderAux.m_vertexPoints[builderLeftOver.m_vertexCount].m_x =
dgFloat32(0.0f);
memcpy(&builderAux.m_faceVertexCount[0],
&builderLeftOver.m_faceVertexCount[0],
sizeof(dgInt32) * builderLeftOver.m_faceCount);
memcpy(&builderAux.m_vertexIndex[0], &builderLeftOver.m_vertexIndex[0],
sizeof(dgInt32) * builderLeftOver.m_indexCount);
memcpy(&builderAux.m_vertexPoints[0],
&builderLeftOver.m_vertexPoints[0],
sizeof(dgBigVector) * builderLeftOver.m_vertexCount);
builderAux.m_faceCount = builderLeftOver.m_faceCount;
builderAux.m_indexCount = builderLeftOver.m_indexCount;
builderAux.m_vertexCount = builderLeftOver.m_vertexCount;
dgInt32 prevFaceCount = builderLeftOver.m_faceCount;
builderLeftOver.m_faceCount = 0;
builderLeftOver.m_indexCount = 0;
builderLeftOver.m_vertexCount = 0;
builder.OptimizeByGroupID(builderAux, 0, 0, builderLeftOver);
if (prevFaceCount == builderLeftOver.m_faceCount)
{
break;
}
}
_ASSERTE(builderLeftOver.m_faceCount == 0);
}
polygonIndex += m_faceVertexCount[i];
}
// builder.End();
builder.Optimize(false);
m_faceVertexCount[builder.m_faceCount] = 0;
m_vertexIndex[builder.m_indexCount] = 0;
m_vertexPoints[builder.m_vertexCount].m_x = dgFloat32(0.0f);
memcpy(&m_faceVertexCount[0], &builder.m_faceVertexCount[0],
sizeof(dgInt32) * builder.m_faceCount);
memcpy(&m_vertexIndex[0], &builder.m_vertexIndex[0],
sizeof(dgInt32) * builder.m_indexCount);
memcpy(&m_vertexPoints[0], &builder.m_vertexPoints[0],
sizeof(dgBigVector) * builder.m_vertexCount);
m_faceCount = builder.m_faceCount;
m_indexCount = builder.m_indexCount;
m_vertexCount = builder.m_vertexCount;
m_normalCount = builder.m_normalCount;
}
开发者ID:Evil-Spirit,项目名称:Nutmeg,代码行数:70,代码来源:dgPolygonSoupBuilder.cpp
示例6: fStroke
GrStencilAndCoverTextContext::TextRun::TextRun(const SkPaint& fontAndStroke)
: fStroke(fontAndStroke),
fFont(fontAndStroke),
fTotalGlyphCount(0),
fFallbackGlyphCount(0),
fDetachedGlyphCache(nullptr),
fLastDrawnGlyphsID(SK_InvalidUniqueID) {
SkASSERT(!fStroke.isHairlineStyle()); // Hairlines are not supported.
// Setting to "fill" ensures that no strokes get baked into font outlines. (We use the GPU path
// rendering API for stroking).
fFont.setStyle(SkPaint::kFill_Style);
if (fFont.isFakeBoldText() && SkStrokeRec::kStroke_Style != fStroke.getStyle()) {
// Instead of letting fake bold get baked into the glyph outlines, do it with GPU stroke.
SkScalar fakeBoldScale = SkScalarInterpFunc(fFont.getTextSize(),
kStdFakeBoldInterpKeys,
kStdFakeBoldInterpValues,
kStdFakeBoldInterpLength);
SkScalar extra = SkScalarMul(fFont.getTextSize(), fakeBoldScale);
fStroke.setStrokeStyle(fStroke.needToApply() ? fStroke.getWidth() + extra : extra,
true /*strokeAndFill*/);
fFont.setFakeBoldText(false);
}
if (!fFont.getPathEffect() && !fStroke.isDashed()) {
// We can draw the glyphs from canonically sized paths.
fTextRatio = fFont.getTextSize() / SkPaint::kCanonicalTextSizeForPaths;
fTextInverseRatio = SkPaint::kCanonicalTextSizeForPaths / fFont.getTextSize();
// Compensate for the glyphs being scaled by fTextRatio.
if (!fStroke.isFillStyle()) {
fStroke.setStrokeStyle(fStroke.getWidth() / fTextRatio,
SkStrokeRec::kStrokeAndFill_Style == fStroke.getStyle());
}
fFont.setLinearText(true);
fFont.setLCDRenderText(false);
fFont.setAutohinted(false);
fFont.setHinting(SkPaint::kNo_Hinting);
fFont.setSubpixelText(true);
fFont.setTextSize(SkIntToScalar(SkPaint::kCanonicalTextSizeForPaths));
fUsingRawGlyphPaths = SK_Scalar1 == fFont.getTextScaleX() &&
0 == fFont.getTextSkewX() &&
!fFont.isFakeBoldText() &&
!fFont.isVerticalText();
} else {
fTextRatio = fTextInverseRatio = 1.0f;
fUsingRawGlyphPaths = false;
}
// Generate the key that will be used to cache the GPU glyph path objects.
if (fUsingRawGlyphPaths && fStroke.isFillStyle()) {
static const GrUniqueKey::Domain kRawFillPathGlyphDomain = GrUniqueKey::GenerateDomain();
const SkTypeface* typeface = fFont.getTypeface();
GrUniqueKey::Builder builder(&fGlyphPathsKey, kRawFillPathGlyphDomain, 1);
reinterpret_cast<uint32_t&>(builder[0]) = typeface ? typeface->uniqueID() : 0;
} else {
static const GrUniqueKey::Domain kPathGlyphDomain = GrUniqueKey::GenerateDomain();
int strokeDataCount = fStroke.computeUniqueKeyFragmentData32Cnt();
if (fUsingRawGlyphPaths) {
const SkTypeface* typeface = fFont.getTypeface();
GrUniqueKey::Builder builder(&fGlyphPathsKey, kPathGlyphDomain, 2 + strokeDataCount);
reinterpret_cast<uint32_t&>(builder[0]) = typeface ? typeface->uniqueID() : 0;
reinterpret_cast<uint32_t&>(builder[1]) = strokeDataCount;
fStroke.asUniqueKeyFragment(&builder[2]);
} else {
SkGlyphCache* glyphCache = this->getGlyphCache();
const SkTypeface* typeface = glyphCache->getScalerContext()->getTypeface();
const SkDescriptor* desc = &glyphCache->getDescriptor();
int descDataCount = (desc->getLength() + 3) / 4;
GrUniqueKey::Builder builder(&fGlyphPathsKey, kPathGlyphDomain,
2 + strokeDataCount + descDataCount);
reinterpret_cast<uint32_t&>(builder[0]) = typeface ? typeface->uniqueID() : 0;
reinterpret_cast<uint32_t&>(builder[1]) = strokeDataCount | (descDataCount << 16);
fStroke.asUniqueKeyFragment(&builder[2]);
memcpy(&builder[2 + strokeDataCount], desc, desc->getLength());
}
}
}
开发者ID:kekekeks,项目名称:skia,代码行数:84,代码来源:GrStencilAndCoverTextContext.cpp
示例7: builder
bool
GlueMapWindow::ShowMapItems(const GeoPoint &location,
bool show_empty_message) const
{
/* not using MapWindowBlackboard here because this method is called
by the main thread */
const ComputerSettings &computer_settings =
CommonInterface::GetComputerSettings();
const MapSettings &settings = CommonInterface::GetMapSettings();
const MoreData &basic = CommonInterface::Basic();
const DerivedInfo &calculated = CommonInterface::Calculated();
auto range = visible_projection.DistancePixelsToMeters(Layout::GetHitRadius());
MapItemList list;
MapItemListBuilder builder(list, location, range);
if (settings.item_list.add_location)
builder.AddLocation(basic, terrain);
if (settings.item_list.add_arrival_altitude && route_planner)
builder.AddArrivalAltitudes(*route_planner, terrain,
computer_settings.task.safety_height_arrival);
if (basic.location_available)
builder.AddSelfIfNear(basic.location, basic.attitude.heading);
if (task)
builder.AddTaskOZs(*task);
const Airspaces *airspace_database = airspace_renderer.GetAirspaces();
if (airspace_database)
builder.AddVisibleAirspace(*airspace_database,
airspace_renderer.GetWarningManager(),
computer_settings.airspace,
settings.airspace, basic,
calculated);
if (visible_projection.GetMapScale() <= 4000)
builder.AddThermals(calculated.thermal_locator, basic, calculated);
if (waypoints)
builder.AddWaypoints(*waypoints);
#ifdef HAVE_NOAA
if (noaa_store)
builder.AddWeatherStations(*noaa_store);
#endif
builder.AddTraffic(basic.flarm.traffic);
#ifdef HAVE_SKYLINES_TRACKING_HANDLER
builder.AddSkyLinesTraffic();
#endif
// Sort the list of map items
list.Sort();
// Show the list dialog
if (list.empty()) {
if (show_empty_message)
ShowMessageBox(_("There is nothing interesting near this location."),
_("Map elements at this location"), MB_OK | MB_ICONINFORMATION);
return false;
}
ShowMapItemListDialog(list,
UIGlobals::GetDialogLook(), look, traffic_look,
final_glide_bar_renderer.GetLook(), settings,
glide_computer != nullptr
? &glide_computer->GetAirspaceWarnings() : nullptr);
return true;
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:74,代码来源:GlueMapWindowItems.cpp
示例8: builder
void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
{
ObjectGuid const& good = player->GetGUID();
if (!IsOn(good))
{
NotMemberAppend appender;
ChannelNameBuilder<NotMemberAppend> builder(this, appender);
SendToOne(builder, good);
return;
}
PlayerInfo& info = _playersStore.at(good);
if (!info.IsModerator() && !player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
{
NotModeratorAppend appender;
ChannelNameBuilder<NotModeratorAppend> builder(this, appender);
SendToOne(builder, good);
return;
}
Player* bad = ObjectAccessor::FindConnectedPlayerByName(badname);
ObjectGuid const& victim = bad ? bad->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim))
{
PlayerNotFoundAppend appender(badname);
ChannelNameBuilder<PlayerNotFoundAppend> builder(this, appender);
SendToOne(builder, good);
return;
}
bool changeowner = _ownerGuid == victim;
if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR) && changeowner && good != _ownerGuid)
{
NotOwnerAppend appender;
ChannelNameBuilder<NotOwnerAppend> builder(this, appender);
SendToOne(builder, good);
return;
}
if (ban && !IsBanned(victim))
{
_bannedStore.insert(victim);
UpdateChannelInDB();
if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
{
PlayerBannedAppend appender(good, victim);
ChannelNameBuilder<PlayerBannedAppend> builder(this, appender);
SendToAll(builder);
}
}
else if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
{
PlayerKickedAppend appender(good, victim);
ChannelNameBuilder<PlayerKickedAppend> builder(this, appender);
SendToAll(builder);
}
_playersStore.erase(victim);
bad->LeftChannel(this);
if (changeowner && _ownershipEnabled && !_playersStore.empty())
{
info.SetModerator(true);
SetOwner(good);
}
}
开发者ID:Lyill,项目名称:TrinityCore,代码行数:69,代码来源:Channel.cpp
示例9: toInt
void EMailImapService::generateBundle(vmime::ref<vmime::net::message> &msg)
{
// Create new Bundle
dtn::data::Bundle newBundle;
// Clear all blocks
newBundle.clear();
// Get header of mail
vmime::ref<const vmime::header> header = msg->getHeader();
std::string mailID = " (ID: " + msg->getUniqueId() + ")";
// Check EMailCL version
try {
int version = toInt(header->findField("Bundle-EMailCL-Version")->getValue()->generate());
if(version != 1)
throw IMAPException("Wrong EMailCL version found in mail" + mailID);
}catch(vmime::exceptions::no_such_field&) {
throw IMAPException("Field \"Bundle-EMailCL-Version\" not found in mail" + mailID);
}catch(InvalidConversion&) {
throw IMAPException("Field \"Bundle-EMailCL-Version\" wrong formatted in mail" + mailID);
}
try {
newBundle.procflags = toInt(header->findField("Bundle-Flags")->getValue()->generate());
newBundle.destination = header->findField("Bundle-Destination")->getValue()->generate();
newBundle.source = dtn::data::EID(header->findField("Bundle-Source")->getValue()->generate());
newBundle.reportto = header->findField("Bundle-Report-To")->getValue()->generate();
newBundle.custodian = header->findField("Bundle-Custodian")->getValue()->generate();
newBundle.timestamp = toInt(header->findField("Bundle-Creation-Time")->getValue()->generate());
newBundle.sequencenumber = toInt(header->findField("Bundle-Sequence-Number")->getValue()->generate());
newBundle.lifetime = toInt(header->findField("Bundle-Lifetime")->getValue()->generate());
}catch(vmime::exceptions::no_such_field&) {
throw IMAPException("Missing bundle headers in mail" + mailID);
}catch(InvalidConversion&) {
throw IMAPException("Wrong formatted bundle headers in mail" + mailID);
}
// If bundle is a fragment both fields need to be set
try {
newBundle.fragmentoffset = toInt(header->findField("Bundle-Fragment-Offset")->getValue()->generate());
newBundle.appdatalength = toInt(header->findField("Bundle-Total-Application-Data-Unit-Length")->getValue()->generate());
}catch(vmime::exceptions::no_such_field&) {
newBundle.fragmentoffset = 0;
newBundle.appdatalength = 0;
}catch(InvalidConversion&) {
throw IMAPException("Wrong formatted fragment offset in mail" + mailID);
}
//Check if bundle is already in the storage
try {
if(dtn::core::BundleCore::getInstance().getRouter().isKnown(newBundle))
throw IMAPException("Bundle in mail" + mailID + " already processed");
} catch (dtn::storage::NoBundleFoundException&) {
// Go ahead
}
// Validate the primary block
try {
dtn::core::BundleCore::getInstance().validate((dtn::data::PrimaryBlock)newBundle);
}catch(dtn::data::Validator::RejectedException&) {
throw IMAPException("Bundle in mail" + mailID + " was rejected by validator");
}
// Get names of additional blocks
std::vector<vmime::ref<vmime::headerField> > additionalBlocks =
header.constCast<vmime::header>()->findAllFields("Bundle-Additional-Block");
std::vector<std::string> additionalBlockNames;
for(std::vector<vmime::ref<vmime::headerField> >::iterator it = additionalBlocks.begin();
it != additionalBlocks.end(); ++it)
{
additionalBlockNames.push_back((*it)->getValue()->generate());
}
// Get all attachments
std::vector<vmime::ref<const vmime::attachment> > attachments =
vmime::attachmentHelper::findAttachmentsInMessage(msg->getParsedMessage());
// Extract payload block info
size_t payloadFlags;
std::string payloadName;
try {
payloadFlags = toInt(header->findField("Bundle-Payload-Flags")->getValue()->generate());
// Payload length will be calculated automatically
//length = toInt(header->findField("Bundle-Payload-Block-Length")->getValue()->generate());
payloadName = header->findField("Bundle-Payload-Data-Name")->getValue()->generate();
}catch(vmime::exceptions::no_such_field&) {
// No payload block there
}catch(InvalidConversion&) {
throw IMAPException("Wrong formatted payload flags in mail" + mailID);
}
// Create new bundle builder
dtn::data::BundleBuilder builder(newBundle);
// Download attachments
for(std::vector<vmime::ref<const vmime::attachment> >::iterator it = attachments.begin(); it != attachments.end(); ++it)
{
if((*it)->getName().getBuffer() == payloadName && !payloadName.empty()) {
//.........这里部分代码省略.........
开发者ID:auzias,项目名称:ibrdtn,代码行数:101,代码来源:EMailImapService.cpp
示例10: appender
void Channel::JoinChannel(Player* player, std::string const& pass)
{
ObjectGuid const& guid = player->GetGUID();
if (IsOn(guid))
{
// Do not send error message for built-in channels
if (!IsConstant())
{
PlayerAlreadyMemberAppend appender(guid);
ChannelNameBuilder<PlayerAlreadyMemberAppend> builder(this, appender);
SendToOne(builder, guid);
}
return;
}
if (IsBanned(guid))
{
BannedAppend appender;
ChannelNameBuilder<BannedAppend> builder(this, appender);
SendToOne(builder, guid);
return;
}
if (!_channelPassword.empty() && pass != _channelPassword)
{
WrongPasswordAppend appender;
ChannelNameBuilder<WrongPasswordAppend> builder(this, appender);
SendToOne(builder, guid);
return;
}
if (HasFlag(CHANNEL_FLAG_LFG) &&
sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) &&
AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && //FIXME: Move to RBAC
player->GetGroup())
{
NotInLFGAppend appender;
ChannelNameBuilder<NotInLFGAppend> builder(this, appender);
SendToOne(builder, guid);
return;
}
player->JoinedChannel(this);
if (_announceEnabled && !player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
{
JoinedAppend appender(guid);
ChannelNameBuilder<JoinedAppend> builder(this, appender);
SendToAll(builder);
}
bool newChannel = _playersStore.empty();
PlayerInfo& playerInfo = _playersStore[guid];
playerInfo.SetInvisible(!player->isGMVisible());
/*
YouJoinedAppend appender;
ChannelNameBuilder<YouJoinedAppend> builder(this, appender);
SendToOne(builder, guid);
*/
auto builder = [&](LocaleConstant /*locale*/)
{
WorldPackets::Channel::ChannelNotifyJoined* notify = new WorldPackets::Channel::ChannelNotifyJoined();
//notify->ChannelWelcomeMsg = "";
notify->ChatChannelID = _channelId;
//notify->InstanceID = 0;
notify->_ChannelFlags = _channelFlags;
notify->_Channel = _channelName;
return notify;
};
SendToOne(builder, guid);
JoinNotify(player);
// Custom channel handling
if (!IsConstant())
{
// Update last_used timestamp in db
if (!_playersStore.empty())
UpdateChannelUseageInDB();
// If the channel has no owner yet and ownership is allowed, set the new owner.
// or if the owner was a GM with .gm visible off
// don't do this if the new player is, too, an invis GM, unless the channel was empty
if (_ownershipEnabled && (newChannel || !playerInfo.IsInvisible()) && (_ownerGuid.IsEmpty() || _isOwnerInvisible))
{
_isOwnerInvisible = playerInfo.IsInvisible();
SetOwner(guid, !newChannel && !_isOwnerInvisible);
playerInfo.SetModerator(true);
}
}
}
开发者ID:Lyill,项目名称:TrinityCore,代码行数:96,代码来源:Channel.cpp
示例11: leftIter
void Joiner::Worker::doRun() {
LayerTagManager& tagManager = lattice_.getLayerTagManager();
LayerTagMask leftMask = tagManager.getAlternativeMaskFromTagNames(
processor_.leftMaskSpecification_);
LayerTagMask rightMask = tagManager.getAlternativeMaskFromTagNames(
processor_.rightMaskSpecification_);
lattice_.addTagMaskIndex_(leftMask);
lattice_.addTagMaskIndex_(rightMask);
LayerTagCollection providedTags = tagManager.createTagCollection(
processor_.outTags_);
LayerTagCollection providedTagsPlane = tagManager.onlyPlaneTags(providedTags);
Lattice::EdgesSortedBySourceIterator leftIter(lattice_, leftMask);
while (leftIter.hasNext()) {
Lattice::EdgeDescriptor edge = leftIter.next();
boost::optional<Lattice::EdgeDescriptor> parent = lattice_.getParent(edge);
bool foundRightEdge = false;
if (parent) {
std::vector<Lattice::EdgeDescriptor> rightEdges =
lattice_.getChildren(*parent, rightMask);
BOOST_FOREACH(Lattice::EdgeDescriptor rightEdge, rightEdges) {
foundRightEdge = true;
std::string category =
lattice_.getAnnotationCategory(
processor_.takeLeftCategory_ ? edge : rightEdge);
std::string text =
lattice_.getAnnotationText(
processor_.takeLeftText_ ? edge : rightEdge);
AnnotationItem attrsSource
= lattice_.getEdgeAnnotationItem(
(processor_.handlingAttributes_ ==
TAKE_RIGHT_ATTRIBUTES)
? rightEdge
: edge);
AnnotationItem annotationItem(
attrsSource, category, StringFrag(text));
if (processor_.handlingAttributes_ ==
MERGE_ATTRIBUTES) {
lattice_.getAnnotationItemManager().addValues(
annotationItem,
lattice_.getEdgeAnnotationItem(rightEdge));
}
Lattice::EdgeSequence::Builder builder(lattice_);
builder.addEdge(edge);
builder.addEdge(rightEdge);
Lattice::VertexDescriptor fromVertex = lattice_.getEdgeSource(edge);
Lattice::VertexDescriptor toVertex = lattice_.getEdgeTarget(edge);
lattice_.addEdge(
fromVertex,
toVertex,
annotationItem,
providedTags,
builder.build());
}
}
if (processor_.extendedOuterJoin_ || (!foundRightEdge && processor_.outerJoin_)) {
LayerTagCollection edgePlane = tagManager.onlyPlaneTags(
lattice_.getEdgeLayerTags(edge));
// if this is the same plane, we have to avoid circular
// references
if (providedTagsPlane == edgePlane)
lattice_.addPartitionToEdge(
edge,
providedTags);
else {
Lattice::EdgeSequence::Builder builder(lattice_);
builder.addEdge(edge);
Lattice::VertexDescriptor fromVertex = lattice_.getEdgeSource(edge);
Lattice::VertexDescriptor toVertex = lattice_.getEdgeTarget(edge);
lattice_.addEdge(
fromVertex,
toVertex,
lattice_.getEdgeAnnotationItem(edge),
providedTags,
builder.build());
}
}
}
开发者ID:jgonz0010,项目名称:psi-toolkit,代码行数:99,代码来源:joiner.cpp
示例12: FixWinding
bool FixWinding(SkPath* path) {
SkPath::FillType fillType = path->getFillType();
if (fillType == SkPath::kInverseEvenOdd_FillType) {
fillType = SkPath::kInverseWinding_FillType;
} else if (fillType == SkPath::kEvenOdd_FillType) {
fillType = SkPath::kWinding_FillType;
}
SkPathPriv::FirstDirection dir;
if (one_contour(*path) && SkPathPriv::CheapComputeFirstDirection(*path, &dir)) {
if (dir != SkPathPriv::kCCW_FirstDirection) {
SkPath temp;
temp.reverseAddPath(*path);
*path = temp;
}
path->setFillType(fillType);
return true;
}
SkChunkAlloc allocator(4096);
SkOpContourHead contourHead;
SkOpGlobalState globalState(nullptr, &contourHead SkDEBUGPARAMS(false)
SkDEBUGPARAMS(nullptr));
SkOpEdgeBuilder builder(*path, &contourHead, &allocator, &globalState);
builder.finish(&allocator);
if (!contourHead.next()) {
return false;
}
contourHead.resetReverse();
bool writePath = false;
SkOpSpan* topSpan;
globalState.setPhase(SkOpGlobalState::kFixWinding);
while ((topSpan = FindSortableTop(&contourHead))) {
SkOpSegment* topSegment = topSpan->segment();
SkOpContour* topContour = topSegment->contour();
SkASSERT(topContour->isCcw() >= 0);
#if DEBUG_WINDING
SkDebugf("%s id=%d nested=%d ccw=%d\n", __FUNCTION__,
topSegment->debugID(), globalState.nested(), topContour->isCcw());
#endif
if ((globalState.nested() & 1) != SkToBool(topContour->isCcw())) {
topContour->setReverse();
writePath = true;
}
topContour->markDone();
globalState.clearNested();
}
if (!writePath) {
path->setFillType(fillType);
return true;
}
SkPath empty;
SkPathWriter woundPath(empty);
SkOpContour* test = &contourHead;
do {
if (test->reversed()) {
test->toReversePath(&woundPath);
} else {
test->toPath(&woundPath);
}
} while ((test = test->next()));
*path = *woundPath.nativePath();
path->setFillType(fillType);
return true;
}
开发者ID:OwenTan,项目名称:skia,代码行数:63,代码来源:SkOpBuilder.cpp
示例13: Assemble
/*
check start and end of each contour
if not the same, record them
match them up
connect closest
reassemble contour pieces into new path
*/
void Assemble(const SkPathWriter& path, SkPathWriter* simple) {
#if DEBUG_PATH_CONSTRUCTION
SkDebugf("%s\n", __FUNCTION__);
#endif
SkTArray<SkOpContour> contours;
SkOpEdgeBuilder builder(path, contours);
builder.finish();
int count = contours.count();
int outer;
SkTArray<int, true> runs(count); // indices of partial contours
for (outer = 0; outer < count; ++outer) {
const SkOpContour& eContour = contours[outer];
const SkPoint& eStart = eContour.start();
const SkPoint& eEnd = eContour.end();
#if DEBUG_ASSEMBLE
SkDebugf("%s contour", __FUNCTION__);
if (!approximatelyEqual(eStart, eEnd)) {
SkDebugf("[%d]", runs.count());
} else {
SkDebugf(" ");
}
SkDebugf(" start=(%1.9g,%1.9g) end=(%1.9g,%1.9g)\n",
eStart.fX, eStart.fY, eEnd.fX, eEnd.fY);
#endif
if (approximatelyEqual(eStart, eEnd)) {
eContour.toPath(simple);
continue;
}
runs.push_back(outer);
}
count = runs.count();
if (count == 0) {
return;
}
SkTArray<int, true> sLink, eLink;
sLink.push_back_n(count);
eLink.push_back_n(count);
int rIndex, iIndex;
for (rIndex = 0; rIndex < count; ++rIndex) {
sLink[rIndex] = eLink[rIndex] = SK_MaxS32;
}
const int ends = count * 2; // all starts and ends
const int entries = (ends - 1) * count; // folded triangle : n * (n - 1) / 2
SkTArray<double, true> distances;
distances.push_back_n(entries);
for (rIndex = 0; rIndex < ends - 1; ++rIndex) {
outer = runs[rIndex >> 1];
const SkOpContour& oContour = contours[outer];
const SkPoint& oPt = rIndex & 1 ? oContour.end() : oContour.start();
const int row = rIndex < count - 1 ? rIndex * ends : (ends - rIndex - 2)
* ends - rIndex - 1;
for (iIndex = rIndex + 1; iIndex < ends; ++iIndex) {
int inner = runs[iIndex >> 1];
const SkOpContour& iContour = contours[inner];
const SkPoint& iPt = iIndex & 1 ? iContour.end() : iContour.start();
double dx = iPt.fX - oPt.fX;
double dy = iPt.fY - oPt.fY;
double dist = dx * dx + dy * dy;
distances[row + iIndex] = dist; // oStart distance from iStart
}
}
SkTArray<int, true> sortedDist;
sortedDist.push_back_n(entries);
for (rIndex = 0; rIndex < entries; ++rIndex) {
sortedDist[rIndex] = rIndex;
}
SkTQSort<int>(sortedDist.begin(), sortedDist.end() - 1, DistanceLessThan(distances.begin()));
int remaining = count; // number of start/end pairs
for (rIndex = 0; rIndex < entries; ++rIndex) {
int pair = sortedDist[rIndex];
int row = pair / ends;
int col = pair - row * ends;
int thingOne = row < col ? row : ends - row - 2;
int ndxOne = thingOne >> 1;
bool endOne = thingOne & 1;
int* linkOne = endOne ? eLink.begin() : sLink.begin();
if (linkOne[ndxOne] != SK_MaxS32) {
continue;
}
int thingTwo = row < col ? col : ends - row + col - 1;
int ndxTwo = thingTwo >> 1;
bool endTwo = thingTwo & 1;
int* linkTwo = endTwo ? eLink.begin() : sLink.begin();
if (linkTwo[ndxTwo] != SK_MaxS32) {
continue;
}
SkASSERT(&linkOne[ndxOne] != &linkTwo[ndxTwo]);
bool flip = endOne == endTwo;
linkOne[ndxOne] = flip ? ~ndxTwo : ndxTwo;
linkTwo[ndxTwo] = flip ? ~ndxOne : ndxOne;
if (!--remaining) {
break;
}
//.........这里部分代码省略.........
开发者ID:shuowen,项目名称:kalpa,代码行数:101,代码来源:SkPathOpsCommon.cpp
示例14: builder
void DolphinAnalytics::MakePerGameBuilder()
{
Common::AnalyticsReportBuilder builder(m_base_builder);
// Gameid.
builder.AddData("gameid", SConfig::GetInstance().GetGameID());
// Unique id bound to the gameid.
builder.AddData("id", MakeUniqueId(SConfig::GetInstance().GetGameID()));
// Configuration.
builder.AddData("cfg-dsp-hle", SConfig::GetInstance().bDSPHLE);
builder.AddData("cfg-dsp-jit", SConfig::GetInstance().m_DSPEnableJIT);
builder.AddData("cfg-dsp-thread", SConfig::GetInstance().bDSPThread);
builder.AddData("cfg-cpu-thread", SConfig::GetInstance().bCPUThread);
builder.AddData("cfg-fastmem", SConfig::GetInstance().bFastmem);
builder.AddData("cfg-syncgpu", SConfig::GetInstance().bSyncGPU);
builder.AddData("cfg-audio-backend", SConfig::GetInstance().sBackend);
builder.AddData("cfg-oc-enable", SConfig::GetInstance().m_OCEnable);
builder.AddData("cfg-oc-factor", SConfig::GetInstance().m_OCFactor);
builder.AddData("cfg-render-to-main", SConfig::GetInstance().bRenderToMain);
if (g_video_backend)
{
builder.AddData("cfg-video-backend", g_video_backend->GetName());
}
// Video configuration.
builder.AddData("cfg-gfx-multisamples", g_Config.iMultisamples);
builder.AddData("cfg-gfx-ssaa", g_Config.bSSAA);
builder.AddData("cfg-gfx-anisotropy", g_Config.iMaxAnisotropy);
builder.AddData("cfg-gfx-vsync", g_Config.bVSync);
builder.AddData("cfg-gfx-aspect-ratio", static_cast<int>(g_Config.aspect_mode));
builder.AddData("cfg-gfx-efb-access", g_Config.bEFBAccessEnable);
builder.AddData("cfg-gfx-efb-copy-format-changes", g_Config.bEFBEmulateFormatChanges);
builder.AddData("cfg-gfx-efb-copy-ram", !g_Config.bSkipEFBCopyToRam);
builder.AddData("cfg-gfx-xfb-copy-ram", !g_Config.bSkipXFBCopyToRam);
builder.AddData("cfg-gfx-immediate-xfb", !g_Config.bImmediateXFB);
builder.AddData("cfg-gfx-efb-copy-scaled", g_Config.bCopyEFBScaled);
builder.AddData("cfg-gfx-internal-resolution", g_Config.iEFBScale);
builder.AddData("cfg-gfx-tc-samples", g_Config.iSafeTextureCache_ColorSamples);
builder.AddData("cfg-gfx-stereo-mode", static_cast<int>(g_Config.stereo_mode));
builder.AddData("cfg-gfx-per-pixel-lighting", g_Config.bEnablePixelLighting);
builder.AddData("cfg-gfx-shader-compilation-mode", GetShaderCompilationMode(g_Config));
builder.AddData("cfg-gfx-wait-for-shaders", g_Config.bWaitForShadersBeforeStarting);
builder.AddData("cfg-gfx-fast-depth", g_Config.bFastDepthCalc);
builder.AddData("cfg-gfx-vertex-rounding", g_Config.UseVertexRounding());
// GPU features.
if (g_Config.iAdapter < static_cast<int>(g_Config.backend_info.Adapters.size()))
{
builder.AddData("gpu-adapter", g_Config.backend_info.Adapters[g_Config.iAdapter]);
}
else if (!g_Config.backend_info.AdapterName.empty())
{
builder.AddData("gpu-adapter", g_Config.backend_info.AdapterName);
}
builder.AddData("gpu-has-exclusive-fullscreen",
g_Config.backend_info.bSupportsExclusiveFullscreen);
builder.AddData("gpu-has-dual-source-blend", g_Config.backend_info.bSupportsDualSourceBlend);
builder.AddData("gpu-has-primitive-restart", g_Config.backend_info.bSupportsPrimitiveRestart);
builder.AddData("gpu-has-oversized-viewports", g_Config.backend_info.bSupportsOversizedViewports);
builder.AddData("gpu-has-geometry-shaders", g_Config.backend_info.bSupportsGeometryShaders);
builder.AddData("gpu-has-3d-vision", g_Config.backend_info.bSupports3DVision);
builder.AddData("gpu-has-early-z", g_Config.backend_info.bSupportsEarlyZ);
builder.AddData("gpu-has-binding-layout", g_Config.backend_info.bSupportsBindingLayout);
builder.AddData("gpu-has-bbox", g_Config.backend_info.bSupportsBBox);
builder.AddData("gpu-has-fragment-stores-and-atomics",
g_Config.backend_info.bSupportsFragmentStoresAndAtomics);
builder.AddData("gpu-has-gs-instancing", g_Config.backend_info.bSupportsGSInstancing);
builder.AddData("gpu-has-post-processing", g_Config.backend_info.bSupportsPostProcessing);
builder.AddData("gpu-has-palette-conversion", g_Config.backend_info.bSupportsPaletteConversion);
builder.AddData("gpu-has-clip-control", g_Config.backend_info.bSupportsClipControl);
builder.AddData("gpu-has-ssaa", g_Config.backend_info.bSupportsSSAA);
// NetPlay / recording.
builder.AddData("netplay", NetPlay::IsNetPlayRunning());
builder.AddData("movie", Movie::IsMovieActive());
// Controller information
// We grab enough to tell what percentage of our users are playing with keyboard/mouse, some kind
// of gamepad
// or the official gamecube adapter.
builder.AddData("gcadapter-detected", GCAdapter::IsDetected());
builder.AddData("has-controller", Pad::GetConfig()->IsControllerControlledByGamepadDevice(0) ||
GCAdapter::IsDetected());
m_per_game_builder = builder;
}
开发者ID:leoetlino,项目名称:dolphin,代码行数:88,代码来源:Analytics.cpp
示例15: reader
void MPIWorkerMaster::run()
{
Profiler::getInstance().setEnabled(true);
CriticalDegree degree;
//FlightDataReader reader("c:\\basic1.txt");
FlightDataReader reader("c:\\basic2.txt");
//FlightDataReader reader("c:\\big1.txt");
//FlightDataReader reader("c:\\big2.txt");
echo(MakeString() << "Load data... (" << reader.getFileName() << ")");
reader.open();
reader.readHeader();
Profiler::getInstance().start("1. Read flights data");
// 1. Read flights data
std::vector<
|
请发表评论