lipsum-cpp 0.5.4
A basic library written in C++ for generating placeholder Lorem Ipsum text.
Loading...
Searching...
No Matches
lipsum Namespace Reference

This is the main namespace of lipsum-cpp. More...

Namespaces

namespace  internal
 This namespace contains functions only used internally by other functions.

Classes

struct  ArgVec2
 Store data for inputting into functions. More...
class  Source
 Class for multi-source generation. More...
class  Generator
 Main class of lipsum-cpp. More...
struct  GeneratorSettings
 Settings for lipsum::Generator. More...

Enumerations

enum  GeneratorFlags : bool {
  USELIPSUM = true , NO_USELIPSUM = false , HTML = true , MARKDOWN = false ,
  OBJECT = true , ARRAY = false , BOLD = true , ITALIC = false ,
  ORDERED = true , UNORDERED = false , IPV4 = false , IPV6 = true ,
  NOPORT = false , PORT = true
}
 Flags for lipsum-cpp. More...
enum class  CaseSlugCase : int {
  CamelCase = 0 , PascalCase , SnakeCase , ShoutyCase ,
  KebabCase , TrainCase
}
 Cases used by lipsum::Generator::case_slug(). More...
enum class  CodeLanguage : int {
  Cpp = 0 , Python , Rust , C ,
  JavaScript
}
 Languages used by lipsum::Generator::code(). More...
enum class  Format : int {
  Plain = 0 , Markdown , HTML , JSON ,
  XML
}
 Types of formats. More...

Functions

LIPSUM_API std::string GenerateDefaultLipsumSentence ()
 Generate the beginning Lorem Ipsum sentence.
LIPSUM_API int CountWords (const std::string &str)
 Count the number of words in a string.
LIPSUM_API int CountSentenceFragments (const std::string &str)
 Count the number of sentence fragments in a string.
LIPSUM_API int CountSentences (const std::string &str)
 Count the number of sentences in a string.
LIPSUM_API int CountParagraphs (const std::string &str, Format format=Format::Plain)
 Count the number of paragraphs or elements in a string.
LIPSUM_API std::string ConvertFormat (const std::string &str, Format format1=Format::Plain, Format format2=Format::HTML)
 Convert a string between two formats.

Detailed Description

This is the main namespace of lipsum-cpp.

This namespace contains all the code for the C++ usage of lipsum-cpp.

Enumeration Type Documentation

◆ CaseSlugCase

enum class lipsum::CaseSlugCase : int
strong

Cases used by lipsum::Generator::case_slug().

Since
0.5.1

Types of cases used by lipsum::Generator::case_slug(). Includes various types such as camel case, snake case, etc.

◆ CodeLanguage

enum class lipsum::CodeLanguage : int
strong

Languages used by lipsum::Generator::code().

Since
0.5.1

Programming languages that lipsum::Generator::code() can generate, such as C++ and Python.

◆ Format

enum class lipsum::Format : int
strong

Types of formats.

Since
0.4.6

Types of formats used in lipsum::CountParagraphs() and lipsum::ConvertFormat(). In lipsum::CountParagraphs(), Plain is counting plain text, Markdown is counting Markdown or HTML, and HTML is counting HTML explicitly. Formerly known as CountParaMethod.

◆ GeneratorFlags

Flags for lipsum-cpp.

Since
0.5.0

This stores various flags for convenience.

Function Documentation

◆ ConvertFormat()

std::string lipsum::ConvertFormat ( const std::string & str,
Format format1 = Format::Plain,
Format format2 = Format::HTML )

Convert a string between two formats.

Since
0.5.4

Attempt a conversion of a string between the two specified formats.

Parameters
strThe string inputted.
format1The string's format. By default plain text.
format2The destination format. By default HTML.
Returns
std::string The converted string.
Examples
Misc.cpp.

◆ CountParagraphs()

int lipsum::CountParagraphs ( const std::string & str,
Format format = Format::Plain )

Count the number of paragraphs or elements in a string.

Since
0.4.6

Count the number of tab characters in a non-formatted string, double newlines in Markdown/HTML strings, and elements in HTML strings.

Parameters
strThe string inputted.
formatThe format the string is in. By default non-formatted.
Returns
int The number of paragraphs.
Examples
Misc.cpp.

◆ CountSentenceFragments()

int lipsum::CountSentenceFragments ( const std::string & str)

Count the number of sentence fragments in a string.

Since
0.4.6

Count the number of commas, semicolons, hyphens, and colons in a string, excluding usage in Markdown. (i.e. hyphen at start of line, or in parentheses)

Parameters
strThe string inputted.
Returns
int The number of sentence fragments.
Examples
Misc.cpp.

◆ CountSentences()

int lipsum::CountSentences ( const std::string & str)

Count the number of sentences in a string.

Since
0.3.0

Count the number of periods, exclamation marks, and question marks in a string, ignoring usage in Markdown URLs. (i.e. in parentheses)

Parameters
strThe string inputted.
Returns
int The number of sentences.
Examples
Advanced.cpp, and Misc.cpp.

◆ CountWords()

int lipsum::CountWords ( const std::string & str)

Count the number of words in a string.

Since
0.3.8

Count the number of words in a string using alphanumeric characters, hyphens, plus-signs, and apostrophes, excluding words within parentheses.

Parameters
strThe string inputted.
Returns
int The number of words.
Examples
Advanced.cpp, and Misc.cpp.

◆ GenerateDefaultLipsumSentence()

std::string lipsum::GenerateDefaultLipsumSentence ( )

Generate the beginning Lorem Ipsum sentence.

Since
0.0.5

Returns the sentence "Lorem ipsum dolor sit amet, consectetur adipiscing elit."

Returns
std::string The default Lorem Ipsum sentence.