54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
#ifndef INPUTPROCESSOR_H
|
|
#define INPUTPROCESSOR_H
|
|
|
|
#include <fstream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
class InputProcessor {
|
|
public:
|
|
/**
|
|
* @brief Constructs a new InputProcessor, initializing internal fields to
|
|
* defaults
|
|
*
|
|
*/
|
|
InputProcessor();
|
|
/**
|
|
* @brief Prompts the user for the file to open, and opens it as an ifstream
|
|
*
|
|
* @return true The stream was opened successfully
|
|
* @return false The stream was unable to be opened successfully
|
|
*/
|
|
bool openStream();
|
|
/**
|
|
* @brief Closes the open file stream
|
|
*
|
|
*/
|
|
void closeStream();
|
|
/**
|
|
* @brief Reads all words from the currently open stream, and stores them
|
|
* internally in a vector of all words
|
|
*
|
|
*/
|
|
void read();
|
|
/**
|
|
* @brief Returns all the words parsed by this InputProcessor
|
|
*
|
|
* @return std::vector<std::string> The vector containing all words
|
|
*/
|
|
std::vector<std::string> getAllWords() const;
|
|
|
|
private:
|
|
/**
|
|
* @brief The raw file input stream to read from
|
|
*
|
|
*/
|
|
std::ifstream _fileIn;
|
|
/**
|
|
* @brief The vector containing all parsed words from the input stream
|
|
*
|
|
*/
|
|
std::vector<std::string> _allWords;
|
|
};
|
|
|
|
#endif // INPUTPROCESSOR_H
|