string.h revision 14380feae039b4eb5a70e053e186000c706ff358
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/* $Id$ */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/** @file
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * IPRT - Internal RTStr header.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright (C) 2006-2007 Oracle Corporation
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * available from http://www.virtualbox.org. This file is free software;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * General Public License (GPL) as published by the Free Software
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * The contents of this file may alternatively be used under the terms
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * of the Common Development and Distribution License Version 1.0
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * VirtualBox OSE distribution, in which case the provisions of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL are applicable instead of those of the GPL.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You may elect to license modified versions of this file under the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * terms and conditions of either the GPL or the CDDL or both.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#ifndef ___internal_string_h
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define ___internal_string_h
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#include <iprt/string.h>
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncRT_C_DECLS_BEGIN
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/** @def RTSTR_STRICT
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Enables strict assertions on bad string encodings.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#ifdef DOXYGEN_RUNNING
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# define RTSTR_STRICT
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#endif
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*#define RTSTR_STRICT*/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#ifdef RTSTR_STRICT
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# define RTStrAssertMsgFailed(msg) AssertMsgFailed(msg)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync# define RTStrAssertMsgReturn(expr, msg, rc) AssertMsgReturn(expr, msg, rc)
#else
# define RTStrAssertMsgFailed(msg) do { } while (0)
# define RTStrAssertMsgReturn(expr, msg, rc) do { if (!(expr)) return rc; } while (0)
#endif
size_t rtstrFormatRt(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **ppszFormat, va_list *pArgs,
int cchWidth, int cchPrecision, unsigned fFlags, char chArgSize);
size_t rtstrFormatType(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **ppszFormat, va_list *pArgs,
int cchWidth, int cchPrecision, unsigned fFlags, char chArgSize);
#ifdef RT_WITH_ICONV_CACHE
void rtStrIconvCacheInit(struct RTTHREADINT *pThread);
void rtStrIconvCacheDestroy(struct RTTHREADINT *pThread);
#endif
/**
* Indexes into RTTHREADINT::ahIconvs
*/
typedef enum RTSTRICONV
{
/** UTF-8 to the locale codeset (LC_CTYPE). */
RTSTRICONV_UTF8_TO_LOCALE = 0,
/** The locale codeset (LC_CTYPE) to UTF-8. */
RTSTRICONV_LOCALE_TO_UTF8,
/** UTF-8 to the filesystem codeset - if different from the locale codeset. */
RTSTRICONV_UTF8_TO_FS,
/** The filesystem codeset to UTF-8. */
RTSTRICONV_FS_TO_UTF8,
/** The end of the valid indexes. */
RTSTRICONV_END
} RTSTRICONV;
int rtStrConvert(const char *pchInput, size_t cchInput, const char *pszInputCS,
char **ppszOutput, size_t cbOutput, const char *pszOutputCS,
unsigned cFactor, RTSTRICONV enmCacheIdx);
const char *rtStrGetLocaleCodeset(void);
int rtUtf8Length(const char *psz, size_t cch, size_t *pcuc, size_t *pcchActual);
RT_C_DECLS_END
#endif