lipsum-cpp 0.5.4
A basic library written in C++ for generating placeholder Lorem Ipsum text.
Loading...
Searching...
No Matches
Misc.cpp
#ifndef LIPSUM_BUILD_STATIC
# define LIPSUM_IMPLEMENTATION // only for header-only usage
#endif
#include <lipsum.hpp>
int main()
{
// Print the current version of lipsum-cpp.
std::cout << LIPSUM_CPP_VERSION << '\n';
std::cout << "major " << LIPSUM_CPP_VERSION_MAJOR << " minor "
<< LIPSUM_CPP_VERSION_MINOR << " patch "
<< LIPSUM_CPP_VERSION_PATCH << " commit "
<< '\n';
// should be 4
std::cout << lpsm::CountSentences("Yes this is a test. [Testing "
"123.](https://example.com/foo-bar) "
"Testing 123. Foobar test.")
<< '\n';
"This is a test, and this is a test; testing - test, "
"test, test. "
"Lorem ipsum, dolor sit, amet.\n\n"
"- This is a list, first letter not be counted.\n"
"- Foo bar; baz - qux. (This, is not counted.)")
<< '\n';
std::cout << lpsm::CountParagraphs(gen.fmt_text(50, lpsm::HTML),
lpsm::Format::Markdown)
<< '\n';
std::cout << lpsm::CountParagraphs(gen.paragraph(50)) << '\n';
std::cout << lpsm::CountWords("Hel+lo World, Foo bar baz - qux-quuz. "
"AAAAAAAAAAAAAA'AAAAAAAAAAAAAAA. Lorem ipsum "
"dolor sit amet, aaaaaaaaaaaaaaaaaa\n\n## "
"This is a subtitle")
<< "\n\n";
std::cout << lpsm::ConvertFormat(gen.paragraph(5),
lpsm::Format::Plain,
lpsm::Format::JSON);
return 0;
}
Main class of lipsum-cpp.
Definition generator.hpp:92
std::string fmt_text(int numElements=15, bool useHtml=false)
Generate a Markdown or HTML document.
Definition generatorformats.inl:53
std::string paragraph(int num=1, bool useLipsum=true)
Generate paragraphs.
Definition generator.inl:125
Main header of lipsum-cpp.
LIPSUM_API int CountSentences(const std::string &str)
Count the number of sentences in a string.
Definition misc.inl:127
LIPSUM_API int CountSentenceFragments(const std::string &str)
Count the number of sentence fragments in a string.
Definition misc.inl:88
LIPSUM_API int CountWords(const std::string &str)
Count the number of words in a string.
Definition misc.inl:43
LIPSUM_API std::string ConvertFormat(const std::string &str, Format format1=Format::Plain, Format format2=Format::HTML)
Convert a string between two formats.
Definition misc.inl:190
LIPSUM_API int CountParagraphs(const std::string &str, Format format=Format::Plain)
Count the number of paragraphs or elements in a string.
Definition misc.inl:151
constexpr const char * LIPSUM_CPP_VERSION
The current version of lipsum-cpp.
Definition version.hpp:23
constexpr const char * LIPSUM_CPP_VERSION_TIME
The time lipsum-cpp was last edited.
Definition version.hpp:80
constexpr const char * LIPSUM_CPP_VERSION_DATE
The date lipsum-cpp was last edited.
Definition version.hpp:101
constexpr const char * LIPSUM_CPP_VERSION_COMMIT
The current Git commit of lipsum-cpp.
Definition version.hpp:60
constexpr int LIPSUM_CPP_VERSION_MINOR
The current minor version of lipsum-cpp.
Definition version.hpp:41
constexpr int LIPSUM_CPP_VERSION_PATCH
The current patch version of lipsum-cpp.
Definition version.hpp:50
constexpr int LIPSUM_CPP_VERSION_MAJOR
The current major version of lipsum-cpp.
Definition version.hpp:32