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

Binded classes of lipsum-cpp C wrapper. More...

#include "core.h"

Go to the source code of this file.

Macros

#define LIPSUMC_BINDED_H
#define LPSM_USELIPSUM   true
#define LPSM_NO_USELIPSUM   false
#define LPSM_HTML   true
#define LPSM_MARKDOWN   false
#define LPSM_OBJECT   true
#define LPSM_ARRAY   false
#define LPSM_BOLD   true
#define LPSM_ITALIC   false
#define LPSM_ORDERED   true
#define LPSM_UNORDERED   false
#define LPSM_IPV4   false
#define LPSM_IPV6   true
#define LPSM_NOPORT   false
#define LPSM_PORT   true

Typedefs

typedef void * lpsm_GeneratorHandle
 A handle to a lipsum::Generator.
typedef enum lpsm_CaseSlugCase lpsm_CaseSlugCase
 Cases used by lpsm_Generator_case_slug().
typedef enum lpsm_CodeLanguage lpsm_CodeLanguage
 Languages used by lpsm_Generator_code().

Enumerations

enum  lpsm_CaseSlugCase {
  LPSM_CSC_CAMEL_CASE = 0 , LPSM_CSC_PASCAL_CASE , LPSM_CSC_SNAKE_CASE , LPSM_CSC_SHOUTY_CASE ,
  LPSM_CSC_KEBAB_CASE , LPSM_CSC_TRAIN_CASE
}
 Cases used by lpsm_Generator_case_slug(). More...
enum  lpsm_CodeLanguage {
  LPSM_CODEL_CPP = 0 , LPSM_CODEL_PYTHON , LPSM_CODEL_RUST , LPSM_CODEL_C ,
  LPSM_CODEL_JAVASCRIPT
}
 Languages used by lpsm_Generator_code(). More...

Functions

LIPSUMC_API lpsm_GeneratorHandle lpsm_Generator (const char *path)
 Create a lipsum::Generator.
LIPSUMC_API lpsm_GeneratorHandle lpsm_GeneratorSeeded (const char *path, int seed)
 Create a lipsum::Generator.
LIPSUMC_API void lpsm_GeneratorDestroy (lpsm_GeneratorHandle handle)
 Delete a lipsum::Generator.
LIPSUMC_API void lpsm_Generator_load_source (lpsm_GeneratorHandle handle, const char *path)
 Reload a source.
LIPSUMC_API void lpsm_Generator_load_seed (lpsm_GeneratorHandle handle, int seed)
 Reload a seed.
LIPSUMC_API void lpsm_Generator_change_setting (lpsm_GeneratorHandle handle, const char *setting, int minValue, int maxValue)
 Change a setting.
LIPSUMC_API void lpsm_Generator_toggle_lazy (lpsm_GeneratorHandle handle)
 Toggle the lazy flag.
LIPSUMC_API char * lpsm_Generator_word (lpsm_GeneratorHandle handle, int num)
 Generate words.
LIPSUMC_API char * lpsm_Generator_fragment (lpsm_GeneratorHandle handle)
 Generate a sentence fragment.
LIPSUMC_API char * lpsm_Generator_sentence (lpsm_GeneratorHandle handle, int num, bool useLipsum)
 Generate sentences.
LIPSUMC_API char * lpsm_Generator_paragraph (lpsm_GeneratorHandle handle, int num, bool useLipsum)
 Generate paragraphs.
LIPSUMC_API char * lpsm_Generator_text (lpsm_GeneratorHandle handle, bool useLipsum)
 Generate a random number of random paragraphs.
LIPSUMC_API char * lpsm_Generator_scramble (lpsm_GeneratorHandle handle, int length, char minChar, char maxChar)
 Generate a random character scramble.
LIPSUMC_API char * lpsm_Generator_url (lpsm_GeneratorHandle handle)
 Generate a URL.
LIPSUMC_API char * lpsm_Generator_plain_url (lpsm_GeneratorHandle handle)
 Generate a plain URL.
LIPSUMC_API char * lpsm_Generator_email (lpsm_GeneratorHandle handle)
 Generate an email.
LIPSUMC_API char * lpsm_Generator_slug (lpsm_GeneratorHandle handle, char separator)
 Generate a slug.
LIPSUMC_API char * lpsm_Generator_case_slug (lpsm_GeneratorHandle handle, lpsm_CaseSlugCase case_)
 Generate a case slug.
LIPSUMC_API char * lpsm_Generator_code (lpsm_GeneratorHandle handle, lpsm_CodeLanguage lang)
 Generate a code block.
LIPSUMC_API char * lpsm_Generator_ip_addr (lpsm_GeneratorHandle handle, bool useIpv6, bool usePort)
 Generate an IP address.
LIPSUMC_API char * lpsm_Generator_phone_number (lpsm_GeneratorHandle handle)
 Generate a phone number.
LIPSUMC_API char * lpsm_Generator_fmt_paragraph (lpsm_GeneratorHandle handle, int num, bool useLipsum, bool useHtml)
 Generate Markdown or HTML paragraphs.
LIPSUMC_API char * lpsm_Generator_fmt_text (lpsm_GeneratorHandle handle, int numElements, bool useHtml)
 Generate a Markdown or HTML document.
LIPSUMC_API char * lpsm_Generator_fmt_header (lpsm_GeneratorHandle handle, int level, bool useHtml)
 Generate a Markdown or HTML header.
LIPSUMC_API char * lpsm_Generator_fmt_emphasis (lpsm_GeneratorHandle handle, bool isBold, bool useHtml)
 Generate an emphasized Markdown or HTML sentence.
LIPSUMC_API char * lpsm_Generator_fmt_link (lpsm_GeneratorHandle handle, bool useHtml)
 Generate a Markdown or HTML link.
LIPSUMC_API char * lpsm_Generator_fmt_list (lpsm_GeneratorHandle handle, bool ordered, bool useHtml)
 Generate a Markdown or HTML list.
LIPSUMC_API char * lpsm_Generator_xml (lpsm_GeneratorHandle handle, int choices)
 Generate an XML document.
LIPSUMC_API char * lpsm_Generator_json (lpsm_GeneratorHandle handle, int maxDepth, bool isObject)
 Generate a JSON object or array.
LIPSUMC_API char * lpsm_Generator_json_value (lpsm_GeneratorHandle handle, int maxDepth)
 Generate a JSON value.
LIPSUMC_API char * lpsm_Generator_csv (lpsm_GeneratorHandle handle)
 Generate a CSV document.

Detailed Description

Binded classes of lipsum-cpp C wrapper.

This declares binded classes as typedefs and their functions. This file is under the BSD Zero-Clause License.

Author
LambBread from github.com

Typedef Documentation

◆ lpsm_CaseSlugCase

Cases used by lpsm_Generator_case_slug().

Since
0.5.1

Types of cases used by lpsm_Generator_case_slug(). Includes various types such as camel case, snake case, etc.

◆ lpsm_CodeLanguage

Languages used by lpsm_Generator_code().

Since
0.5.1

Programming languages that lpsm_Generator_code() can generate, such as C++ and Python.

◆ lpsm_GeneratorHandle

typedef void* lpsm_GeneratorHandle

A handle to a lipsum::Generator.

Since
0.4.4

This is a typedef of a pointer to a lipsum::Generator.

Examples
CWrapper.c.

Enumeration Type Documentation

◆ lpsm_CaseSlugCase

Cases used by lpsm_Generator_case_slug().

Since
0.5.1

Types of cases used by lpsm_Generator_case_slug(). Includes various types such as camel case, snake case, etc.

◆ lpsm_CodeLanguage

Languages used by lpsm_Generator_code().

Since
0.5.1

Programming languages that lpsm_Generator_code() can generate, such as C++ and Python.

Function Documentation

◆ lpsm_Generator()

LIPSUMC_API lpsm_GeneratorHandle lpsm_Generator ( const char * path)

Create a lipsum::Generator.

Since
0.4.4

This function creates a pointer pointing to a lipsum::Generator.

Note
The lpsm_GeneratorHandle should be manually deleted with lpsm_GeneratorDestroy().
Parameters
pathThe filepath or name of the lorem ipsum source.
Returns
lpsm_GeneratorHandle The lipsum::Generator.
See also
lipsum::Source::load
Examples
CWrapper.c.

◆ lpsm_Generator_case_slug()

LIPSUMC_API char * lpsm_Generator_case_slug ( lpsm_GeneratorHandle handle,
lpsm_CaseSlugCase case_ )

Generate a case slug.

Since
0.5.1

Call lipsum::Generator::case_slug() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
case_The case.
Returns
char* The case slug.

◆ lpsm_Generator_change_setting()

LIPSUMC_API void lpsm_Generator_change_setting ( lpsm_GeneratorHandle handle,
const char * setting,
int minValue,
int maxValue )

Change a setting.

Since
0.4.5

Call lipsum::Generator::change_setting() on the specified handle.

Parameters
handleThe lpsm_GeneratorHandle to use.
settingThe name of the setting.
minValueThe new minimum value of the setting.
maxValueThe new maximum value of the setting.
Examples
CWrapper.c.

◆ lpsm_Generator_code()

LIPSUMC_API char * lpsm_Generator_code ( lpsm_GeneratorHandle handle,
lpsm_CodeLanguage lang )

Generate a code block.

Since
0.5.1

Call lipsum::Generator::code() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
langThe language chosen.
Returns
char* The code block.

◆ lpsm_Generator_csv()

LIPSUMC_API char * lpsm_Generator_csv ( lpsm_GeneratorHandle handle)

Generate a CSV document.

Since
0.5.2

Call lipsum::Generator::csv() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
Returns
char* The CSV document.

◆ lpsm_Generator_email()

LIPSUMC_API char * lpsm_Generator_email ( lpsm_GeneratorHandle handle)

Generate an email.

Since
0.5.1

Call lipsum::Generator::email() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
Returns
char* The email.

◆ lpsm_Generator_fmt_emphasis()

LIPSUMC_API char * lpsm_Generator_fmt_emphasis ( lpsm_GeneratorHandle handle,
bool isBold,
bool useHtml )

Generate an emphasized Markdown or HTML sentence.

Since
0.4.6

Call lipsum::Generator::fmt_emphasis() on the specified handle. Formerly known as lpsm_Generator_md_emphasis().

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
isBoldWhether the sentence is bold or italic.
useHtmlWhether HTML should be outputted instead of Markdown.
Returns
char* The random emphasized Markdown sentence.

◆ lpsm_Generator_fmt_header()

LIPSUMC_API char * lpsm_Generator_fmt_header ( lpsm_GeneratorHandle handle,
int level,
bool useHtml )

Generate a Markdown or HTML header.

Since
0.4.6

Call lipsum::Generator::fmt_header() on the specified handle. Formerly known as lpsm_Generator_md_header().

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
levelThe level of the heading.
useHtmlWhether HTML should be outputted instead of Markdown.
Returns
char* The random Markdown header.

◆ lpsm_Generator_fmt_link()

LIPSUMC_API char * lpsm_Generator_fmt_link ( lpsm_GeneratorHandle handle,
bool useHtml )

Generate a Markdown or HTML link.

Since
0.4.6

Call lipsum::Generator::fmt_link() on the specified handle. Formerly known as lpsm_Generator_md_link().

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
useHtmlWhether HTML should be outputted instead of Markdown.
Returns
char* The random Markdown link.

◆ lpsm_Generator_fmt_list()

LIPSUMC_API char * lpsm_Generator_fmt_list ( lpsm_GeneratorHandle handle,
bool ordered,
bool useHtml )

Generate a Markdown or HTML list.

Since
0.4.6

Call lipsum::Generator::fmt_list() on the specified handle. Formerly known as lpsm_Generator_md_list().

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
orderedWhether the list is ordered.
useHtmlWhether HTML should be outputted instead of Markdown.
Returns
char* The random Markdown list.

◆ lpsm_Generator_fmt_paragraph()

LIPSUMC_API char * lpsm_Generator_fmt_paragraph ( lpsm_GeneratorHandle handle,
int num,
bool useLipsum,
bool useHtml )

Generate Markdown or HTML paragraphs.

Since
0.4.4

Call lipsum::Generator::fmt_paragraph() on the specified handle. Formerly known as lpsm_Generator_md_paragraph().

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
numThe number of paragraphs.
useLipsumWhether "Lorem ipsum..." should start the paragraph.
useHtmlWhether HTML should be outputted instead of Markdown.
Returns
char* The random Markdown paragraph.

◆ lpsm_Generator_fmt_text()

LIPSUMC_API char * lpsm_Generator_fmt_text ( lpsm_GeneratorHandle handle,
int numElements,
bool useHtml )

Generate a Markdown or HTML document.

Since
0.4.4

Call lipsum::Generator::fmt_text() on the specified handle. Formerly known as lpsm_Generator_md_text().

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
numElementsThe number of elements (paragraph, list, heading) in the document.
useHtmlWhether HTML should be outputted instead of Markdown.
Returns
char* The random Markdown document.
Examples
CWrapper.c.

◆ lpsm_Generator_fragment()

LIPSUMC_API char * lpsm_Generator_fragment ( lpsm_GeneratorHandle handle)

Generate a sentence fragment.

Since
0.4.4

Call lipsum::Generator::fragment() on the specified handle. Formerly lpsm_Generator_sentence_fragment().

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
Returns
char* The random sentence fragment.

◆ lpsm_Generator_ip_addr()

LIPSUMC_API char * lpsm_Generator_ip_addr ( lpsm_GeneratorHandle handle,
bool useIpv6,
bool usePort )

Generate an IP address.

Since
0.5.3

Call lipsum::Generator::ip_addr() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
useIpv6Whether to use IPv6.
usePortWhether to add a port.
Returns
char* The IP address.

◆ lpsm_Generator_json()

LIPSUMC_API char * lpsm_Generator_json ( lpsm_GeneratorHandle handle,
int maxDepth,
bool isObject )

Generate a JSON object or array.

Since
0.4.4

Call lipsum::Generator::json() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
maxDepthMaximum depth of recursion.
isObjectWhether to output an object (true) or an array (false).
Returns
char* The random JSON object or array.

◆ lpsm_Generator_json_value()

LIPSUMC_API char * lpsm_Generator_json_value ( lpsm_GeneratorHandle handle,
int maxDepth )

Generate a JSON value.

Since
0.5.0

Call lipsum::Generator::json_value() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
maxDepthThe maximum level of recursion.
Returns
char* The random JSON value.

◆ lpsm_Generator_load_seed()

LIPSUMC_API void lpsm_Generator_load_seed ( lpsm_GeneratorHandle handle,
int seed )

Reload a seed.

Since
0.5.0

Reload the seed of m_Gen.

Parameters
handleThe lpsm_GeneratorHandle to use.
seedThe seed specified.

◆ lpsm_Generator_load_source()

LIPSUMC_API void lpsm_Generator_load_source ( lpsm_GeneratorHandle handle,
const char * path )

Reload a source.

Since
0.4.5

Reload the specified lorem ipsum source into m_Source. If path is invalid, it will print a warning and default to the standard lorem-ipsum source.

Parameters
handleThe lpsm_GeneratorHandle to use.
pathThe filepath or name of the lorem ipsum source.
See also
lipsum::Source::load

◆ lpsm_Generator_paragraph()

LIPSUMC_API char * lpsm_Generator_paragraph ( lpsm_GeneratorHandle handle,
int num,
bool useLipsum )

Generate paragraphs.

Since
0.4.4

Call lipsum::Generator::paragraph() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
numThe number of paragraphs.
useLipsumWhether "Lorem ipsum..." should start the paragraph(s).
Returns
char* The random paragraph(s).

◆ lpsm_Generator_phone_number()

LIPSUMC_API char * lpsm_Generator_phone_number ( lpsm_GeneratorHandle handle)

Generate a phone number.

Since
0.5.3

Call lipsum::Generator::phone_number() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
Returns
char* The phone number.

◆ lpsm_Generator_plain_url()

LIPSUMC_API char * lpsm_Generator_plain_url ( lpsm_GeneratorHandle handle)

Generate a plain URL.

Since
0.4.5

Call lipsum::Generator::plain_url() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
Returns
char* The plain URL.

◆ lpsm_Generator_scramble()

LIPSUMC_API char * lpsm_Generator_scramble ( lpsm_GeneratorHandle handle,
int length,
char minChar,
char maxChar )

Generate a random character scramble.

Since
0.4.5

Call lipsum::Generator::scramble() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
lengthThe number of characters.
minCharThe lowest-valued ASCII character that can appear.
maxCharThe highest-valued ASCII character than can appear.
Returns
char* The character scramble.

◆ lpsm_Generator_sentence()

LIPSUMC_API char * lpsm_Generator_sentence ( lpsm_GeneratorHandle handle,
int num,
bool useLipsum )

Generate sentences.

Since
0.4.4

Call lipsum::Generator::sentence() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
numThe number of sentences.
useLipsumWhether "Lorem ipsum..." should start the sentence(s).
Returns
char* The random sentence(s).

◆ lpsm_Generator_slug()

LIPSUMC_API char * lpsm_Generator_slug ( lpsm_GeneratorHandle handle,
char separator )

Generate a slug.

Since
0.4.5

Call lipsum::Generator::slug() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
separatorThe separator character.
Returns
char* The slug.

◆ lpsm_Generator_text()

LIPSUMC_API char * lpsm_Generator_text ( lpsm_GeneratorHandle handle,
bool useLipsum )

Generate a random number of random paragraphs.

Since
0.4.4

Call lipsum::Generator::text() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
useLipsumWhether "Lorem ipsum..." should start the paragraph(s).
Returns
char* The random text.

◆ lpsm_Generator_toggle_lazy()

LIPSUMC_API void lpsm_Generator_toggle_lazy ( lpsm_GeneratorHandle handle)

Toggle the lazy flag.

Since
0.5.3

Call lipsum::Generator::toggle_lazy() on the specified handle.

Parameters
handleThe lpsm_GeneratorHandle to use.

◆ lpsm_Generator_url()

LIPSUMC_API char * lpsm_Generator_url ( lpsm_GeneratorHandle handle)

Generate a URL.

Since
0.4.5

Call lipsum::Generator::url() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
Returns
char* The URL.

◆ lpsm_Generator_word()

LIPSUMC_API char * lpsm_Generator_word ( lpsm_GeneratorHandle handle,
int num )

Generate words.

Since
0.4.4

Call lipsum::Generator::word() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
numThe number of words.
Returns
char* The random word.
Examples
CWrapper.c.

◆ lpsm_Generator_xml()

LIPSUMC_API char * lpsm_Generator_xml ( lpsm_GeneratorHandle handle,
int choices )

Generate an XML document.

Since
0.4.4

Call lipsum::Generator::xml() on the specified handle.

Note
This function returns a heap-allocated char* which should be deleted with lpsm_DeleteString().
Warning
Do not use a string returned from this function after deleting it with lpsm_DeleteString() or call lpsm_DeleteString() on it twice, as this will cause a use-after-free or double-free and potentially crash your program.
Parameters
handleThe lpsm_GeneratorHandle to use.
choicesThe number of choices (start element, end element, add data element) that are made.
Returns
char* The random XML document.

◆ lpsm_GeneratorDestroy()

LIPSUMC_API void lpsm_GeneratorDestroy ( lpsm_GeneratorHandle handle)

Delete a lipsum::Generator.

Since
0.4.4

This function deletes a lpsm_GeneratorHandle allocated with lpsm_Generator().

Warning
Do not call lpsm_GeneratorDestroy on the same handle twice or use the handle after deleting it, as that would be a double-free or use-after-free and would potentially crash the program.
Parameters
handleThe lpsm_GeneratorHandle to delete.
Examples
CWrapper.c.

◆ lpsm_GeneratorSeeded()

LIPSUMC_API lpsm_GeneratorHandle lpsm_GeneratorSeeded ( const char * path,
int seed )

Create a lipsum::Generator.

Since
0.5.0

This function creates a pointer pointing to a lipsum::Generator.

Note
The lpsm_GeneratorHandle should be manually deleted with lpsm_GeneratorDestroy().
Parameters
pathThe filepath or name of the lorem ipsum source.
seedThe seed specified.
Returns
lpsm_GeneratorHandle The lipsum::Generator.
See also
lipsum::Source::load