Example #1
0
void Printer::PrintArray(std::string *result, Sqrat::Array array) {
	result->append("[");
	for (int i = 0; i < array.GetSize(); i++) {
		if (i > 0) {
			result->append(",");
		}
		Sqrat::Object obj = array.GetSlot(SQInteger(i));
		PrintValue(result, obj);
	}
	result->append("]");
}
void Android::transit(Sqrat::Object intent, int requestCode = -1) {
    std::string targetClass = intent.GetSlot("className").Cast<std::string>();
    int optionFlag = intent.GetSlot("optionFlag").Cast<int>();
    kvs_t* extras = new kvs_t();
    Sqrat::Array extraArray = intent.GetSlot("extras");
    for (int i = 0, size = extraArray.GetSize(); i < size; i++) {
        std::string key = extraArray[i].GetSlot("key").Cast<std::string>();
        std::string value = extraArray[i].GetSlot("value").Cast<std::string>();
        extras->insert(make_pair(key, value));
    }
    engine->javaGlue->transit(targetClass, extras, optionFlag,requestCode);
}
Example #3
0
//
// JsonPrinter
//
void JsonPrinter::PrintArray(Json::Value &value, Sqrat::Array array) {
	for (int i = 0; i < array.GetSize(); i++) {
		Sqrat::Object obj = array.GetSlot(SQInteger(i));
		value.append(PrintValue(obj));
	}
}