void ServerInfo::processServer(const RootEntity &svr) { Atlas::Message::Element element; if (!svr->copyAttr("ruleset", element) && element.isString()) { _ruleset = element.String(); } else { return; } _name = svr->getName(); if (!svr->copyAttr("clients", element) && element.isInt()) { _clients = (int)element.Int(); } else { return; } if (!svr->copyAttr("server", element) && element.isString()) { _server = element.String(); } else { return; } if (!svr->copyAttr("uptime", element) && element.isFloat()) { _uptime = element.Float(); } else { return; } m_status = VALID; if (!svr->copyAttr("entities", element) && element.isInt()) { _entities = element.Int(); } if (!svr->copyAttr("version", element) && element.isString()) { m_version = element.String(); } if (!svr->copyAttr("builddate", element) && element.isString()) { m_buildDate = element.String(); } if (!svr->copyAttr("assets", element) && element.isList()) { for (auto& url : element.List()) { if (url.isString()) { m_assets.emplace_back(url.String()); } } } }
Py::Object CyPy_Element::wrap(Atlas::Message::Element value) { if (value.isNone()) { return Py::None(); } else if (value.isString()) { return Py::String(value.String()); } else if (value.isInt()) { return Py::Long(value.Int()); } else if (value.isFloat()) { return Py::Float(value.Float()); } else if (value.isList()) { return CyPy_ElementList::wrap(value.List()); } else { return CyPy_ElementMap::wrap(value.Map()); } }
void ServerInfo::processServer(const RootEntity &svr) { Atlas::Message::Element element; if (!svr->copyAttr("ruleset", element) && element.isString()) { _ruleset = element.asString(); } else { return; } _name = svr->getName(); if (!svr->copyAttr("clients", element) && element.isInt()) { _clients = element.asInt(); } else { return; } if (!svr->copyAttr("server", element) && element.isString()) { _server = element.asString(); } else { return; } if (!svr->copyAttr("uptime", element) && element.isFloat()) { _uptime = element.asFloat(); } else { return; } m_status = VALID; if (!svr->copyAttr("entities", element) && element.isInt()) { _entities = element.asInt(); } if (!svr->copyAttr("version", element) && element.isString()) { m_version = element.asString(); } if (!svr->copyAttr("builddate", element) && element.isString()) { m_buildDate = element.asString(); } }