2025-10-16 12:04:50 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @file Mw/String.h
|
|
|
|
|
* @brief String utilities
|
2025-10-16 12:04:50 +00:00
|
|
|
*/
|
|
|
|
|
#ifndef __MW_STRING_H__
|
|
|
|
|
#define __MW_STRING_H__
|
|
|
|
|
|
|
|
|
|
#include <Mw/MachDep.h>
|
2025-10-17 19:44:55 +00:00
|
|
|
#include <Mw/TypeDefs.h>
|
2025-10-16 12:04:50 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief Duplicates a string
|
|
|
|
|
* @param str String
|
|
|
|
|
* @return String
|
2025-10-16 12:04:50 +00:00
|
|
|
*/
|
2025-11-20 09:26:18 +00:00
|
|
|
MWDECL char* MwStringDuplicate(const char* str);
|
2025-10-16 12:04:50 +00:00
|
|
|
|
|
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief Concatenates 2 strings
|
|
|
|
|
* @param str1 String
|
|
|
|
|
* @param str2 String
|
|
|
|
|
* @return String
|
2025-10-16 12:04:50 +00:00
|
|
|
*/
|
|
|
|
|
MWDECL char* MwStringConcat(const char* str1, const char* str2);
|
|
|
|
|
|
2025-10-17 19:44:55 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief Converts size to string
|
|
|
|
|
* @param out Output
|
|
|
|
|
* @param size Size
|
2025-10-17 19:44:55 +00:00
|
|
|
*/
|
|
|
|
|
MWDECL void MwStringSize(char* out, MwOffset size);
|
|
|
|
|
|
|
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief Converts time to string
|
|
|
|
|
* @param out Output
|
|
|
|
|
* @param t Time
|
2025-10-17 19:44:55 +00:00
|
|
|
*/
|
|
|
|
|
MWDECL void MwStringTime(char* out, time_t t);
|
|
|
|
|
|
2026-03-30 11:14:33 -07:00
|
|
|
/*!
|
|
|
|
|
* @brief Prints up to n characters into a buffer
|
|
|
|
|
* @param out Buffer
|
|
|
|
|
* @param size Max size
|
|
|
|
|
*/
|
|
|
|
|
MWDECL void MwPrintIntoBuffer(char* out, MwU32 size, const char* fmt, ...);
|
|
|
|
|
|
2025-10-16 12:04:50 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|