char * coreOperationListFiles(char * pattern , RuntimeErrorValidator * validator){ if(isDebugEnabled()) debug(concatAll(2 , "Listando Ruta: " , pattern)); List elements = getPathContentElements(pattern , validator); return serializeList(elements , ","); }
char * formatListToPreetyString(List l , HeapHandler hh){ char * formatedList = serializeList(l , ", " , hh); if(formatedList == NULL) return "(no hay elementos)"; else return formatedList; }
void FilelistApi::on(DirectoryListingManagerListener::ListingCreated, const DirectoryListingPtr& aList) noexcept { addList(aList); if (!subscriptionActive("filelist_created")) { return; } send("filelist_created", serializeList(aList)); }
api_return FilelistApi::handleGetLists(ApiRequest& aRequest) { auto retJson = json::array(); forEachSubModule([&](const FilelistInfo& aInfo) { retJson.push_back(serializeList(aInfo.getList())); }); aRequest.setResponseBody(retJson); return websocketpp::http::status_code::ok; }
std::string Joystick::serialize()const{ std::string s = "{"; s += "\"is_xbox\":" + asString(is_xbox) + ", "; s += "\"type\":" + std::to_string(type) + ", "; s += "\"name\":" + quote(name) + ", "; s += "\"buttons\":" + std::to_string(buttons) + ", "; s += "\"button_count\":" + std::to_string((int)button_count) + ", "; s += serializeList("\"axes\"", axes, std::function<std::string(int8_t)>(static_cast<std::string(*)(int)>(std::to_string))) + ", "; s += "\"axis_count\":" + std::to_string(axis_count) + ", "; s += serializeList("\"axis_types\"", axis_types, std::function<std::string(uint8_t)>(static_cast<std::string(*)(int)>(std::to_string))) + ", "; s += serializeList("\"povs\"", povs, std::function<std::string(int16_t)>(static_cast<std::string(*)(int)>(std::to_string))) + ", "; s += "\"pov_count\":" + std::to_string(pov_count) +", "; s += "\"outputs\":" + std::to_string(outputs) + ", "; s += "\"left_rumble\":" + std::to_string(left_rumble) + ", "; s += "\"right_rumble\":" + std::to_string(right_rumble); s += "}"; return s; }
void testAssignAndGetSectors() { RuntimeErrorValidator * v = buildErrorSuccessValidator(); List freeSectors = callFssOperationAssignAndGetSectors("VDA1" , "archivo1 con espacios.txt", v); if(!hasError(v)) { info(concatAll(3,"Se han traido los sectores correctamente: (" , serializeList(freeSectors , " , ") , ")")); } else { error(v->errorDescription); } }
QDomElement PListSerializer::serializeElement(QDomDocument &doc, const QVariant &variant) { if (variant.type() == QVariant::Map) { return serializeMap(doc, variant.toMap()); } else if (variant.type() == QVariant::List) { return serializeList(doc, variant.toList()); } else { return serializePrimitive(doc, variant); } }
IPCParameterI* IPCClass::callFunction(const char* name, bool async, std::vector<IPCParameterI*> &pList) { IPCFunctionCall *fch; uint32 tsize; char* data = serializeList(pList, tsize); char* buff = new char[tsize + IPCFunctionCallSIZE]; fch = (IPCFunctionCall*)buff; fch->size = tsize; fch->functionHash = UTIL::MISC::RSHash_CSTR(name); fch->numP = pList.size(); memcpy(&fch->data, data, tsize ); safe_delete(data); IPCParameterI* ret = NULL; if (async) { fch->id = 0; this->sendMessage(MT_FUNCTIONCALL_ASYNC, (const char*)fch, sizeofStruct(fch) ); safe_delete(buff); ret = new PVoid(); } else { IPCScopedLock<IPCClass> lock(this, newLock()); fch->id = lock->id; this->sendMessage(MT_FUNCTIONCALL, (const char*)fch, sizeofStruct(fch) ); safe_delete(buff); //wait on mutex if (lock->wait(30, 0)) throw gcException(ERR_IPC, "Waited too long with no response"); ret = lock->result; } return ret; }
void MenuItem::removeMenuItemInventoryItem(quint32 menuItemInventoryItemId) { for(int i = 0; i < m_menuItemInventoryItems.length(); i++) { if(m_menuItemInventoryItems[i]->property("id").toUInt() == menuItemInventoryItemId) { MenuItemInventoryItem *item = m_menuItemInventoryItems[i]; m_menuItemInventoryItems.removeAt(i); QStringList historyEntry; historyEntry << "RemoveMenuItemInventoryItem" << item->property("id").toString() << item->property("menuCategoryId").toString() << item->property("menuItemId").toString(); Pos::instance()->appendToMenuHistory(serializeList(historyEntry)); disconnect(item, SIGNAL(costChanged(float)), this, SLOT(fireCostChanged())); menuItemInventoryItemsChanged(menuItemInventoryItems()); hasInventoryChanged(hasInventory()); fireCostChanged(); return; } }
/** * Serialize a benc object into a bencoded string. * This is not exposed to the world because it is expected that one would * know what type they are serializing to begin with. * * @param writer a Writer which to write the output to. * @param obj the object to serialize. * @return -2 if the type of object cannot be determined, otherwise * whatever is returned by the Writer. */ static int32_t serializeGeneric(const struct Writer* writer, const Object* obj) { switch (obj->type) { case Object_STRING: return serializeString(writer, obj->as.string); break; case Object_DICT: return serializeDictionary(writer, obj->as.dictionary); break; case Object_LIST: return serializeList(writer, obj->as.list); break; case Object_INTEGER: return serializeint64_t(writer, obj->as.number); break; default: return -2; } }
QString Serializer::serialize(QVariant v, int indent, bool parentIsArray) { if (!v.isValid()) return QString(); // invalid if (v.type()==QVariant::List) return serializeList(v.toList(), indent, parentIsArray); else if (v.type()==QVariant::Map) return serializeMap(v.toMap(), indent, parentIsArray); else if (v.type()==QVariant::String || v.type()==QVariant::ByteArray) return serializeString(v.toString()); else if (v.type()==QVariant::Double) return serializeDouble(v.toDouble()); else if (v.type()==QVariant::Bool) return v.toBool() ? "true" : "false"; else if (v.type() == QVariant::ULongLong ) return QString::number(v.value<qulonglong>()); else if (v.canConvert<qlonglong>()) return QString::number(v.value<qlonglong>()); else if (v.canConvert<QString>()) // this will catch QDate, QDateTime, QUrl, ... return serializeString(v.toString()); else return QString(); }