8#include "helpers/_countof.h"
9#include "helpers/formatstring.h"
10#include "helpers/titlecase.h"
64 std::string tokenAsString =
"";
95 std::ostringstream output;
97 size_t numTokens = tokens.size();
99 for (
size_t tokenIndex = 0; tokenIndex < numTokens; ++tokenIndex)
108 output << tokenAsString;
111 if (tokenIndex + 2 < numTokens)
Declaration of the Interpreter_Class class used in the Interpreter Pattern.
std::string Interpret(IntList tokens)
Given an array of integer tokens, convert the tokens into a single std::string of space-delimited wor...
std::string _InterpretToken(int token)
Helper method to convert the token into its corresponding word or punctuation mark.
static const char * _commonwords[]
The 40 most common words in English (in order but that doesn't really matter here)....
The namespace containing all Design Pattern Examples implemented in C++.
std::vector< int > IntList
Alias to make it easier to work with a vector of vectors of int.
std::string formatstring(const char *fmt,...)
Use the given string and arguments to return a buffer containing the formatted string....
std::string titlecase(const std::string &s)
Convert the first word (or only word) in the given string to lowercase then make the first letter upp...