23 return ((ch ==
' ') || (ch ==
'\t') || (ch ==
'\v') || (ch ==
'\r') || (ch ==
'\n'));
53 listWords.push_back(strWord);
61 std::string strParagraph;
70 while ((*pszInput !=
'\0') && (*pszInput !=
'\r') && (*pszInput !=
'\n'))
72 strParagraph += *pszInput;
76 listParagraphs.push_back(strParagraph);
79 if (*pszInput ==
'\r')
82 if (*pszInput ==
'\n')
87 else if (*pszInput ==
'\n')
97 const char *pszProbe = psz;
98 std::vector<std::string> listWords;
99 bool fLineStart =
true;
101 std::string strIndent;
102 size_t wordcount = 0;
103 size_t wordindex = 0;
122 wordcount = listWords.size();
128 for (
size_t x = 0; x < indent; x++)
133 while (wordindex < wordcount)
143 strLine += listWords[wordindex];
149 size_t newsize = strLine.size() + 1 + listWords[wordindex].size();
151 if (newsize <= width)
154 strLine += listWords[wordindex];
162 printf(
"%s\n", strLine.c_str());
172 if ((strLine.size() > 0) || (wordcount == 0))
174 printf(
"%s\n", strLine.c_str());
183 std::vector<std::string> listParagraphs;
188 len = listParagraphs.size();
189 for (
size_t x = 0; x < len; x++)
static void SplitInputIntoParagraphs(const char *pszInput, std::vector< std::string > &listParagraphs)
static bool IsWhitespace(char ch)
static void PrintParagraph(const char *psz, size_t width)
static void SplitParagraphIntoWords(const char *pszLine, std::vector< std::string > &listWords)
void PrettyPrint(const char *pszInput, size_t width)