Spinning Topp Logo BlackTopp Studios
inc
ftpcommand.h
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 
41 #ifndef _networkftpcommand_h
42 #define _networkftpcommand_h
43 
44 #include "Network/ftpmessage.h"
45 
46 namespace Mezzanine
47 {
48  namespace Network
49  {
50  ///////////////////////////////////////////////////////////////////////////////
51  /// @brief A command that can be issued to an FTP server.
52  ///////////////////////////////////////
54  {
55  protected:
56  /// @internal
57  /// @brief The arguments of the command. Not all commands require this.
59  /// @internal
60  /// @brief The command being issued.
62  public:
63  /// @brief Invalid constructor.
64  /// @remarks This will initialize with an invalid command.
65  FTPCommand();
66  /// @brief String constructor.
67  /// @param Command The complete command to be parsed.
68  FTPCommand(const String& Command);
69  /// @brief Descriptive constructor.
70  /// @param Type The command to be issued.
71  /// @param Args The arguments of the command. Not all commands require this.
72  FTPCommand(const Network::FTPCommandList Type, const String& Args = "");
73  /// @brief Class destructor.
74  ~FTPCommand();
75 
76  ///////////////////////////////////////////////////////////////////////////////
77  // Core Operations
78 
79  /// @copydoc FTPMessage::Compose() const
80  String Compose() const;
81  /// @copydoc FTPMessage::Decompose(const String&)
82  Boole Decompose(const String& Message);
83  /// @copydoc FTPMessage::Decompose(StringIterator&,const StringIterator)
84  Boole Decompose(StringIterator& CurrIt, const StringIterator EndIt);
85 
86  ///////////////////////////////////////////////////////////////////////////////
87  // Utility
88 
89  /// @brief Converts a FTPCommandList enum value to it's text representation.
90  /// @remarks This will only return the base command, without any arguments.
91  /// @param Command The command enum value to be converted.
92  /// @return Returns a String containing the converted enum value.
93  static String ConvertCommand(const Network::FTPCommandList Command);
94  /// @brief Converts a text FTP command to it's FTPCommandList enum value.
95  /// @remarks This expects just the command without any arguments.
96  /// @param Command The text representation of the command to be converted.
97  /// @return Returns a FTPCommandList enum value representing the converted String.
98  static Network::FTPCommandList ConvertCommand(const String& Command);
99 
100  /// @brief Sets the command to be sent.
101  /// @param Command The command to be set.
102  void SetCommand(const Network::FTPCommandList Command);
103  /// @brief Gets the comment to be sent.
104  /// @return Returns an FTPCommandList enum value representing the specific command to be sent.
105  Network::FTPCommandList GetCommand() const;
106  /// @brief Sets the arguments for the command to be issued.
107  /// @remarks Not all commands require arguments, and some commands require very specific formats for their arguments.
108  /// @param Args The arguments for the command.
109  void SetArguments(const String& Args);
110  /// @brief Gets the arguments for the command to be issued.
111  /// @return Returns a const String reference to the arguments for the command.
112  const String& GetArguments() const;
113  };//FTPCommand
114  }//Network
115 }//Mezzanine
116 
117 #endif
FTPCommandList CommandType
The command being issued.
Definition: ftpcommand.h:61
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
A command that can be issued to an FTP server.
Definition: ftpcommand.h:53
A base class for text based messages exchanged between FTP clients and servers.
Definition: ftpmessage.h:54
FTPCommandList
This enum is a listing of the commands that can be issued to an FTP server.
String::const_iterator StringIterator
Convenience typedef for String iterators.
Definition: ftpmessage.h:58
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
String CommandArgs
The arguments of the command. Not all commands require this.
Definition: ftpcommand.h:58
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159