Пример #1
0
// first index=0
void Settings::removeArrayEntry( const QString & key , int index)
{
    QList< QVariantMap > array;
    array = getArray(key);
    array.removeAt(index);

    removeArray(key);

    foreach (QVariantMap entry, array)
        appendToArray(key, entry);
    bool b;
    b=true;
}
Пример #2
0
    void insertInto(UiObjectInitializer *ast)
    {
        if (targetPropertyName.isEmpty()) {
            // insert as UiObjectDefinition:
            UiObjectMemberList *insertAfter = searchMemberToInsertAfter(ast->members, propertyOrder);

            if (insertAfter && insertAfter->member) {
                moveInfo.destination = insertAfter->member->lastSourceLocation().end();
                moveInfo.prefixToInsert = QStringLiteral("\n\n");
            } else {
                moveInfo.destination = ast->lbraceToken.end();
                moveInfo.prefixToInsert = QStringLiteral("\n");
            }

            move(moveInfo);

            setDidRewriting(true);
            return;
        }

        // see if we need to insert into an UiArrayBinding:
        for (UiObjectMemberList *iter = ast->members; iter; iter = iter->next) {
            UiObjectMember *member = iter->member;

            if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(member)) {
                if (toString(arrayBinding->qualifiedId) == targetPropertyName) {
                    appendToArray(arrayBinding);

                    setDidRewriting(true);
                    return;
                }
            }
        }

        { // insert (create) a UiObjectBinding:
            UiObjectMemberList *insertAfter = searchMemberToInsertAfter(ast->members, targetPropertyName, propertyOrder);
            moveInfo.prefixToInsert = QStringLiteral("\n") + targetPropertyName + (targetIsArrayBinding ? QStringLiteral(": [") : QStringLiteral(": "));
            moveInfo.suffixToInsert = targetIsArrayBinding ? QStringLiteral("\n]") : QStringLiteral("");

            if (insertAfter && insertAfter->member)
                moveInfo.destination = insertAfter->member->lastSourceLocation().end();
            else
                moveInfo.destination = ast->lbraceToken.end();

            move(moveInfo);

            setDidRewriting(true);
        }
    }
Пример #3
0
workload_result_t processWorkload(int * workload, int workloadSize) {
	workload_result_t result;
	job_eval_result_t jobResult;
	memset(&result, 0, sizeof(workload_result_t));
	// Worst case scenario we get all type 2 jobs and they give us a maximum number of integers.
	int i;
	for(i = 0; i < workloadSize; i++) {
		jobResult = processJob(workload[i]);
		result.integerArray = appendToArray(result.integerArray, jobResult.job_result.job_results, jobResult.job_result.results_size, result.arraySize);
		result.arraySize += jobResult.job_result.results_size;
		switch(workload[i]) {
			case 0:
				result.type0ProcessingTime += jobResult.sleepTime;
				break;
			case 1:
				result.type1ProcessingTime += jobResult.sleepTime;
				break;
			case 2:
				result.type2ProcessingTime += jobResult.sleepTime;
				break;
		}
	}
	return result;
}