2013-03-22 05:30:31 +04:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $Id: triostr.h,v 1.18 2010/01/26 13:02:02 breese Exp $
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
|
|
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
|
|
|
|
* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef TRIO_TRIOSTR_H
|
|
|
|
#define TRIO_TRIOSTR_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Documentation is located in triostr.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include "triodef.h"
|
|
|
|
#include "triop.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2019-11-06 17:24:51 +03:00
|
|
|
extern "C"
|
|
|
|
{
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
TRIO_HASH_NONE = 0,
|
|
|
|
TRIO_HASH_PLAIN,
|
|
|
|
TRIO_HASH_TWOSIGNED
|
|
|
|
};
|
2013-03-22 05:30:31 +04:00
|
|
|
|
|
|
|
#if !defined(TRIO_PUBLIC_STRING)
|
2019-11-06 17:24:51 +03:00
|
|
|
#if !defined(TRIO_PUBLIC)
|
|
|
|
#define TRIO_PUBLIC
|
|
|
|
#endif
|
|
|
|
#define TRIO_PUBLIC_STRING TRIO_PUBLIC
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
/*************************************************************************
|
|
|
|
* Dependencies
|
|
|
|
*/
|
2013-03-22 05:30:31 +04:00
|
|
|
|
|
|
|
#if defined(TRIO_EMBED_STRING)
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
/*
|
|
|
|
* The application that triostr is embedded in must define which functions
|
|
|
|
* it uses.
|
|
|
|
*
|
|
|
|
* The following resolves internal dependencies.
|
|
|
|
*/
|
2013-03-22 05:30:31 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
#if defined(TRIO_FUNC_XSTRING_SET)
|
|
|
|
#if !defined(TRIO_FUNC_DUPLICATE)
|
|
|
|
#define TRIO_FUNC_DUPLICATE
|
|
|
|
#endif
|
|
|
|
#endif
|
2013-03-22 05:30:31 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
#if defined(TRIO_FUNC_DUPLICATE) || defined(TRIO_FUNC_DUPLICATE_MAX) || \
|
|
|
|
defined(TRIO_FUNC_STRING_DUPLICATE) || defined(TRIO_FUNC_XSTRING_DUPLICATE)
|
|
|
|
#if !defined(TRIO_FUNC_CREATE)
|
|
|
|
#define TRIO_FUNC_CREATE
|
|
|
|
#endif
|
|
|
|
#if !defined(TRIO_FUNC_COPY_MAX)
|
|
|
|
#define TRIO_FUNC_COPY_MAX
|
|
|
|
#endif
|
|
|
|
#endif
|
2013-03-22 05:30:31 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
#if defined(TRIO_FUNC_STRING_CREATE)
|
|
|
|
#if !defined(TRIO_FUNC_STRING_DESTROY)
|
|
|
|
#define TRIO_FUNC_STRING_DESTROY
|
|
|
|
#endif
|
|
|
|
#endif
|
2013-03-22 05:30:31 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
#if defined(TRIO_FUNC_STRING_DESTROY) || defined(TRIO_FUNC_XSTRING_SET)
|
|
|
|
#if !defined(TRIO_FUNC_DESTROY)
|
|
|
|
#define TRIO_FUNC_DESTROY
|
|
|
|
#endif
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
#if defined(TRIO_FUNC_EQUAL_LOCALE) || defined(TRIO_FUNC_STRING_EQUAL) || \
|
|
|
|
defined(TRIO_FUNC_XSTRING_EQUAL)
|
|
|
|
#if !defined(TRIO_FUNC_EQUAL)
|
|
|
|
#define TRIO_FUNC_EQUAL
|
|
|
|
#endif
|
|
|
|
#endif
|
2013-03-22 05:30:31 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
#if defined(TRIO_FUNC_EQUAL_CASE) || defined(TRIO_FUNC_STRING_EQUAL_CASE) || \
|
|
|
|
defined(TRIO_FUNC_XSTRING_EQUAL_CASE)
|
|
|
|
#if !defined(TRIO_FUNC_EQUAL_CASE)
|
|
|
|
#define TRIO_FUNC_EQUAL_CASE
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_SUBSTRING_MAX) || defined(TRIO_FUNC_STRING_EQUAL_MAX) || \
|
|
|
|
defined(TRIO_FUNC_XSTRING_EQUAL_MAX)
|
|
|
|
#if !defined(TRIO_FUNC_EQUAL_MAX)
|
|
|
|
#define TRIO_FUNC_EQUAL_MAX
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_TO_DOUBLE) || defined(TRIO_FUNC_TO_FLOAT)
|
|
|
|
#if !defined(TRIO_FUNC_TO_LONG_DOUBLE)
|
|
|
|
#define TRIO_FUNC_TO_LONG_DOUBLE
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_TERMINATE)
|
|
|
|
#if !defined(TRIO_FUNC_XSTRING_APPEND_CHAR)
|
|
|
|
#define TRIO_FUNC_XSTRING_APPEND_CHAR
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_APPEND_CHAR)
|
|
|
|
#if !defined(TRIO_FUNC_STRING_SIZE)
|
|
|
|
#define TRIO_FUNC_STRING_SIZE
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
/*
|
|
|
|
* When triostr is not embedded all functions are defined.
|
2013-03-22 05:30:31 +04:00
|
|
|
*/
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
#define TRIO_FUNC_APPEND
|
|
|
|
#define TRIO_FUNC_APPEND_MAX
|
|
|
|
#define TRIO_FUNC_CONTAINS
|
|
|
|
#define TRIO_FUNC_COPY
|
|
|
|
#define TRIO_FUNC_COPY_MAX
|
|
|
|
#define TRIO_FUNC_CREATE
|
|
|
|
#define TRIO_FUNC_DESTROY
|
|
|
|
#define TRIO_FUNC_DUPLICATE
|
|
|
|
#define TRIO_FUNC_DUPLICATE_MAX
|
|
|
|
#define TRIO_FUNC_EQUAL
|
|
|
|
#define TRIO_FUNC_EQUAL_CASE
|
|
|
|
#define TRIO_FUNC_EQUAL_CASE_MAX
|
|
|
|
#define TRIO_FUNC_EQUAL_LOCALE
|
|
|
|
#define TRIO_FUNC_EQUAL_MAX
|
|
|
|
#define TRIO_FUNC_ERROR
|
|
|
|
#if !defined(TRIO_PLATFORM_WINCE)
|
|
|
|
#define TRIO_FUNC_FORMAT_DATE_MAX
|
|
|
|
#endif
|
|
|
|
#define TRIO_FUNC_HASH
|
|
|
|
#define TRIO_FUNC_INDEX
|
|
|
|
#define TRIO_FUNC_INDEX_LAST
|
|
|
|
#define TRIO_FUNC_LENGTH
|
|
|
|
#define TRIO_FUNC_LENGTH_MAX
|
|
|
|
#define TRIO_FUNC_LOWER
|
|
|
|
#define TRIO_FUNC_MATCH
|
|
|
|
#define TRIO_FUNC_MATCH_CASE
|
|
|
|
#define TRIO_FUNC_SPAN_FUNCTION
|
|
|
|
#define TRIO_FUNC_SUBSTRING
|
|
|
|
#define TRIO_FUNC_SUBSTRING_MAX
|
|
|
|
#define TRIO_FUNC_TO_DOUBLE
|
|
|
|
#define TRIO_FUNC_TO_FLOAT
|
|
|
|
#define TRIO_FUNC_TO_LONG
|
|
|
|
#define TRIO_FUNC_TO_LONG_DOUBLE
|
|
|
|
#define TRIO_FUNC_TO_LOWER
|
|
|
|
#define TRIO_FUNC_TO_UNSIGNED_LONG
|
|
|
|
#define TRIO_FUNC_TO_UPPER
|
|
|
|
#define TRIO_FUNC_TOKENIZE
|
|
|
|
#define TRIO_FUNC_UPPER
|
|
|
|
|
|
|
|
#define TRIO_FUNC_STRING_APPEND
|
|
|
|
#define TRIO_FUNC_STRING_CONTAINS
|
|
|
|
#define TRIO_FUNC_STRING_COPY
|
|
|
|
#define TRIO_FUNC_STRING_CREATE
|
|
|
|
#define TRIO_FUNC_STRING_DESTROY
|
|
|
|
#define TRIO_FUNC_STRING_DUPLICATE
|
|
|
|
#define TRIO_FUNC_STRING_EQUAL
|
|
|
|
#define TRIO_FUNC_STRING_EQUAL_CASE
|
|
|
|
#define TRIO_FUNC_STRING_EQUAL_CASE_MAX
|
|
|
|
#define TRIO_FUNC_STRING_EQUAL_MAX
|
|
|
|
#define TRIO_FUNC_STRING_EXTRACT
|
|
|
|
#if !defined(TRIO_PLATFORM_WINCE)
|
|
|
|
#define TRIO_FUNC_STRING_FORMAT_DATE_MAX
|
|
|
|
#endif
|
|
|
|
#define TRIO_FUNC_STRING_GET
|
|
|
|
#define TRIO_FUNC_STRING_INDEX
|
|
|
|
#define TRIO_FUNC_STRING_INDEX_LAST
|
|
|
|
#define TRIO_FUNC_STRING_LENGTH
|
|
|
|
#define TRIO_FUNC_STRING_LOWER
|
|
|
|
#define TRIO_FUNC_STRING_MATCH
|
|
|
|
#define TRIO_FUNC_STRING_MATCH_CASE
|
|
|
|
#define TRIO_FUNC_STRING_SIZE
|
|
|
|
#define TRIO_FUNC_STRING_SUBSTRING
|
|
|
|
#define TRIO_FUNC_STRING_TERMINATE
|
|
|
|
#define TRIO_FUNC_STRING_UPPER
|
|
|
|
|
|
|
|
#define TRIO_FUNC_XSTRING_APPEND
|
|
|
|
#define TRIO_FUNC_XSTRING_APPEND_CHAR
|
|
|
|
#define TRIO_FUNC_XSTRING_APPEND_MAX
|
|
|
|
#define TRIO_FUNC_XSTRING_CONTAINS
|
|
|
|
#define TRIO_FUNC_XSTRING_COPY
|
|
|
|
#define TRIO_FUNC_XSTRING_DUPLICATE
|
|
|
|
#define TRIO_FUNC_XSTRING_EQUAL
|
|
|
|
#define TRIO_FUNC_XSTRING_EQUAL_CASE
|
|
|
|
#define TRIO_FUNC_XSTRING_EQUAL_CASE_MAX
|
|
|
|
#define TRIO_FUNC_XSTRING_EQUAL_MAX
|
|
|
|
#define TRIO_FUNC_XSTRING_MATCH
|
|
|
|
#define TRIO_FUNC_XSTRING_MATCH_CASE
|
|
|
|
#define TRIO_FUNC_XSTRING_SET
|
|
|
|
#define TRIO_FUNC_XSTRING_SUBSTRING
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* String functions
|
|
|
|
*/
|
|
|
|
|
2013-03-22 05:30:31 +04:00
|
|
|
#if defined(TRIO_FUNC_APPEND)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_append TRIO_PROTO((char* target, TRIO_CONST char* source));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_APPEND_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_append_max TRIO_PROTO((char* target, size_t max,
|
|
|
|
TRIO_CONST char* source));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_CONTAINS)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_contains TRIO_PROTO((TRIO_CONST char* string,
|
|
|
|
TRIO_CONST char* substring));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_COPY)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_copy TRIO_PROTO((char* target, TRIO_CONST char* source));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_COPY_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_copy_max TRIO_PROTO((char* target, size_t max,
|
|
|
|
TRIO_CONST char* source));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_CREATE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_create TRIO_PROTO((size_t size));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_DESTROY)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING void trio_destroy TRIO_PROTO((char* string));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_DUPLICATE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_duplicate TRIO_PROTO((TRIO_CONST char* source));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_DUPLICATE_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_duplicate_max TRIO_PROTO((TRIO_CONST char* source, size_t max));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_EQUAL)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_equal TRIO_PROTO((TRIO_CONST char* first, TRIO_CONST char* second));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_EQUAL_CASE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_equal_case TRIO_PROTO((TRIO_CONST char* first,
|
|
|
|
TRIO_CONST char* second));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_EQUAL_CASE_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_equal_case_max TRIO_PROTO((TRIO_CONST char* first, size_t max,
|
|
|
|
TRIO_CONST char* second));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_EQUAL_LOCALE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_equal_locale TRIO_PROTO((TRIO_CONST char* first,
|
|
|
|
TRIO_CONST char* second));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_EQUAL_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_equal_max TRIO_PROTO((TRIO_CONST char* first, size_t max,
|
|
|
|
TRIO_CONST char* second));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_ERROR)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING TRIO_CONST char* trio_error TRIO_PROTO((int));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_FORMAT_DATE_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING size_t trio_format_date_max TRIO_PROTO((char* target, size_t max,
|
|
|
|
TRIO_CONST char* format,
|
|
|
|
TRIO_CONST struct tm* datetime));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_HASH)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING unsigned long trio_hash TRIO_PROTO((TRIO_CONST char* string, int type));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_INDEX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_index TRIO_PROTO((TRIO_CONST char* string, int character));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_INDEX_LAST)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_index_last TRIO_PROTO((TRIO_CONST char* string, int character));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_LENGTH)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING size_t trio_length TRIO_PROTO((TRIO_CONST char* string));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_LENGTH_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING size_t trio_length_max TRIO_PROTO((TRIO_CONST char* string, size_t max));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_LOWER)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_lower TRIO_PROTO((char* target));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_MATCH)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_match TRIO_PROTO((TRIO_CONST char* string,
|
|
|
|
TRIO_CONST char* pattern));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_MATCH_CASE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_match_case TRIO_PROTO((TRIO_CONST char* string,
|
|
|
|
TRIO_CONST char* pattern));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_SPAN_FUNCTION)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING size_t trio_span_function TRIO_PROTO((char* target, TRIO_CONST char* source,
|
|
|
|
int(*Function) TRIO_PROTO((int))));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_SUBSTRING)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_substring TRIO_PROTO((TRIO_CONST char* string,
|
|
|
|
TRIO_CONST char* substring));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_SUBSTRING_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_substring_max TRIO_PROTO((TRIO_CONST char* string, size_t max,
|
|
|
|
TRIO_CONST char* substring));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_TO_DOUBLE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING double trio_to_double TRIO_PROTO((TRIO_CONST char* source, char** endp));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_TO_FLOAT)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING float trio_to_float TRIO_PROTO((TRIO_CONST char* source, char** endp));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_TO_LONG)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING long trio_to_long TRIO_PROTO((TRIO_CONST char* source, char** endp,
|
|
|
|
int base));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_TO_LOWER)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_to_lower TRIO_PROTO((int source));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_TO_LONG_DOUBLE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING trio_long_double_t trio_to_long_double TRIO_PROTO((TRIO_CONST char* source,
|
|
|
|
char** endp));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_TO_UNSIGNED_LONG)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING unsigned long trio_to_unsigned_long TRIO_PROTO((TRIO_CONST char* source,
|
|
|
|
char** endp, int base));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_TO_UPPER)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_to_upper TRIO_PROTO((int source));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_TOKENIZE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_tokenize TRIO_PROTO((char* string, TRIO_CONST char* delimiters));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_UPPER)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_upper TRIO_PROTO((char* target));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
/*************************************************************************
|
|
|
|
* Dynamic string functions
|
|
|
|
*/
|
2013-03-22 05:30:31 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
/*
|
|
|
|
* Opaque type for dynamic strings
|
|
|
|
*/
|
2013-03-22 05:30:31 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
typedef struct _trio_string_t trio_string_t;
|
2013-03-22 05:30:31 +04:00
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_APPEND)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_append TRIO_PROTO((trio_string_t * self,
|
|
|
|
trio_string_t* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_CONTAINS)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_contains TRIO_PROTO((trio_string_t * self,
|
|
|
|
trio_string_t* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_COPY)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_copy TRIO_PROTO((trio_string_t * self,
|
|
|
|
trio_string_t* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_CREATE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING trio_string_t* trio_string_create TRIO_PROTO((int initial_size));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_DESTROY)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING void trio_string_destroy TRIO_PROTO((trio_string_t * self));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_DUPLICATE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING trio_string_t* trio_string_duplicate TRIO_PROTO((trio_string_t * other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_EQUAL)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_equal TRIO_PROTO((trio_string_t * self,
|
|
|
|
trio_string_t* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_EQUAL_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_equal_max TRIO_PROTO((trio_string_t * self, size_t max,
|
|
|
|
trio_string_t* second));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_EQUAL_CASE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_equal_case TRIO_PROTO((trio_string_t * self,
|
|
|
|
trio_string_t* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_EQUAL_CASE_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_equal_case_max TRIO_PROTO((trio_string_t * self, size_t max,
|
|
|
|
trio_string_t* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_EXTRACT)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_string_extract TRIO_PROTO((trio_string_t * self));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_FORMAT_DATE_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING size_t trio_string_format_date_max TRIO_PROTO((
|
|
|
|
trio_string_t * self, size_t max, TRIO_CONST char* format, TRIO_CONST struct tm* datetime));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_GET)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_string_get TRIO_PROTO((trio_string_t * self, int offset));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_INDEX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_string_index TRIO_PROTO((trio_string_t * self, int character));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_INDEX_LAST)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_string_index_last TRIO_PROTO((trio_string_t * self,
|
|
|
|
int character));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_LENGTH)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_length TRIO_PROTO((trio_string_t * self));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_LOWER)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_lower TRIO_PROTO((trio_string_t * self));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_MATCH)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_match TRIO_PROTO((trio_string_t * self,
|
|
|
|
trio_string_t* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_MATCH_CASE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_match_case TRIO_PROTO((trio_string_t * self,
|
|
|
|
trio_string_t* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_SIZE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_size TRIO_PROTO((trio_string_t * self));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_SUBSTRING)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_string_substring TRIO_PROTO((trio_string_t * self,
|
|
|
|
trio_string_t* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_TERMINATE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING void trio_string_terminate TRIO_PROTO((trio_string_t * self));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_STRING_UPPER)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_string_upper TRIO_PROTO((trio_string_t * self));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_APPEND)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_xstring_append TRIO_PROTO((trio_string_t * self,
|
|
|
|
TRIO_CONST char* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_APPEND_CHAR)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_xstring_append_char TRIO_PROTO((trio_string_t * self,
|
|
|
|
char character));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_APPEND_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_xstring_append_max TRIO_PROTO((trio_string_t * self,
|
|
|
|
TRIO_CONST char* other, size_t max));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_CONTAINS)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_xstring_contains TRIO_PROTO((trio_string_t * self,
|
|
|
|
TRIO_CONST char* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_COPY)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_xstring_copy TRIO_PROTO((trio_string_t * self,
|
|
|
|
TRIO_CONST char* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_DUPLICATE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING trio_string_t* trio_xstring_duplicate TRIO_PROTO((TRIO_CONST char* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_EQUAL)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_xstring_equal TRIO_PROTO((trio_string_t * self,
|
|
|
|
TRIO_CONST char* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_EQUAL_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_xstring_equal_max TRIO_PROTO((trio_string_t * self, size_t max,
|
|
|
|
TRIO_CONST char* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_EQUAL_CASE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_xstring_equal_case TRIO_PROTO((trio_string_t * self,
|
|
|
|
TRIO_CONST char* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_EQUAL_CASE_MAX)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_xstring_equal_case_max TRIO_PROTO((trio_string_t * self, size_t max,
|
|
|
|
TRIO_CONST char* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_MATCH)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_xstring_match TRIO_PROTO((trio_string_t * self,
|
|
|
|
TRIO_CONST char* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_MATCH_CASE)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING int trio_xstring_match_case TRIO_PROTO((trio_string_t * self,
|
|
|
|
TRIO_CONST char* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_SET)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING void trio_xstring_set TRIO_PROTO((trio_string_t * self, char* buffer));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TRIO_FUNC_XSTRING_SUBSTRING)
|
2019-11-06 17:24:51 +03:00
|
|
|
TRIO_PUBLIC_STRING char* trio_xstring_substring TRIO_PROTO((trio_string_t * self,
|
|
|
|
TRIO_CONST char* other));
|
2013-03-22 05:30:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* TRIO_TRIOSTR_H */
|