/*
 * 2004 Utah High School Programming Contest, University of Utah
 * Take-Home Problem
 *
 * Cipher.hpp
 *
 * This file contains the definition of the (abstract) Cipher class.
 */

#ifndef CIPHER_HPP
#define CIPHER_HPP

#include <string>

using namespace std;

/**
 * A Cipher represents a possible decryption method: e.g., a particular
 * rotation algorithm or a particular substitution algorithm.  The primary
 * method of a Cipher is `decipher', which applies the Cipher's algorithm to a
 * given string.  The Cipher itself is only responsible for applying its
 * algorithm.  A Puzzle object is responsible for deciding whether or not a
 * Cipher's algorithm is actually the "right" one for decrypting a message.
 *
 * The Cipher class is actually an abstract class: it defines a common
 * interface for all kinds of ciphers, but does not itself provide any
 * implementation for ciphers.  The actual details of creating ciphers and
 * implementing decryption algorithms are contained in the subclasses of
 * Cipher: RotationCipher and SubstitutionCipher.
 */
class Cipher {
public:
    /**
     * Destroy a Cipher object.
     */
    virtual ~Cipher();
    
    /**
     * Modify the given string by applying this Cipher's algorithm to it.  This
     * may or may not actually decrypt the string into English text; the caller
     * must decide if this Cipher's algorithm actually "worked."
     *
     * @param cryptogram    the string to be modified
     */
    virtual void decipher(string& cryptogram) const = 0;
};

#endif // CIPHER_HPP

// End of file.

