QByteArray AsPacket() const { QByteArray res = m_name; if ( m_args.size() ) { res += " " + ListJoin(m_args, " "); } res.append(CCmdSplitChar); return res; }
/*! * \brief Returns the sorted optimal path, starting from City 1. * \param city A string that represents city elements in the path. * \param separator A string that represents separators between cities in the path. * \return A string, containing sorted optimal path. * * The resulting path will be in the form \a city+\a separator+\a city+...+\a separator+\a city. * \c \%1 in \a city will be replaced by the city number. */ std::string CTSPSolver::getSortedPath(const std::string &separator) const { if (!root || route.empty() || (route.size() != nCities)) return std::string(); int i = 0; // We start from City 1 std::list<std::string> path; path.push_back("City 1"); while ((i = route.at(i)) != 0) { path.push_back(getCityName("City", i+1)); } // And finish in City 1, too path.push_back("City 1"); return ListJoin(path, separator); }