diff --git a/SourceFiles/Morse.cpp b/SourceFiles/Morse.cpp index 8d5e8dc..e31667d 100644 --- a/SourceFiles/Morse.cpp +++ b/SourceFiles/Morse.cpp @@ -10,17 +10,26 @@ #include -std::string Morse::code[] {".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", //A-L - "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", //M-Z - "-----", ".----", "..---", "...--", "....-", ".....", "-....", "--...", "---..", "----."}; //0-9 - +/** + * @brief Construct a new Morse object + * + */ Morse::Morse(){ reset(); } +/** + * @brief Destroy the Morse object + * + */ Morse::~Morse(){ } +/** + * @brief Uses alphabet rules to set inputString + * + * @param input The string to be encoded + */ void Morse::setEncodeInputString(std::string input){ //Make sure the input is empty to begin std::string temp; @@ -37,6 +46,11 @@ void Morse::setEncodeInputString(std::string input){ inputString.str(temp); } +/** + * @brief Uses . & - rules to set inputString + * + * @param input The string that needs decoded + */ void Morse::setDecodeInputString(std::string input){ std::string temp; //Step through every element in input, removing everything except . or - @@ -53,14 +67,29 @@ void Morse::setDecodeInputString(std::string input){ inputString.str(temp); } +/** + * @brief Returns the string that needs encoded/decoded + * + * @return The string that needs encoded/decoded + */ std::string Morse::getInputString() const{ return inputString.str(); } +/** + * @brief Returns the encoded/decoded message + * + * @return The encoded/decoded message + */ std::string Morse::getOutputString() const{ return outputString; } +/** + * @brief Encodes inputString and stores the result in outputString + * + * @return The encoded message + */ std::string Morse::encode(){ outputString = ""; std::string temp = inputString.str(); @@ -89,11 +118,22 @@ std::string Morse::encode(){ return outputString; } +/** + * @brief Encodes the message contained in input + * + * @param input The message that needs encoded + * @return The encoded message + */ std::string Morse::encode(std::string input){ setEncodeInputString(input); return encode(); } +/** + * @brief Decodes inputString and stores the result in outputString + * + * @return The decoded message + */ std::string Morse::decode(){ outputString = ""; //Loop until you reach the end of the input @@ -128,11 +168,21 @@ std::string Morse::decode(){ return outputString; } +/** + * @brief Decodes the message contained in input + * + * @param input The message that needs decoded + * @return The decoded message + */ std::string Morse::decode(std::string input){ setDecodeInputString(input); return decode(); } +/** + * @brief Makes sure all variables are blank + * + */ void Morse::reset(){ inputString.str(""); outputString = "";