Renamed Ftp::ListingDirectory::getFilenames() to getListing()

This commit is contained in:
Laurent Gomila 2012-10-26 17:09:43 +02:00
parent 49f37ee8b3
commit c02e375399
3 changed files with 9 additions and 9 deletions

View File

@ -102,8 +102,8 @@ int main()
// Print the contents of the current server directory // Print the contents of the current server directory
sf::Ftp::ListingResponse response = server.getDirectoryListing(); sf::Ftp::ListingResponse response = server.getDirectoryListing();
std::cout << response << std::endl; std::cout << response << std::endl;
std::vector<std::string> filenames = response.getFilenames(); const std::vector<std::string>& names = response.getListing();
for (std::vector<std::string>::const_iterator it = filenames.begin(); it != filenames.end(); ++it) for (std::vector<std::string>::const_iterator it = names.begin(); it != names.end(); ++it)
std::cout << *it << std::endl; std::cout << *it << std::endl;
break; break;
} }

View File

@ -232,19 +232,19 @@ public :
ListingResponse(const Response& response, const std::vector<char>& data); ListingResponse(const Response& response, const std::vector<char>& data);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Return the array of filenames /// \brief Return the array of directory/file names
/// ///
/// \return Array containing the requested filenames /// \return Array containing the requested listing
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
const std::vector<std::string>& getFilenames() const; const std::vector<std::string>& getListing() const;
private : private :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
std::vector<std::string> m_filenames; ///< Filenames extracted from the data std::vector<std::string> m_listing; ///< Directory/file names extracted from the data
}; };

View File

@ -124,7 +124,7 @@ Ftp::Response(response)
std::string::size_type lastPos = 0; std::string::size_type lastPos = 0;
for (std::string::size_type pos = paths.find("\r\n"); pos != std::string::npos; pos = paths.find("\r\n", lastPos)) for (std::string::size_type pos = paths.find("\r\n"); pos != std::string::npos; pos = paths.find("\r\n", lastPos))
{ {
m_filenames.push_back(paths.substr(lastPos, pos - lastPos)); m_listing.push_back(paths.substr(lastPos, pos - lastPos));
lastPos = pos + 2; lastPos = pos + 2;
} }
} }
@ -132,9 +132,9 @@ Ftp::Response(response)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
const std::vector<std::string>& Ftp::ListingResponse::getFilenames() const const std::vector<std::string>& Ftp::ListingResponse::getListing() const
{ {
return m_filenames; return m_listing;
} }