size_t decodeType(const std::vector<std::string>& args__, size_t index__, SpeedReference& value__) { size_t index_cursor__ = index__; index_cursor__ += decodeType(args__, index_cursor__, value__.speed_units); index_cursor__ += decodeType(args__, index_cursor__, value__.speed_reference); return index_cursor__ - index__; }
size_t decodeType(const std::vector<std::string>& args__, size_t index__, SensorInfoTuple& value__) { size_t index_cursor__ = index__; index_cursor__ += decodeType(args__, index_cursor__, value__.sensor_id); index_cursor__ += decodeType(args__, index_cursor__, value__.sensor_vendor); index_cursor__ += decodeType(args__, index_cursor__, value__.sensor_model); return index_cursor__ - index__; }
size_t decodeType(const std::vector<std::string>& args__, size_t index__, PositionType& value__) { size_t index_cursor__ = index__; index_cursor__ += decodeType(args__, index_cursor__, value__.latitude); index_cursor__ += decodeType(args__, index_cursor__, value__.longitude); index_cursor__ += decodeType(args__, index_cursor__, value__.depth); index_cursor__ += decodeType(args__, index_cursor__, value__.altitude); return index_cursor__ - index__; }
size_t decodeArgs(const std::vector<std::string>& args__, size_t index__) { size_t index_cursor__ = index__; index_cursor__ += decodeType(args__, index_cursor__, latitude); index_cursor__ += decodeType(args__, index_cursor__, longitude); index_cursor__ += decodeType(args__, index_cursor__, timeout); index_cursor__ += decodeType(args__, index_cursor__, z_reference); index_cursor__ += decodeType(args__, index_cursor__, speed_reference); return index_cursor__ - index__; }
size_t decodeType(const std::vector<std::string>& args__, size_t index__, std::vector<Type>& value__) { size_t index_cursor__ = index__; unsigned size__ = 0; index_cursor__ += decodeType(args__, index_cursor__, size__); value__.resize(size__); for (unsigned i = 0; i < size__; ++i) { index_cursor__ += decodeType(args__, index_cursor__, value__[i]); } return index_cursor__ - index__; }
void MessageBuilder::decodeMessageFields(String message, char& flags, String& address_from, String& address_to, char& type,char& sub_type,String& data){ flags = decodeFlags(message); address_from =decodeAddressFrom(message); address_to =decodeAddressTo(message); type = decodeType(message); sub_type = decodeSubType(message); data = decodeData(message); }
size_t decodeType(const std::vector<std::string>& args__, size_t index__, Maneuver*& value__) { size_t index_cursor__ = index__; std::string name__; index_cursor__ += decodeType(args__, index_cursor__, name__); if (name__ == "Goto") value__ = new Goto(); else if (name__ == "StationKeeping") value__ = new StationKeeping(); else throw InvalidValue(); index_cursor__ += value__->decodeArgs(args__, index_cursor__); return index_cursor__ - index__; }
std::shared_ptr<RPCVariable> RPCDecoder::decodeParameter(std::shared_ptr<std::vector<char>>& packet, uint32_t& position) { try { RPCVariableType type = decodeType(packet, position); std::shared_ptr<RPCVariable> variable(new RPCVariable(type)); if(type == RPCVariableType::rpcString || type == RPCVariableType::rpcBase64) { variable->stringValue = _decoder.decodeString(packet, position); } else if(type == RPCVariableType::rpcInteger) { variable->integerValue = _decoder.decodeInteger(packet, position); } else if(type == RPCVariableType::rpcFloat) { variable->floatValue = _decoder.decodeFloat(packet, position); } else if(type == RPCVariableType::rpcBoolean) { variable->booleanValue = _decoder.decodeBoolean(packet, position); } else if(type == RPCVariableType::rpcArray) { variable->arrayValue = decodeArray(packet, position); } else if(type == RPCVariableType::rpcStruct) { variable->structValue = decodeStruct(packet, position); } return variable; } catch(const std::exception& ex) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(Exception& ex) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } return std::shared_ptr<RPCVariable>(); }
void CFileBrowser::on_tree_itemSelectionChanged() { QTreeWidgetItem * item; int column; struct link_stat st; int err; QString fileStats; item = ui->tree->currentItem(); column = 0; err = link()->stat( item->text(1).toLocal8Bit().constData(), &st); fileStats.clear(); if ( err >= 0 ){ fileStats = QString(decodeType(st.st_mode)); if ( st.st_mode & LINK_S_IROTH ){ fileStats += 'r'; } else { fileStats += '-'; } if ( st.st_mode & LINK_S_IWOTH ){ fileStats += 'w'; } else { fileStats += '-'; } if ( st.st_mode & LINK_S_IXOTH ){ fileStats += 'x'; } else { fileStats += '-'; } if ( st.st_mode & LINK_S_IRGRP ){ fileStats += 'r'; } else { fileStats += '-'; } if ( st.st_mode & LINK_S_IWGRP ){ fileStats += 'w'; } else { fileStats += '-'; } if ( st.st_mode & LINK_S_IXGRP ){ fileStats += 'x'; } else { fileStats += '-'; } if ( st.st_mode & LINK_S_IRUSR ){ fileStats += 'r'; } else { fileStats += '-'; } if ( st.st_mode & LINK_S_IWUSR ){ fileStats += 'w'; } else { fileStats += '-'; } if ( st.st_mode & LINK_S_IXUSR ){ fileStats += 'x'; } else { fileStats += '-'; } if ( (st.st_mode & LINK_S_IFMT) == LINK_S_IFREG){ fileStats += "\t" + QString::number(st.st_size, 10); } } else { fileStats = "Unable to load"; } ui->pathLabel->setText( fileStats + "\t" + item->text(1) ); ui->tree->setCurrentItem(item, column); if ( (st.st_mode & LINK_S_IFMT) == LINK_S_IFDIR){ on_tree_itemActivated(item, column); } }
int ObjectFactory::decodeObject( const char* data, int* idx, std::string* uuid, Object::Type* type, PropList* props ) { int arity = 0; if( ei_decode_tuple_header(data, idx, &arity) || (arity != 3) ) { return -EINVAL; } if( decodeString(data, idx, uuid) || decodeType(data, idx, type) || (*type <= Object::Invalid) || (*type >= Object::Max) ) { return -EINVAL; } return decode( data, idx, *type, props ); }