41 #ifndef _networkftpresponse_cpp
42 #define _networkftpresponse_cpp
44 #include "Network/ftpresponse.h"
46 #include "stringtool.h"
60 this->
AddLine(ConvertedCode +
" " + Description);
72 StringIterator ActualEnd = ( EndIt - CurrIt > 3 ? CurrIt + 3 : EndIt );
73 while( CurrIt != ActualEnd )
76 NumStr.push_back( *CurrIt );
82 if( NumStr.size() == 3 ) {
92 while( CurrIt != EndIt )
98 Line.push_back( *CurrIt );
111 { ResponseStream << (*LineIt) <<
"\r\n"; }
112 return ResponseStream.str();
118 return this->
Decompose(CurrIt,Message.end());
128 if( !this->
GetResponseLine(CurrIt,EndIt,NewLine) && NewLine.size() > 3 )
136 if( NewLine[3] ==
'-' ) {
138 while( CurrIt != EndIt )
147 if( NewLine.size() >= 4 &&
157 }
else if( NewLine[3] ==
' ' ) {
172 case 110:
case 120:
case 125:
case 150:
174 case 200:
case 202:
case 211:
case 212:
175 case 213:
case 214:
case 215:
case 220:
176 case 221:
case 225:
case 226:
case 227:
177 case 228:
case 229:
case 230:
case 231:
178 case 232:
case 234:
case 250:
case 257:
180 case 331:
case 332:
case 350:
182 case 421:
case 425:
case 426:
case 430:
183 case 434:
case 450:
case 451:
case 452:
185 case 501:
case 502:
case 503:
case 504:
186 case 530:
case 532:
case 550:
case 551:
189 case 631:
case 632:
case 633:
Boole GetResponseLine(StringIterator &CurrIt, const StringIterator EndIt, String &Line)
Parses/verifies a single line of a FTP response.
FTPResponseCode ResponseCode
The 3 digit response code that identifies the nature of the response from the server.
Network::FTPResponseCode GetCode() const
Gets the code describing this response.
bool Boole
Generally acts a single bit, true or false.
LineContainer ResponseLines
Container storing each line in this response.
~FTPResponse()
Class destructor.
Boole Decompose(const String &Message)
Populates the members of this class with data from a text FTP message.
Not an actual return code, used in error conditions.
Whole GetNumLines() const
Gets the number of lines in this response.
std::stringstream StringStream
A Datatype used for streaming operations with strings.
Boole IsMultiline() const
Checks to see if this is a multi-line response.
const String & GetLine(const Whole Index) const
Gets a line in this response.
Boole ParseResponseCode(StringIterator CurrIt, const StringIterator EndIt)
Converts the first three characters in the range into a 3 digit response code.
LineContainer::const_iterator ConstLineIterator
Const Iterator type for each line in a response.
FTPResponseCode
This enum is a listing of the response codes that can be used in response to FTP commands.
FTPResponse()
Invalid constructor.
String Compose() const
Creates a completed message that can be sent across an FTP connection.
void SetCode(const Network::FTPResponseCode Code)
Sets the code describing this response.
String::const_iterator StringIterator
Convenience typedef for String iterators.
void ClearLines()
Clears all lines from this response.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Boole IsEndOfLine(const StringIterator CurrIt) const
Checks to see if a parsing iterator is at a Telnet End-Of-Line.
static Boole CodeIsValid(const Whole Code)
Checks if a number is a valid response code.
std::string String
A datatype used to a series of characters.
void AddLine(const String &NewLine)
Adds a new line to this response.