include/Zycore/Format.h(3)

πŸ“¦
version 1.5.2 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

πŸ’… include/Zycore/Format.h πŸ’…

okay bestie, welcome to the Library Functions Manual page for include/Zycore/Format.h, and ngl this one is a total glow-up for number-to-string conversions. it's literally giving "make numbers pretty, but fast". let's get into it πŸŽ€


✨ NAME ✨

include/Zycore/Format.h β€” no cap, that's the whole name, she's lowkey mysterious like that πŸ¦‹


🌸 SYNOPSIS 🌸

first up, the includes you gotta pull in, periodt:

#include <Zycore/Status.h>
#include <Zycore/String.h>
#include <Zycore/Types.h>

🫢 Functions 🫢

here's the whole squad, and yes we're listing every single one because we are not skipping anybody:

ZYAN_INLINE ZyanU64 ZyanAbsI64 (ZyanI64 x)
ZYCORE_EXPORT ZyanStatus ZyanStringInsertFormat (ZyanString *string,
    ZyanUSize index, const char *format,...)
ZYCORE_EXPORT ZyanStatus ZyanStringInsertDecU (ZyanString *string,
    ZyanUSize index, ZyanU64 value, ZyanU8 padding_length)
ZYCORE_EXPORT ZyanStatus ZyanStringInsertDecS (ZyanString *string,
    ZyanUSize index, ZyanI64 value, ZyanU8 padding_length, ZyanBool
    force_sign, const ZyanString *prefix)
ZYCORE_EXPORT ZyanStatus ZyanStringInsertHexU (ZyanString *string,
    ZyanUSize index, ZyanU64 value, ZyanU8 padding_length, ZyanBool
    uppercase)
ZYCORE_EXPORT ZyanStatus ZyanStringInsertHexS (ZyanString *string,
    ZyanUSize index, ZyanI64 value, ZyanU8 padding_length, ZyanBool
    uppercase, ZyanBool force_sign, const ZyanString *prefix)
ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanStringAppendFormat
    (ZyanString *string, const char *format,...)
ZYCORE_EXPORT ZyanStatus ZyanStringAppendDecU (ZyanString *string,
    ZyanU64 value, ZyanU8 padding_length)
ZYCORE_EXPORT ZyanStatus ZyanStringAppendDecS (ZyanString *string,
    ZyanI64 value, ZyanU8 padding_length, ZyanBool force_sign, const
    ZyanStringView *prefix)
ZYCORE_EXPORT ZyanStatus ZyanStringAppendHexU (ZyanString *string,
    ZyanU64 value, ZyanU8 padding_length, ZyanBool uppercase)
ZYCORE_EXPORT ZyanStatus ZyanStringAppendHexS (ZyanString *string,
    ZyanI64 value, ZyanU8 padding_length, ZyanBool uppercase, ZyanBool
    force_sign, const ZyanStringView *prefix)

🧚 Detailed Description 🧚

she provides helper functions for performant number to string conversion. that's it, that's the vibe β€” fast, glam, functional πŸ’–


πŸ‘‘ Function Documentation πŸ‘‘

🌈 ZYAN_INLINE ZyanU64 ZyanAbsI64 (ZyanI64 x)

get the absolute value of a 64 bit int. bestie said "no negativity allowed" πŸ’€βœ¨

Parameters

  • x β€” the value to process.

Returns

  • the absolute, unsigned value.

also this one gracefully deals with the special case of x being INT_MAX β€” she's polite like that πŸŽ€


🌈 ZYCORE_EXPORT ZyanStatus ZyanStringAppendDecS (ZyanString * string, ZyanI64 value, ZyanU8 padding_length, ZyanBool force_sign, const ZyanStringView * prefix)

formats the given signed ordinal value to its decimal text-representation and appends it to the string. signed decimals, appending, main character energy πŸ‘‘

Parameters

  • string β€” a pointer to the ZyanString instance.
  • value β€” the value.
  • padding_length β€” padds the converted value with leading zeros, if the number of chars is less than the padding_length.
  • force_sign β€” set ZYAN_TRUE, to force printing of the + sign for positive numbers.
  • prefix β€” the string to use as prefix or ZYAN_NULL, if not needed.

Returns

  • a zyan status code.
⚠️ this function will fail if the ZYAN_STRING_IS_IMMUTABLE flag is set for the specified ZyanString instance. immutable means immutable, bestie, no exceptions πŸ’€

🌈 ZYCORE_EXPORT ZyanStatus ZyanStringAppendDecU (ZyanString * string, ZyanU64 value, ZyanU8 padding_length)

formats the given unsigned ordinal value to its decimal text-representation and appends it to the string. no minus sign in sight, we love a positive queen 🌸

Parameters

  • string β€” a pointer to the ZyanString instance.
  • value β€” the value.
  • padding_length β€” padds the converted value with leading zeros, if the number of chars is less than the padding_length.

Returns

  • a zyan status code.
⚠️ this function will fail if the ZYAN_STRING_IS_IMMUTABLE flag is set for the specified ZyanString instance. don't fight it 🫢

🌈 ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanStringAppendFormat (ZyanString * string, const char * format, ...)

appends formatted text to the destination string. yes it's ZYAN_REQUIRES_LIBC, so keep that in mind, she's got dependencies πŸ’…

Parameters

  • string β€” the destination string.
  • format β€” the format string.
  • ... β€” the format arguments.

Returns

  • a zyan status code.
⚠️ this function will fail if the ZYAN_STRING_IS_IMMUTABLE flag is set for the specified ZyanString instance. periodt.

🌈 ZYCORE_EXPORT ZyanStatus ZyanStringAppendHexS (ZyanString * string, ZyanI64 value, ZyanU8 padding_length, ZyanBool uppercase, ZyanBool force_sign, const ZyanStringView * prefix)

formats the given signed ordinal value to its hexadecimal text-representation and appends it to the string. hex + signed + appending = the holy trinity ✨

Parameters

  • string β€” a pointer to the ZyanString instance.
  • value β€” the value.
  • padding_length β€” padds the converted value with leading zeros, if the number of chars is less than the padding_length.
  • uppercase β€” set ZYAN_TRUE to use uppercase letters ('A'-'F') instead of lowercase ones ('a'-'f').
  • force_sign β€” set ZYAN_TRUE, to force printing of the + sign for positive numbers.
  • prefix β€” the string to use as prefix or ZYAN_NULL, if not needed.

Returns

  • a zyan status code.
⚠️ this function will fail if the ZYAN_STRING_IS_IMMUTABLE flag is set for the specified ZyanString instance.

🌈 ZYCORE_EXPORT ZyanStatus ZyanStringAppendHexU (ZyanString * string, ZyanU64 value, ZyanU8 padding_length, ZyanBool uppercase)

formats the given unsigned ordinal value to its hexadecimal text-representation and appends it to the string. 0xDEADBEEF girlies rise up πŸ”₯

Parameters

  • string β€” a pointer to the ZyanString instance.
  • value β€” the value.
  • padding_length β€” padds the converted value with leading zeros, if the number of chars is less than the padding_length.
  • uppercase β€” set ZYAN_TRUE to use uppercase letters ('A'-'F') instead of lowercase ones ('a'-'f').

Returns

  • a zyan status code.
⚠️ this function will fail if the ZYAN_STRING_IS_IMMUTABLE flag is set for the specified ZyanString instance.

🌈 ZYCORE_EXPORT ZyanStatus ZyanStringInsertDecS (ZyanString * string, ZyanUSize index, ZyanI64 value, ZyanU8 padding_length, ZyanBool force_sign, const ZyanString * prefix)

formats the given signed ordinal value to its decimal text-representation and inserts it to the string. note: insert, not append β€” she's putting it exactly where you tell her πŸ“

Parameters

  • string β€” a pointer to the ZyanString instance.
  • index β€” the insert index.
  • value β€” the value.
  • padding_length β€” padds the converted value with leading zeros, if the number of chars is less than the padding_length.
  • force_sign β€” set ZYAN_TRUE, to force printing of the + sign for positive numbers.
  • prefix β€” the string to use as prefix or ZYAN_NULL, if not needed.

Returns

  • a zyan status code.
⚠️ this function will fail if the ZYAN_STRING_IS_IMMUTABLE flag is set for the specified ZyanString instance.

🌈 ZYCORE_EXPORT ZyanStatus ZyanStringInsertDecU (ZyanString * string, ZyanUSize index, ZyanU64 value, ZyanU8 padding_length)

formats the given unsigned ordinal value to its decimal text-representation and inserts it to the string. unsigned decimals sliding in at index like they own the place πŸ’œ

Parameters

  • string β€” a pointer to the ZyanString instance.
  • index β€” the insert index.
  • value β€” the value.
  • padding_length β€” padds the converted value with leading zeros, if the number of chars is less than the padding_length.

Returns

  • a zyan status code.
⚠️ this function will fail if the ZYAN_STRING_IS_IMMUTABLE flag is set for the specified ZyanString instance.

🌈 ZYCORE_EXPORT ZyanStatus ZyanStringInsertFormat (ZyanString * string, ZyanUSize index, const char * format, ...)

inserts formatted text in the destination string at the given index. printf vibes but make it positional πŸŽ€

Parameters

  • string β€” the destination string.
  • index β€” the insert index.
  • format β€” the format string.
  • ... β€” the format arguments.

Returns

  • a zyan status code.
⚠️ this function will fail if the ZYAN_STRING_IS_IMMUTABLE flag is set for the specified ZyanString instance.

🌈 ZYCORE_EXPORT ZyanStatus ZyanStringInsertHexS (ZyanString * string, ZyanUSize index, ZyanI64 value, ZyanU8 padding_length, ZyanBool uppercase, ZyanBool force_sign, const ZyanString * prefix)

formats the given signed ordinal value to its hexadecimal text-representation and inserts it to the string. signed hex that knows exactly where it belongs ✨

Parameters

  • string β€” a pointer to the ZyanString instance.
  • index β€” the insert index.
  • value β€” the value.
  • padding_length β€” padds the converted value with leading zeros, if the number of chars is less than the padding_length.
  • uppercase β€” set ZYAN_TRUE to use uppercase letters ('A'-'F') instead of lowercase ones ('a'-'f').
  • force_sign β€” set ZYAN_TRUE, to force printing of the + sign for positive numbers.
  • prefix β€” the string to use as prefix or ZYAN_NULL, if not needed.

Returns

  • a zyan status code.
⚠️ this function will fail if the ZYAN_STRING_IS_IMMUTABLE flag is set for the specified ZyanString instance.

🌈 ZYCORE_EXPORT ZyanStatus ZyanStringInsertHexU (ZyanString * string, ZyanUSize index, ZyanU64 value, ZyanU8 padding_length, ZyanBool uppercase)

formats the given unsigned ordinal value to its hexadecimal text-representation and inserts it to the string. hex, unsigned, inserted, iconic 🌈

Parameters

  • string β€” a pointer to the ZyanString instance.
  • index β€” the insert index.
  • value β€” the value.
  • padding_length β€” padds the converted value with leading zeros, if the number of chars is less than the padding_length.
  • uppercase β€” set ZYAN_TRUE to use uppercase letters ('A'-'F') instead of lowercase ones ('a'-'f').

Returns

  • a zyan status code.
⚠️ this function will fail if the ZYAN_STRING_IS_IMMUTABLE flag is set for the specified ZyanString instance.

πŸ¦‹ Author πŸ¦‹

generated automatically by Doxygen for Zycore from the source code. doxygen did her little thing, no notes πŸ’…


okay and that's the whole page!! final sign-off, mwah πŸ˜­πŸ’– this one came from Zycore, Version 1.5.2.0, for the page include/Zycore/Format.h(3) β€” slay, ate, no crumbs left, periodt πŸ‘‘πŸŒΈ

πŸ“¦ where this page comes from