Пример #1
0
    intrusive_ptr<DocumentSource> DocumentSourceGroup::createFromBson(
        BSONElement *pBsonElement,
        const intrusive_ptr<ExpressionContext> &pExpCtx) {
        uassert(15947, "a group's fields must be specified in an object",
                pBsonElement->type() == Object);

        intrusive_ptr<DocumentSourceGroup> pGroup(
            DocumentSourceGroup::create(pExpCtx));
        bool idSet = false;

        BSONObj groupObj(pBsonElement->Obj());
        BSONObjIterator groupIterator(groupObj);
        while(groupIterator.more()) {
            BSONElement groupField(groupIterator.next());
            const char *pFieldName = groupField.fieldName();

            if (str::equals(pFieldName, "_id")) {
                uassert(15948, "a group's _id may only be specified once",
                        !idSet);

                BSONType groupType = groupField.type();

                if (groupType == Object) {
                    /*
                      Use the projection-like set of field paths to create the
                      group-by key.
                    */
                    Expression::ObjectCtx oCtx(Expression::ObjectCtx::DOCUMENT_OK);
                    intrusive_ptr<Expression> pId(
                        Expression::parseObject(&groupField, &oCtx));

                    pGroup->setIdExpression(pId);
                    idSet = true;
                }
                else if (groupType == String) {
                    const string groupString = groupField.str();
                    if (!groupString.empty() && groupString[0] == '$') {
                        pGroup->setIdExpression(ExpressionFieldPath::parse(groupString));
                        idSet = true;
                    }
                }

                if (!idSet) {
                    // constant id - single group
                    pGroup->setIdExpression(ExpressionConstant::create(Value(groupField)));
                    idSet = true;
                }
            }
            else {
                /*
                  Treat as a projection field with the additional ability to
                  add aggregation operators.
                */
                uassert(16414, str::stream() <<
                        "the group aggregate field name '" << pFieldName <<
                        "' cannot be used because $group's field names cannot contain '.'",
                        !str::contains(pFieldName, '.') );

                uassert(15950, str::stream() <<
                        "the group aggregate field name '" <<
                        pFieldName << "' cannot be an operator name",
                        pFieldName[0] != '$');

                uassert(15951, str::stream() <<
                        "the group aggregate field '" << pFieldName <<
                        "' must be defined as an expression inside an object",
                        groupField.type() == Object);

                BSONObj subField(groupField.Obj());
                BSONObjIterator subIterator(subField);
                size_t subCount = 0;
                for(; subIterator.more(); ++subCount) {
                    BSONElement subElement(subIterator.next());

                    /* look for the specified operator */
                    GroupOpDesc key;
                    key.name = subElement.fieldName();
                    const GroupOpDesc *pOp =
                        (const GroupOpDesc *)bsearch(
                              &key, GroupOpTable, NGroupOp, sizeof(GroupOpDesc),
                                      GroupOpDescCmp);

                    uassert(15952, str::stream() << "unknown group operator '" << key.name << "'",
                            pOp);

                    intrusive_ptr<Expression> pGroupExpr;

                    BSONType elementType = subElement.type();
                    if (elementType == Object) {
                        Expression::ObjectCtx oCtx(
                            Expression::ObjectCtx::DOCUMENT_OK);
                        pGroupExpr = Expression::parseObject(
                            &subElement, &oCtx);
                    }
                    else if (elementType == Array) {
                        uasserted(15953, str::stream()
                                << "aggregating group operators are unary (" << key.name << ")");
                    }
                    else { /* assume its an atomic single operand */
                        pGroupExpr = Expression::parseOperand(&subElement);
                    }

                    pGroup->addAccumulator(pFieldName, pOp->factory, pGroupExpr);
                }

                uassert(15954, str::stream() <<
                        "the computed aggregate '" <<
                        pFieldName << "' must specify exactly one operator",
                        subCount == 1);
            }
        }

        uassert(15955, "a group specification must include an _id", idSet);

        return pGroup;
    }
void AGameplayDebuggerReplicator::TickActor(float DeltaTime, enum ELevelTick TickType, FActorTickFunction& ThisTickFunction)
{
	Super::TickActor(DeltaTime, TickType, ThisTickFunction);

#if ENABLED_GAMEPLAY_DEBUGGER
	UWorld* World = GetWorld();
	const ENetMode NetMode = GetNetMode();
	if (!World)
	{
		// return without world
		return;
	}

	UGameInstance* GameInstance = World->GetGameInstance();
	if (!GameInstance || !World->IsGameWorld())
	{
		return;
	}

	if (NetMode != NM_DedicatedServer)
	{
		if (bActivationKeyPressed)
		{
			ActivationKeyTime += DeltaTime;
			if (ActivationKeyTime >= GameplayDebuggerHelpers::ActivationKeyTimePch)
			{
				GEngine->bEnableOnScreenDebugMessages = false;
				if (AHUD* const GameHUD = LocalPlayerOwner ? LocalPlayerOwner->GetHUD() : nullptr)
				{
					GameHUD->bShowHUD = false;
				}
				BindKeyboardInput(InputComponent);

				ServerActivateGameplayDebugger(true);
				ClientActivateGameplayDebugger(true);
				bActivationKeyPressed = false;
			}
		}

		if (bEnabledTargetSelection)
		{
			if (GetLocalPlayerOwner())
			{
				SelectTargetToDebug();
			}
		}

		bool bMarkComponentsAsRenderStateDirty = false;
		for (UGameplayDebuggerBaseObject* Obj : ReplicatedObjects)
		{
			if (Obj && Obj->IsRenderStateDirty())
			{
				if (!bMarkComponentsAsRenderStateDirty)
				{
					MarkComponentsRenderStateDirty();
				}
				bMarkComponentsAsRenderStateDirty = true;
				Obj->CleanRenderStateDirtyFlag();
			}
		}
	}

	if (NetMode < NM_Client && LocalPlayerOwner)
	{
		TMap<FString, TArray<UGameplayDebuggerBaseObject*> > CategoryToClasses;
		for (UGameplayDebuggerBaseObject* Obj : ReplicatedObjects)
		{
			if (Obj)
			{
				FString Category = Obj->GetCategoryName();
				if (IsCategoryEnabled(Category))
				{
					CategoryToClasses.FindOrAdd(Category).Add(Obj);
				}
			}
		}

		for (auto It(CategoryToClasses.CreateIterator()); It; ++It)
		{
			TArray<UGameplayDebuggerBaseObject*>& CurrentObjects = It.Value();
			for (UGameplayDebuggerBaseObject* Obj : CurrentObjects)
			{
				Obj->CollectDataToReplicateOnServer(LocalPlayerOwner, LastSelectedActorToDebug);
			}
		}
	}

#endif
}
Пример #3
0
bool GCombo::Delete()
{
	return Delete(Value());
}
 virtual Value interiorValue() override final { return Value(); }
Пример #5
0
void TableScreen::update(float dt)
{
    TableLogic* gl = static_cast<TableLogic*>(GlobalVar::gameLogic);
    Size s = util::graphic::getScreenSize();
    // update bar
    timeBar->setScaleX(gl->currTime/gl->totalTime *(s.width/timeBar->getContentSize().width));
    score->setString(StringUtils::toString(gl->score));
    if(gl->isShowScore) // finish category
    {
        util::common::stopAllSounds();
        vanishTiles();
        gl->isShowScore = false;
		int best = ScoreDB::instance->getScoreFor(gl->cat);
		int star = ScoreDB::instance->getScoreFor(STAR_KEY_FOR(gl->cat.c_str()));
		int coin = ScoreDB::instance->getScoreFor(WordedApp::COIN_KEY);
        Node* n = ScoreGUI::create(coin, gl->cat, gl->score, best, star, CC_CALLBACK_0(TableScreen::onBack2Cats, this), CC_CALLBACK_0(TableScreen::onRetry, this));
        n->setTag(23);
        getChildByTag(LABEL_LAYER)->addChild(n);
		bool isSave = false;
		if (gl->score > best)
		{
			ScoreDB::instance->setScoreFor(gl->cat, gl->score);
			isSave = true;
            util::platform::setScoreGC(WordedApp::getGCKey( gl->cat.c_str()), gl->score);
		}
		if (gl->score >= WordedApp::STAR_MIN_PT)
		{
			star++;
			if (star <= WordedApp::STAR_MAX)
			{
				ScoreDB::instance->setScoreFor(STAR_KEY_FOR(gl->cat.c_str()), star);
				int starTotal = ScoreDB::instance->getScoreFor(std::string(WordedApp::STARTOTAL_KEY));
				starTotal++;
				ScoreDB::instance->setScoreFor(std::string(WordedApp::STARTOTAL_KEY), starTotal);
				isSave = true;
			}
            
            if(gl->score >=90)
            {
                bool checkGot90 = util::common::getValue(STAR90_KEY_FOR(gl->cat.c_str())).asBool();
                if(!checkGot90)
                {
                    int score = ScoreDB::instance->getScoreFor(WordedApp::TOTAL_90STAR);
                    ScoreDB::instance->setScoreFor(WordedApp::TOTAL_90STAR, score+1);
                    util::common::saveValue(STAR90_KEY_FOR(gl->cat.c_str()), Value(true));
                    isSave = true;
                }
            }
		}
		if(isSave)
			ScoreDB::instance->saveDB();
        
        currWord = "";
        timeBar->setVisible(false);
        score->setVisible(false);
        word->setVisible(false);
//        runAction(Sequence::createWithTwoActions(DelayTime::create(1.f),CallFunc::create(CC_CALLBACK_0(TableScreen::onBack2Cats,this))));
    }
    else if(gl->isPlaying) // game is playing
    {
        timeBar->setVisible(true);
        score->setVisible(true);
        word->setVisible(true);
        std::string logicWord = gl->word;
        if(currWord!=logicWord)
        {
            currWord = logicWord;
			if (WordedApp::difficult == WordedApp::DIFFICULT_EASY)
			{
				Vector<FiniteTimeAction*> v;
				v.pushBack(FadeOut::create(0.2f));
				v.pushBack(CallFunc::create(CC_CALLBACK_0(Label::setString, word, logicWord)));
				v.pushBack(FadeIn::create(0.4f));
				word->runAction(Sequence::create(v));
			}            
            WordedApp::playSound(gl->word);
            makeTiles(gl->formation);
        }
        
        if(gl->currTime <= 3 && !playTimeout)
        {
            util::common::playSound(Constants::ASS_SND_TIMEOUT,false);
            playTimeout = true;
        }
        else if (gl->currTime > 3)
        {
            playTimeout = false;
        }
    
    }
    else    // is Pause
    {
        
    }
}
Пример #6
0
bool TiXmlDocument::SaveFile() const
{
	return SaveFile( Value() );
}
void HostsUsingFeatures::countName(Feature feature, const String& name)
{
    auto result = m_valueByName.add(name, Value());
    result.storedValue->value.count(feature);
}
Пример #8
0
void CProtocolDemo::GetMemoryInfo(CPointDemoBase *pPoint_)
{
    CTagI *pTempTagI = pPoint_->m_pTag;
    if (pTempTagI)
    {
        double fValue=0.0;
        switch(pPoint_->m_nFunction)
        {
        case 20://物理内存总数
        {
            QString strTitle_("MemTotal");
            QFile file(PROC_MEMINFO);
            MEM_OCCUPY m;
            if (file.open(QIODevice::ReadOnly| QIODevice::Text))
            {
                QTextStream in(&file);
                QString data = in.readAll();
                QStringList lineList = data.split('\n');
                for (int i = 0; i < lineList.count(); ++i)
                {
                    if (lineList.at(i).contains(strTitle_))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        fValue = m.total;
                        break;
                    }
                }
                file.close();
            }
        }
            break;
        case 22://物理内存空闲
        {
            QString strTitle_("MemFree");
            QFile file(PROC_MEMINFO);
            MEM_OCCUPY m;
            if (file.open(QIODevice::ReadOnly| QIODevice::Text))
            {
                QTextStream in(&file);
                QString data = in.readAll();
                QStringList lineList = data.split('\n');
                for (int i = 0; i < lineList.count(); ++i)
                {
                    if (lineList.at(i).contains(strTitle_))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        fValue = m.total;
                        break;
                    }
                }
                file.close();
            }
        }
            break;
        case 24://物理内存使用
        {
            QString strTitle_1("MemTotal");
            QString strTitle_2("MemFree");
            double value1 = 0.0;
            double value2 = 0.0;
            QFile file(PROC_MEMINFO);
            MEM_OCCUPY m;
            if (file.open(QIODevice::ReadOnly| QIODevice::Text))
            {
                QTextStream in(&file);
                QString data = in.readAll();
                QStringList lineList = data.split('\n');
                for (int i = 0; i < lineList.count(); ++i)
                {
                    if (lineList.at(i).contains(strTitle_1))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        value1 = m.total;
                        break;
                    }else if (lineList.at(i).contains(strTitle_2))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        value2 = m.total;
                        break;
                    }
                }
                file.close();
                fValue = value1 - value2;
            }
        }
            break;
        case 26://虚内存总数
        {
            QString strTitle_("VmallocTotal");
            QFile file(PROC_MEMINFO);
            MEM_OCCUPY m;
            if (file.open(QIODevice::ReadOnly| QIODevice::Text))
            {
                QTextStream in(&file);
                QString data = in.readAll();
                QStringList lineList = data.split('\n');
                for (int i = 0; i < lineList.count(); ++i)
                {
                    if (lineList.at(i).contains(strTitle_))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        fValue = m.total;
                        break;
                    }
                }
                file.close();
            }
        }
            break;
        case 28://虚内存空闲
        {
            QString strTitle_1("VmallocTotal");
            QString strTitle_2("VmallocUsed");
            double value1 = 0.0;
            double value2 = 0.0;
            QFile file(PROC_MEMINFO);
            MEM_OCCUPY m;
            if (file.open(QIODevice::ReadOnly| QIODevice::Text))
            {
                QTextStream in(&file);
                QString data = in.readAll();
                QStringList lineList = data.split('\n');
                for (int i = 0; i < lineList.count(); ++i)
                {
                    if (lineList.at(i).contains(strTitle_1))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        value1 = m.total;
                        break;
                    }else if (lineList.at(i).contains(strTitle_2))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        value2 = m.total;
                        break;
                    }
                }
                file.close();
                fValue = value1 - value2;
            }
        }
            break;
        case 30://虚内存占用
        {
            QString strTitle_("VmallocUsed");
            QFile file(PROC_MEMINFO);
            MEM_OCCUPY m;
            if (file.open(QIODevice::ReadOnly| QIODevice::Text))
            {
                QTextStream in(&file);
                QString data = in.readAll();
                QStringList lineList = data.split('\n');
                for (int i = 0; i < lineList.count(); ++i)
                {
                    if (lineList.at(i).contains(strTitle_))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        fValue = m.total;
                        break;
                    }
                }
                file.close();
            }
        }

            break;
        case 32://文件页总数
            break;
        case 34://文件页空闲
            break;
        case 36://文件页占用
            break;
        case 38://内存占用率
            break;
        case 40://当前程序占用空间
        {
            uid_t current_pid = getpid();   //获取进程ID
            QString strTitle_("VmallocUsed");
            QString filename = QString("/proc/%1/stat").arg(QString::number(current_pid));
            qDebug()<<"current pid="<<current_pid;
            QFile file(filename);
            MEM_OCCUPY m;
            if (file.open(QIODevice::ReadOnly| QIODevice::Text))
            {
                QTextStream in(&file);
                QString data = in.readAll();
                QStringList lineList = data.split('\n');
                for (int i = 0; i < lineList.count(); ++i)
                {
                    if (lineList.at(i).contains(strTitle_))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        fValue = m.total;
                        break;
                    }
                }
                file.close();
            }


        }
            break;
        case 42://内存使用峰值
        {
            QString strValue;
            if (pTempTagI->GetPointCollection())
            {
                strValue = pTempTagI->GetProjectValue()->GetVarValue().toString();
            }
            int m_nLastValue = strValue.toInt();
            QString strTitle_1("MemTotal");
            QString strTitle_2("MemFree");
            double value1 = 0.0;
            double value2 = 0.0;
            QFile file(PROC_MEMINFO);
            MEM_OCCUPY m;
            if (file.open(QIODevice::ReadOnly| QIODevice::Text))
            {
                QTextStream in(&file);
                QString data = in.readAll();
                QStringList lineList = data.split('\n');
                for (int i = 0; i < lineList.count(); ++i)
                {
                    if (lineList.at(i).contains(strTitle_1))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        value1 = m.total;
                        break;
                    }else if (lineList.at(i).contains(strTitle_2))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        value2 = m.total;
                        break;
                    }
                }
                file.close();
                if (m_nLastValue < value1-value2)
                {
                    fValue = value1 - value2;
                }
            }
        }
            break;
        case 44://占用的虚拟内存大小
        {
            QString strTitle_("VmallocUsed");
            QFile file(PROC_MEMINFO);
            MEM_OCCUPY m;
            if (file.open(QIODevice::ReadOnly| QIODevice::Text))
            {
                QTextStream in(&file);
                QString data = in.readAll();
                QStringList lineList = data.split('\n');
                for (int i = 0; i < lineList.count(); ++i)
                {
                    if (lineList.at(i).contains(strTitle_))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        fValue = m.total;
                        break;
                    }
                }
                file.close();
            }
        }
            break;
        case 46://占用的虚拟内存峰值
        {
            QString strValue;
            if (pTempTagI->GetPointCollection())
            {
                strValue = pTempTagI->GetProjectValue()->GetVarValue().toString();
            }
            int m_nLastValue = strValue.toInt();
            QString strTitle_("VmallocUsed");
            QFile file(PROC_MEMINFO);
            MEM_OCCUPY m;
            if (file.open(QIODevice::ReadOnly| QIODevice::Text))
            {
                QTextStream in(&file);
                QString data = in.readAll();
                QStringList lineList = data.split('\n');
                for (int i = 0; i < lineList.count(); ++i)
                {
                    if (lineList.at(i).contains(strTitle_))
                    {
                        sscanf (lineList.at(i).toStdString().data(), "%s %lu %s", m.name, &m.total, m.name2);
                        if (m_nLastValue < (int)m.total)
                        {
                            fValue = m.total;
                        }
                        break;
                    }
                }
                file.close();
            }
        }
            break;
        default:
            Q_ASSERT(false);//("IO变量定义无效:未定义的随机变量取值方式 funcno=100 param1=%d\n",nType);
            break;
        }
        QVariant Value(fValue);
//        qDebug()<<"Value_.setValue(fValue);"<<Value;
        pTempTagI->SetValue(pPoint_,Value,Value);
    }
}
Пример #9
0
	Header(const std::string &n, const std::string &v = "", const std::string &q = "")
	{
		setName(n);
		if(!v.empty())
			values.push_back(Value(v, q));
	}
Пример #10
0
Value FunNumber::evaluate() const
{
    if (!argCount())
        return Value(Expression::evaluationContext().node.get()).toNumber();
    return arg(0)->evaluate().toNumber();
}
Пример #11
0
 Value DocumentSourceSkip::serialize(bool explain) const {
     return Value(DOC(getSourceName() << _skip));
 }
Пример #12
0
Value FunStringLength::evaluate() const
{
    if (!argCount())
        return Value(Expression::evaluationContext().node.get()).toString().length();
    return arg(0)->evaluate().toString().length();
}
Пример #13
0
void JSCWebWorker::postMessageToOwner(JSValueRef msg) {
  std::string msgString = Value(context_, msg).toJSONString();
  ownerMessageQueueThread_->runOnQueue([this, msgString] () {
      owner_->onMessageReceived(id_, msgString);
  });
}
Пример #14
0
    void DocumentSourceGroup::populate() {
        const size_t numAccumulators = vpAccumulatorFactory.size();
        dassert(numAccumulators == vpExpression.size());

        const bool mergeInputs = pExpCtx->getDoingMerge();

        // pushed to on spill()
        vector<shared_ptr<Sorter<Value, Value>::Iterator> > sortedFiles;
        int memoryUsageBytes = 0;

        // This loop consumes all input from pSource and buckets it based on pIdExpression.
        for (bool hasNext = !pSource->eof(); hasNext; hasNext = pSource->advance()) {
            if (memoryUsageBytes > _maxMemoryUsageBytes) {
                uassert(16945, "Exceeded memory limit for $group, but didn't allow external sort",
                        _extSortAllowed);
                sortedFiles.push_back(spill());
                memoryUsageBytes = 0;
            }

            const Document input = pSource->getCurrent();
            const Variables vars (input);

            /* get the _id value */
            Value id = pIdExpression->evaluate(vars);

            /* treat missing values the same as NULL SERVER-4674 */
            if (id.missing())
                id = Value(BSONNULL);

            /*
              Look for the _id value in the map; if it's not there, add a
              new entry with a blank accumulator.
            */
            const size_t oldSize = groups.size();
            vector<intrusive_ptr<Accumulator> >& group = groups[id];
            const bool inserted = groups.size() != oldSize;

            if (inserted) {
                memoryUsageBytes += id.getApproximateSize();

                // Add the accumulators
                group.reserve(numAccumulators);
                for (size_t i = 0; i < numAccumulators; i++) {
                    group.push_back(vpAccumulatorFactory[i]());
                }
            } else {
                for (size_t i = 0; i < numAccumulators; i++) {
                    // subtract old mem usage. New usage added back after processing.
                    memoryUsageBytes -= group[i]->memUsageForSorter();
                }
            }

            /* tickle all the accumulators for the group we found */
            dassert(numAccumulators == group.size());
            for (size_t i = 0; i < numAccumulators; i++) {
                group[i]->process(vpExpression[i]->evaluate(vars), mergeInputs);
                memoryUsageBytes += group[i]->memUsageForSorter();
            }

            DEV {
                // In debug mode, spill every time we have a duplicate id to stress merge logic.
                if (!inserted // is a dup
                        && !pExpCtx->getInRouter() // can't spill to disk in router
                        && !_extSortAllowed // don't change behavior when testing external sort
                        && sortedFiles.size() < 20 // don't open too many FDs
                        ) {
                    sortedFiles.push_back(spill());
                }
            }
        }

        // These blocks do any final steps necessary to prepare to output results.
        if (!sortedFiles.empty()) {
            _spilled = true;
            if (!groups.empty()) {
                sortedFiles.push_back(spill());
            }

            // We won't be using groups again so free its memory.
            GroupsMap().swap(groups);

            _sorterIterator.reset(
                    Sorter<Value,Value>::Iterator::merge(
                        sortedFiles, SortOptions(), SorterComparator()));

            // prepare current to accumulate data
            _currentAccumulators.reserve(numAccumulators);
            for (size_t i = 0; i < numAccumulators; i++) {
                _currentAccumulators.push_back(vpAccumulatorFactory[i]());
            }

            // must be before call to advance so we don't recurse
            populated = true;

            verify(_sorterIterator->more()); // we put data in, we should get something out.
            _firstPartOfNextGroup = _sorterIterator->next();
            verify(advance()); // moves first result into _currentId and _currentAccumulators
        } else {
            // start the group iterator
            groupsIterator = groups.begin();
            populated = true;
        }
    }
TSharedRef<SWidget> FAnimTransitionNodeDetails::OnGetShareableNodesMenu(bool bShareRules)
{
	FMenuBuilder MenuBuilder(true, NULL);

	FText SectionText;

	if (bShareRules)
	{
		SectionText = LOCTEXT("PickSharedAnimTransition", "Shared Transition Rules");
	}
	else
	{
		SectionText = LOCTEXT("PickSharedAnimCrossfadeSettings", "Shared Settings");
	}

	MenuBuilder.BeginSection("AnimTransitionSharableNodes", SectionText);

	if (UAnimStateTransitionNode* TransNode = TransitionNode.Get())
	{
		const UEdGraph* CurrentGraph = TransNode->GetGraph();

		// Loop through the graph and build a list of the unique shared transitions
		TMap<FString, UAnimStateTransitionNode*> SharedTransitions;

		for (int32 NodeIdx=0; NodeIdx < CurrentGraph->Nodes.Num(); NodeIdx++)
		{
			if (UAnimStateTransitionNode* GraphTransNode = Cast<UAnimStateTransitionNode>(CurrentGraph->Nodes[NodeIdx]))
			{
				if (bShareRules && !GraphTransNode->SharedRulesName.IsEmpty())
				{
					SharedTransitions.Add(GraphTransNode->SharedRulesName, GraphTransNode);
				}

				if (!bShareRules && !GraphTransNode->SharedCrossfadeName.IsEmpty())
				{
					SharedTransitions.Add(GraphTransNode->SharedCrossfadeName, GraphTransNode);
				}
			}
		}

		for (auto Iter = SharedTransitions.CreateIterator(); Iter; ++Iter)
		{
			FUIAction Action = FUIAction( FExecuteAction::CreateSP(this, &FAnimTransitionNodeDetails::BecomeSharedWith, Iter.Value(), bShareRules) );
			MenuBuilder.AddMenuEntry( FText::FromString( Iter.Key() ), LOCTEXT("ShaerdTransitionToolTip", "Use this shared transition"), FSlateIcon(), Action);
		}
	}
	MenuBuilder.EndSection();

	return MenuBuilder.MakeWidget();
}
Пример #16
0
FbReadHandler::BinaryHandler::BinaryHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts)
    : BaseHandler(owner, name)
    , m_file(Value(atts, "id"))
{
}
Пример #17
0
bool TiXmlDocument::LoadFile( TiXmlEncoding encoding )
{
	return LoadFile( Value(), encoding );
}
Пример #18
0
UInt32 SceneTreeModel::getIndexOfChild(const boost::any& parent, const boost::any& child) const
{
    if(parent.type() == typeid(Scene* const))
    {
        UInt32 Value(boost::any_cast<UInt32>(child));
        switch(Value)
        {
        case BasicComponent:              //Basic
            return BasicComponent;
            break;
        case ForegroundsComponent:              //Foregrounds
            return ForegroundsComponent;
            break;
        case BackgroundComponent:              //Background
            return BackgroundComponent;
            break;
        case CameraComponent:              //Camera
            return CameraComponent;
            break;
        case SceneObjectsComponent:              //Models
            return SceneObjectsComponent;
            break;
        case DynamicsComponent:              //Dynamics
            return DynamicsComponent;
            break;
        }
    }
    else if(parent.type() == typeid(UInt32))
    {
        UInt32 Value(boost::any_cast<UInt32>(parent));
        switch(Value)
        {
        case BasicComponent:              //Basic
        case BackgroundComponent:              //Background
        case CameraComponent:              //Camera
            return 0;
            break;
        case ForegroundsComponent:              //Foregrounds
            for(UInt32 i(0) ; i<getInternalRoot()->getPrimaryViewport()->getMFForegrounds()->size() ; ++i)
            {
                if(getInternalRoot()->getPrimaryViewport()->getForegrounds(i) == boost::any_cast<Foreground* const>(child))
                {
                    return i;
                }
            }
            return 0;
            break;
        case SceneObjectsComponent:              //Models
            for(UInt32 i(0) ; i<getInternalRoot()->getMFSceneObjects()->size() ; ++i)
            {
                if(getInternalRoot()->getSceneObjects(i) == boost::any_cast<SceneObject* const>(child))
                {
                    return i;
                }
            }
            break;
        case LightsComponent:              //Lights
            {
                UInt32 NumLights(getChildCount(parent));
                UInt32 FoundLights(0);

                NodeRecPtr LightNode(getInternalRoot()->getPrimaryViewport()->getRoot());
                while(FoundLights < NumLights &&
                      LightNode->getNChildren() > 0 &&
                      LightNode->getChild(0)->getCore()->getType().isDerivedFrom(Light::getClassType()))
                {
                    LightNode = LightNode->getChild(0);

                    if(LightNode ==boost::any_cast<Light* const>(child)->getParents().front() )
                    {
                        return FoundLights;
                    }

                    ++FoundLights;
                }
            }
            break;
        case DynamicsComponent:              //Dynamics
            UInt32 Value(boost::any_cast<UInt32>(child));
            switch(Value)
            {
                case ScriptsComponent:              //Scripts
                    return ScriptsComponent - DynamicsComponentsFirst;
                    break;
                case BehavioursComponent:              //Behaviours
                    return BehavioursComponent - DynamicsComponentsFirst;
                    break;
                case AnimationsComponent:              //Animations
                    return AnimationsComponent - DynamicsComponentsFirst;
                    break;
            }
        }
    }
    else
    {
        return 0;
    }
}
Пример #19
0
		void initLoading(std::string filename) override
		{
			boost::shared_ptr<TiXmlDocument> configDoc = FileRead::readXMLDocument(filename);

			if (configDoc->Error())
			{
				std::cerr << "Warning: Parse error in " << filename << "!" << std::endl;
				throw( std::runtime_error("") );
			}

			TiXmlElement* userConfigElem = configDoc->FirstChildElement("replay");
			if (userConfigElem == nullptr)
				throw(std::runtime_error("No <replay> node found!"));

			TiXmlElement* varElem = userConfigElem->FirstChildElement("version");
			// the first element we find is expected to be the version
			if(!varElem)
			{
				throw( std::runtime_error("") );
			}
			else
			{
				const char* major = varElem->Attribute("major");
				const char* minor = varElem->Attribute("minor");
				if(!minor || !major)
					throw(std::runtime_error(""));
                assert(boost::lexical_cast<int>(major) == 2);
                mReplayFormatVersion = boost::lexical_cast<int>(minor);
			}


			for (; varElem != nullptr; varElem = varElem->NextSiblingElement("var"))
			{
				std::string name, value;
				const char* c;
				c = varElem->Attribute("name");
				if (c)
					name = c;
				c = varElem->Attribute("value");
				if (c)
					value = c;

				// find valid attribute
				if( name == "game_speed" )
					mGameSpeed = boost::lexical_cast<int>(value);
				else if( name == "game_length" )
					mGameLength = boost::lexical_cast<int>(value);
				else if( name == "game_duration" )
					mGameDuration = boost::lexical_cast<int>(value);
				else if( name == "game_date" )
					mGameDate = boost::lexical_cast<int>(value);
				else if( name == "score_left" )
					mLeftFinalScore = boost::lexical_cast<int>(value);
				else if( name == "score_right" )
					mRightFinalScore = boost::lexical_cast<int>(value);
				else if( name == "name_left" )
					mLeftPlayerName = value;
				else if( name == "name_right" )
					mRightPlayerName = value;
				else if( name == "color_left" )
					mLeftColor = Color(boost::lexical_cast<int>(value));
				else if( name == "color_right" )
					mRightColor = Color(boost::lexical_cast<int>(value));
			}

			// load rules
			varElem = userConfigElem->FirstChildElement("rules");
			if(!varElem)
				throw(std::runtime_error(""));
			auto content = varElem->FirstChild();
			if(!content)
				throw(std::runtime_error(""));

			mRules = content->Value();

			// now load buffer and savepoints
			varElem = userConfigElem->FirstChildElement("input");
			if(!varElem)
				throw(std::runtime_error(""));
			content = varElem->FirstChild();
			if(!content)
				throw(std::runtime_error(""));

			mBuffer = decode(content->Value());

			varElem = userConfigElem->FirstChildElement("states");
			if(!varElem)
				throw(std::runtime_error(""));
			content = varElem->FirstChild();
			if(!content)
				throw(std::runtime_error(""));

			// get save points
			auto sp = decode( content->Value() );
			RakNet::BitStream temp( (char*)sp.data(), sp.size(), false );
			auto convert = createGenericReader(&temp);
			convert->generic<std::vector<ReplaySavePoint> > (mSavePoints);
		}
Пример #20
0
/***************************************************************************\
 *                           Instance methods                              *
\***************************************************************************/
boost::any SceneTreeModel::getChild(const boost::any& parent, const UInt32& index) const
{
    if(parent.type() == typeid(Scene* const))
    {
        switch(index)
        {
        case BasicComponent:              //Basic
            return boost::any(UInt32(BasicComponent));
            break;
        case ForegroundsComponent:              //Foregrounds
            return boost::any(UInt32(ForegroundsComponent));
            break;
        case BackgroundComponent:              //Background
            return boost::any(UInt32(BackgroundComponent));
            break;
        case CameraComponent:              //Camera
            return boost::any(UInt32(CameraComponent));
            break;
        case SceneObjectsComponent:              //Models
            return boost::any(UInt32(SceneObjectsComponent));
            break;
        case LightsComponent:              //Models
            return boost::any(UInt32(LightsComponent));
            break;
        case DynamicsComponent:              //Dynamics
            return boost::any(UInt32(DynamicsComponent));
            break;
        }
    }
    else if(parent.type() == typeid(UInt32))
    {
        UInt32 Value(boost::any_cast<UInt32>(parent));
        switch(Value)
        {
        case BasicComponent:              //Basic
        case BackgroundComponent:              //Background
        case CameraComponent:              //Camera
            return boost::any();
            break;
        case ForegroundsComponent:              //Foregrounds
            if(index < getInternalRoot()->getPrimaryViewport()->getMFForegrounds()->size())
            {
                return boost::any(getInternalRoot()->getPrimaryViewport()->getForegrounds(index));
            }
            break;
        case SceneObjectsComponent:              //Models
            if(index < getInternalRoot()->getMFSceneObjects()->size())
            {
                return boost::any(getInternalRoot()->getSceneObjects(index));
            }
            break;
        case LightsComponent:              //Lights
            {
                NodeRecPtr LightNode(getInternalRoot()->getPrimaryViewport()->getRoot());

                for(UInt32 i(0) ; i<=index ; ++i)
                {
                    if(LightNode->getNChildren() > 0 &&
                        LightNode->getChild(0)->getCore()->getType().isDerivedFrom(Light::getClassType()))
                    {
                        LightNode = LightNode->getChild(0);
                    }
                }

                if(LightNode != NULL)
                {
                    return boost::any(dynamic_cast<Light*>(LightNode->getCore()));
                }
                else
                {
                    return boost::any();
                }
            }
            break;
        case DynamicsComponent:              //Dynamics
            switch(index+DynamicsComponentsFirst)
            {
            case ScriptsComponent:              //Scripts
                return boost::any(UInt32(ScriptsComponent));
                break;
            case BehavioursComponent:              //Behaviours
                return boost::any(UInt32(BehavioursComponent));
                break;
            case AnimationsComponent:              //Animations
                return boost::any(UInt32(AnimationsComponent));
                break;
            }
            break;
        }
    }
    return boost::any();
}
Пример #21
0
Document AggregationRequest::serializeToCommandObj() const {
    MutableDocument serialized;
    return Document{
        {kCommandName, (_nss.isCollectionlessAggregateNS() ? Value(1) : Value(_nss.coll()))},
        {kPipelineName, _pipeline},
        // Only serialize booleans if different than their default.
        {kAllowDiskUseName, _allowDiskUse ? Value(true) : Value()},
        {kFromMongosName, _fromMongos ? Value(true) : Value()},
        {kNeedsMergeName, _needsMerge ? Value(true) : Value()},
        {bypassDocumentValidationCommandOption(),
         _bypassDocumentValidation ? Value(true) : Value()},
        // Only serialize a collation if one was specified.
        {kCollationName, _collation.isEmpty() ? Value() : Value(_collation)},
        // Only serialize batchSize if not an explain, otherwise serialize an empty cursor object.
        {kCursorName,
         _explainMode ? Value(Document()) : Value(Document{{kBatchSizeName, _batchSize}})},
        // Only serialize a hint if one was specified.
        {kHintName, _hint.isEmpty() ? Value() : Value(_hint)},
        // Only serialize a comment if one was specified.
        {kCommentName, _comment.empty() ? Value() : Value(_comment)},
        // Only serialize readConcern if specified.
        {repl::ReadConcernArgs::kReadConcernFieldName,
         _readConcern.isEmpty() ? Value() : Value(_readConcern)},
        // Only serialize the unwrapped read preference if specified.
        {QueryRequest::kUnwrappedReadPrefField,
         _unwrappedReadPref.isEmpty() ? Value() : Value(_unwrappedReadPref)},
        // Only serialize maxTimeMs if specified.
        {QueryRequest::cmdOptionMaxTimeMS,
         _maxTimeMS == 0 ? Value() : Value(static_cast<int>(_maxTimeMS))}};
}
Пример #22
0
Gura_ImplementMethod(model, get_decfun_bias)
{
	struct model *pModel = Object_model::GetObjectThis(arg)->GetEntity();
	int label_idx = arg.GetInt(0);
	return Value(::get_decfun_bias(pModel, label_idx));
}
 virtual Value terminalValue() override final { return Value(); }
Пример #24
0
Gura_ImplementMethod(model, get_nr_feature)
{
	struct model *pModel = Object_model::GetObjectThis(arg)->GetEntity();
	return Value(::get_nr_feature(pModel));
}
Пример #25
0
Value DropChoice::Get() const {
	if(!owner || owner->IsReadOnly() && !rodrop) return Value();
	int c = list.GetCursor();
	if(c < 0) return Value();
	return list.Get(c, 0);
}
Пример #26
0
//! Redraw the button depending on whether it's up or down
void
CPUButton::Draw(BRect rect)
{
	bool value = (bool)Value();
	SetHighColor(value ? fOnColor : fOffColor);

	if (!fReplicant) {
		SetLowColor(Parent()->LowColor());
		FillRect(Bounds(), B_SOLID_LOW);
	}

	BRect bounds = Bounds();
	if (fReplicant && !fReplicantInDeskbar) {
		bounds.bottom -= 4;
		bounds.right -= 4;
	} else if (!fReplicant) {
		bounds.bottom -= 7;
		bounds.right -= 7;
	}
	BRect color_rect(bounds);
	color_rect.InsetBy(2, 2);
	if (value) {
		color_rect.bottom -= 1;
		color_rect.right -= 1;
	}
	FillRect(bounds);

	if (value)
		SetHighColor(80, 80, 80);
	else
		SetHighColor(255, 255, 255);

	BPoint start(0, 0);
	BPoint end(bounds.right, 0);
	StrokeLine(start, end);
	end.Set(0, bounds.bottom);
	StrokeLine(start, end);

	if (value)
		SetHighColor(32, 32, 32);
	else
		SetHighColor(216, 216, 216);

	start.Set(1, 1);
	end.Set(bounds.right - 1, 1);
	StrokeLine(start, end);
	end.Set(1, bounds.bottom - 1);
	StrokeLine(start, end);

	if (value)
		SetHighColor(216, 216, 216);
	else
		SetHighColor(80, 80, 80);

	start.Set(bounds.left + 1, bounds.bottom - 1);
	end.Set(bounds.right - 1, bounds.bottom - 1);
	StrokeLine(start, end);
	start.Set(bounds.right - 1, bounds.top + 1);
	StrokeLine(start, end);

	if (value)
		SetHighColor(255, 255, 255);
	else
		SetHighColor(32, 32, 32);

	start.Set(bounds.left, bounds.bottom);
	end.Set(bounds.right, bounds.bottom);
	StrokeLine(start, end);
	start.Set(bounds.right, bounds.top);
	StrokeLine(start, end);

	if (value) {
		SetHighColor(0, 0, 0);
		start.Set(bounds.left + 2, bounds.bottom - 2);
		end.Set(bounds.right - 2, bounds.bottom - 2);
		StrokeLine(start, end);
		start.Set(bounds.right - 2, bounds.top + 2);
		StrokeLine(start, end);
	}

	// Try to keep the text centered
	BFont font;
	GetFont(&font);
	int label_width = (int)font.StringWidth(Label());
	int rect_width = bounds.IntegerWidth() - 1;
	int rect_height = bounds.IntegerHeight();
	font_height fh;
	font.GetHeight(&fh);
	int label_height = (int)fh.ascent;
	int x_pos = (int)(((double)(rect_width - label_width) / 2.0) + 0.5);
	int y_pos = (rect_height - label_height) / 2 + label_height;

	MovePenTo(x_pos, y_pos);
	SetHighColor(0, 0, 0);
	SetDrawingMode(B_OP_OVER);
	DrawString(Label());
}
void AGameplayDebuggerReplicator::DrawDebugData(class UCanvas* Canvas, class APlayerController* PC, bool bHideMenu)
{
#if ENABLED_GAMEPLAY_DEBUGGER
	if (!LocalPlayerOwner && IsActorTickEnabled())
	{
		return;
	}

	const bool bAllowToDraw = Canvas && Canvas->SceneView && (Canvas->SceneView->ViewActor == LocalPlayerOwner->AcknowledgedPawn || Canvas->SceneView->ViewActor == LocalPlayerOwner->GetPawnOrSpectator());
	if (!bAllowToDraw)
	{
		// check for spectator debug camera during debug camera
		if (DebugCameraController.IsValid() == false || Canvas->SceneView->ViewActor->GetInstigatorController() != DebugCameraController.Get())
		{
			return;
		}
	}

	const float DebugInfoStartX = UGameplayDebuggerModuleSettings::StaticClass()->GetDefaultObject<UGameplayDebuggerModuleSettings>()->DebugInfoStart.X;
	const float DebugInfoStartY = UGameplayDebuggerModuleSettings::StaticClass()->GetDefaultObject<UGameplayDebuggerModuleSettings>()->DebugInfoStart.Y;
	const FVector SelectedActorLoc = LastSelectedActorToDebug ? LastSelectedActorToDebug->GetActorLocation() + FVector(0, 0, LastSelectedActorToDebug->GetSimpleCollisionHalfHeight()) : DebugTools::InvalidLocation;
	
	UGameplayDebuggerHelper::FPrintContext DefaultContext(GEngine->GetSmallFont(), Canvas, DebugInfoStartX, DebugInfoStartY);
	DefaultContext.FontRenderInfo.bEnableShadow = true;
	const bool bDrawFullData = SelectedActorLoc != DebugTools::InvalidLocation;
	const FVector ScreenLoc = SelectedActorLoc != DebugTools::InvalidLocation ? UGameplayDebuggerHelper::ProjectLocation(DefaultContext, SelectedActorLoc) : FVector::ZeroVector;
	UGameplayDebuggerHelper::FPrintContext OverHeadContext(GEngine->GetSmallFont(), Canvas, ScreenLoc.X, ScreenLoc.Y);

	UGameplayDebuggerHelper::SetOverHeadContext(OverHeadContext);
	UGameplayDebuggerHelper::SetDefaultContext(DefaultContext);

	if (DefaultContext.Canvas != nullptr)
	{
		float XL, YL;
		const FString ToolName = FString::Printf(TEXT("Gameplay Debugger [Timestamp: %05.03f]"), GetWorld()->TimeSeconds);
		UGameplayDebuggerHelper::CalulateStringSize(DefaultContext, nullptr, ToolName, XL, YL);
		UGameplayDebuggerHelper::PrintString(DefaultContext, FColorList::White, ToolName, DefaultContext.Canvas->ClipX / 2.0f - XL / 2.0f, 0);
	}

	if (!bHideMenu)
	{
		DrawMenu(DefaultContext, OverHeadContext);
	}

	TMap<FString, TArray<UGameplayDebuggerBaseObject*> > CategoryToClasses;
	for (UGameplayDebuggerBaseObject* Obj : ReplicatedObjects)
	{
		if (Obj)
		{
			FString Category = Obj->GetCategoryName();
			CategoryToClasses.FindOrAdd(Category).Add(Obj);
		}
	}
	CategoryToClasses.KeySort(TLess<FString>());

	for (auto It(CategoryToClasses.CreateIterator()); It; ++It)
	{
		const FGameplayDebuggerCategorySettings* Element = Categories.FindByPredicate([&](const FGameplayDebuggerCategorySettings& C){ return It.Key() == C.CategoryName; });
		if (Element == nullptr || Element->bPIE == false)
		{
			continue;
		}

		UGameplayDebuggerHelper::PrintString(UGameplayDebuggerHelper::GetDefaultContext(), FString::Printf(TEXT("\n{R=0,G=255,B=0,A=255}%s\n"), *It.Key()));
		TArray<UGameplayDebuggerBaseObject*>& CurrentObjects = It.Value();
		for (UGameplayDebuggerBaseObject* Obj : CurrentObjects)
		{
			Obj->DrawCollectedData(LocalPlayerOwner, LastSelectedActorToDebug);
		}
	}

	const IConsoleVariable* cvarHighlightSelectedActor = IConsoleManager::Get().FindConsoleVariable(TEXT("ai.gd.HighlightSelectedActor"));
	const bool bHighlightSelectedActor = !cvarHighlightSelectedActor || cvarHighlightSelectedActor->GetInt();
	if (LastSelectedActorToDebug && bHighlightSelectedActor)
	{
		FBox ComponentsBoundingBox = LastSelectedActorToDebug->GetComponentsBoundingBox(false);
		DrawDebugBox(GetWorld(), ComponentsBoundingBox.GetCenter(), ComponentsBoundingBox.GetExtent(), FColor::Red, false);
		DrawDebugSolidBox(GetWorld(), ComponentsBoundingBox.GetCenter(), ComponentsBoundingBox.GetExtent(), FColor::Red.WithAlpha(25));
	}
#endif
}
Пример #28
0
NS_IMETHODIMP nsCookie::GetValue(nsACString &aValue)       { aValue = Value();          return NS_OK; }
Пример #29
0
int32 UGatherTextCommandlet::Main( const FString& Params )
{
	const TCHAR* Parms = *Params;
	TArray<FString> Tokens;
	TArray<FString> Switches;
	TMap<FString, FString> ParamVals;
	UCommandlet::ParseCommandLine(*Params, Tokens, Switches, ParamVals);
	
	// find the file corresponding to this object's loc file, loading it if necessary
	FString GatherTextConfigPath;
	const FString* ParamVal = ParamVals.Find(FString(TEXT("Config")));
	if (ParamVal)
	{
		GatherTextConfigPath = *ParamVal;
	}	
	else
	{
		UE_LOG(LogGatherTextCommandlet, Error, TEXT("-Config not specified.\n%s"), *UsageText);
		return -1;
	}

	if(FPaths::IsRelative(GatherTextConfigPath))
	{
		FString ProjectBasePath;
		if (!FPaths::GameDir().IsEmpty())
		{
			ProjectBasePath = FPaths::GameDir();
		}
		else
		{
			ProjectBasePath = FPaths::EngineDir();
		}
		GatherTextConfigPath = FPaths::Combine( *ProjectBasePath, *GatherTextConfigPath );
	}

	GConfig->LoadFile(*GatherTextConfigPath);

	FConfigFile* ConfigFile = GConfig->FindConfigFile(*GatherTextConfigPath);

	if( NULL == ConfigFile )
	{
		UE_LOG(LogGatherTextCommandlet, Error, TEXT("Loading Config File \"%s\" failed."), *GatherTextConfigPath);
		return -1; 
	}

	const bool bEnableSourceControl = Switches.Contains(TEXT("EnableSCC"));
	const bool bDisableSubmit = Switches.Contains(TEXT("DisableSCCSubmit"));

	UE_LOG(LogGatherTextCommandlet, Log,TEXT("Beginning GatherText Commandlet."));

	TSharedRef< FManifestInfo > ManifestInfo = MakeShareable( new FManifestInfo() );
	TSharedPtr< FGatherTextSCC > SourceControlInfo = NULL;

	if( bEnableSourceControl )
	{
		SourceControlInfo = MakeShareable( new FGatherTextSCC() );

		FText SCCErrorStr;
		if( !SourceControlInfo->IsReady( SCCErrorStr ) )
		{
			UE_LOG( LogGatherTextCommandlet, Error, TEXT("Source Control error: %s"), *SCCErrorStr.ToString() );
			return -1;
		}
	}

	int32 NumSteps = (ConfigFile->Find("CommonSettings") != NULL) ? ConfigFile->Num() - 1 :  ConfigFile->Num();

	//Execute each step defined in the config file.
	for( int32 i=0; i<NumSteps ; ++i )
	{
		FString SectionName = FString::Printf(TEXT("GatherTextStep%d"),i);
		FConfigSection* CurrCommandletSection = ConfigFile->Find(SectionName);
		if( NULL == CurrCommandletSection )
		{
			UE_LOG(LogGatherTextCommandlet, Error, TEXT("Could not find %s"),*SectionName);
			continue;
		}

		FString CommandletClassName = GConfig->GetStr( *SectionName, TEXT("CommandletClass"), GatherTextConfigPath ) + TEXT("Commandlet");

		UClass* CommandletClass = FindObject<UClass>(ANY_PACKAGE,*CommandletClassName,false);
		if (!CommandletClass)
		{
			UE_LOG(LogGatherTextCommandlet, Error,TEXT("The commandlet name %s in section %s is invalid."), *CommandletClassName, *SectionName);
			continue;
		}

		UGatherTextCommandletBase* Commandlet = ConstructObject<UGatherTextCommandletBase>( CommandletClass );
		check(Commandlet);
		Commandlet->AddToRoot();
		Commandlet->Initialize( ManifestInfo, SourceControlInfo );

		// Execute the commandlet.
		double CommandletExecutionStartTime = FPlatformTime::Seconds();

		UE_LOG(LogGatherTextCommandlet, Log,TEXT("Executing %s: %s"), *SectionName, *CommandletClassName);
		
		
		FString GeneratedCmdLine = FString::Printf(TEXT("-Config=\"%s\" -Section=%s"), *GatherTextConfigPath , *SectionName);

		// Add all the command params with the exception of config
		for(auto ParamIter = ParamVals.CreateConstIterator(); ParamIter; ++ParamIter)
		{
			const FString& Key = ParamIter.Key();
			const FString& Val = ParamIter.Value();
			if(Key != TEXT("config"))
			{
				GeneratedCmdLine += FString::Printf(TEXT(" -%s=%s"), *Key , *Val);
			}	
		}

		// Add all the command switches
		for(auto SwitchIter = Switches.CreateConstIterator(); SwitchIter; ++SwitchIter)
		{
			const FString& Switch = *SwitchIter;
			GeneratedCmdLine += FString::Printf(TEXT(" -%s"), *Switch);
		}

		if( 0 != Commandlet->Main( GeneratedCmdLine ) )
		{
			UE_LOG(LogGatherTextCommandlet, Error,TEXT("%s-%s reported an error."),*SectionName, *CommandletClassName);
			if( SourceControlInfo.IsValid() )
			{
				FText SCCErrorStr;
				if( !SourceControlInfo->CleanUp( SCCErrorStr ) )
				{
					UE_LOG(LogGatherTextCommandlet, Error, TEXT("%s"), *SCCErrorStr.ToString());
				}
			}
			return -1;
		}

		UE_LOG(LogGatherTextCommandlet, Log,TEXT("Completed %s: %s"), *SectionName, *CommandletClassName);
	}

	if( SourceControlInfo.IsValid() && !bDisableSubmit )
	{
		FText SCCErrorStr;
		if( SourceControlInfo->CheckinFiles( GetChangelistDescription(GatherTextConfigPath), SCCErrorStr ) )
		{
			UE_LOG(LogGatherTextCommandlet, Log,TEXT("Submitted Localization files."));
		}
		else
		{
			UE_LOG(LogGatherTextCommandlet, Error, TEXT("%s"), *SCCErrorStr.ToString());
			if( !SourceControlInfo->CleanUp( SCCErrorStr ) )
			{
				UE_LOG(LogGatherTextCommandlet, Error, TEXT("%s"), *SCCErrorStr.ToString());
			}
			return -1;
		}
	}

	return 0;
}
/*!
Resolve the overloaded method to call.  The algorithm works conceptually like this:
    1.  Resolve the set of overloads it is *possible* to call.
        Impossible overloads include those that have too many parameters or have parameters
        of unknown type.
    2.  Filter the set of overloads to only contain those with the closest number of
        parameters.
        For example, if we are called with 3 parameters and there are 2 overloads that
        take 2 parameters and one that takes 3, eliminate the 2 parameter overloads.
    3.  Find the best remaining overload based on its match score.
        If two or more overloads have the same match score, call the last one.  The match
        score is constructed by adding the matchScore() result for each of the parameters.
*/
QDeclarativeObjectMethodScriptClass::Value
QDeclarativeObjectMethodScriptClass::callOverloaded(MethodData *method, QScriptContext *ctxt)
{
    int argumentCount = ctxt->argumentCount();

    QDeclarativePropertyCache::Data *best = 0;
    int bestParameterScore = INT_MAX;
    int bestMatchScore = INT_MAX;

    QDeclarativePropertyCache::Data dummy;
    QDeclarativePropertyCache::Data *attempt = &method->data;

    do {
        QList<QByteArray> methodArgTypeNames;

        if (attempt->flags & QDeclarativePropertyCache::Data::HasArguments)
            methodArgTypeNames = method->object->metaObject()->method(attempt->coreIndex).parameterTypes();

        int methodArgumentCount = methodArgTypeNames.count();

        if (methodArgumentCount > argumentCount)
            continue; // We don't have sufficient arguments to call this method

        int methodParameterScore = argumentCount - methodArgumentCount;
        if (methodParameterScore > bestParameterScore)
            continue; // We already have a better option

        int methodMatchScore = 0;
        QVarLengthArray<int, 9> methodArgTypes(methodArgumentCount);

        bool unknownArgument = false;
        for (int ii = 0; ii < methodArgumentCount; ++ii) {
            methodArgTypes[ii] = QMetaType::type(methodArgTypeNames.at(ii));
            if (methodArgTypes[ii] == QVariant::Invalid)
                methodArgTypes[ii] = enumType(method->object->metaObject(),
                                              QString::fromLatin1(methodArgTypeNames.at(ii)));
            if (methodArgTypes[ii] == QVariant::Invalid) {
                unknownArgument = true;
                break;
            }
            methodMatchScore += matchScore(ctxt->argument(ii), methodArgTypes[ii], methodArgTypeNames.at(ii));
        }
        if (unknownArgument)
            continue; // We don't understand all the parameters

        if (bestParameterScore > methodParameterScore || bestMatchScore > methodMatchScore) {
            best = attempt;
            bestParameterScore = methodParameterScore;
            bestMatchScore = methodMatchScore;
        }

        if (bestParameterScore == 0 && bestMatchScore == 0)
            break; // We can't get better than that

    } while((attempt = relatedMethod(method->object, attempt, dummy)) != 0);

    if (best) {
        return callPrecise(method->object, *best, ctxt);
    } else {
        QString error = QLatin1String("Unable to determine callable overload.  Candidates are:");
        QDeclarativePropertyCache::Data *candidate = &method->data;
        while (candidate) {
            error += QLatin1String("\n    ") + QString::fromUtf8(method->object->metaObject()->method(candidate->coreIndex).methodSignature());
            candidate = relatedMethod(method->object, candidate, dummy);
        }
        return Value(ctxt, ctxt->throwError(error));
    }
}