document only char* variant of all string utility functions (don't use wxChar nor templates; they're only confusing; add a note for the funcmacro_string group that all functions documented also have wchar_t variants; document wxStrnlen()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-01-31 13:58:45 +00:00
parent 6ac7ddd334
commit 8f182e0a3c
2 changed files with 31 additions and 14 deletions

View File

@@ -13,5 +13,11 @@
Global string functions and macros. See wxString for the wxWidgets string class.
Please note that all functions of this group which are documented to take @c char*
arrays are overloaded with @c wchar_t* variants.
Note also that wxWidgets wraps all standard CRT functions, even if the wrappers
are not (all) documented.
*/

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wxcrt.h
// Purpose: interface of global functions
// Purpose: interface of global CRT wrapper functions
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
@@ -10,7 +10,7 @@
//@{
/**
@return @true if the pointer is either @NULL or points to an empty string,
Returns @true if the pointer @a p is either @NULL or points to an empty string,
@false otherwise.
@header{wx/wxcrt.h}
@@ -26,6 +26,21 @@ bool wxIsEmpty(const char* p);
*/
size_t wxStrlen(const char* p);
/**
This is a safe version of standard function @e strlen(): it returns the length
of the string s in bytes if this length is smaller than @a maxlen bytes.
Otherwise it returns @a maxlen.
The @a maxlen parameter makes it easier to avoid array indexing errors
since you are sure that wxStrnlen() won't read any memory exceeding the
@c "*(p+maxlen)" location.
@since 2.9.0
@header{wx/wxcrt.h}
*/
size_t wxStrnlen(const char* p, size_t maxlen);
/**
This function complements the standard C function @e stricmp() which
performs case-insensitive comparison.
@@ -49,7 +64,7 @@ int wxStrcmp(const char* p1, const char* p2);
int wxStricmp(const char* p1, const char* p2);
/**
@deprecated Use wxString instead.
@deprecated Use wxString::operator== instead.
This macro is defined as:
@@ -116,8 +131,6 @@ wxArrayString wxStringTokenize(const wxString& string,
Notice that this function is similar to the OpenBSD strlcpy() function.
The template parameter @a T can be either @c char or @c wchar_t.
@param dst
Destination buffer of size (greater or) equal to @a n.
@param src
@@ -129,12 +142,11 @@ wxArrayString wxStringTokenize(const wxString& string,
then there was not enough space in the destination buffer and the
string was truncated.
@since{2.9.0}
@since 2.9.0
@header{wx/wxcrt.h}
*/
template <typename T>
size_t wxStrlcpy(T *dst, const T *src, size_t n);
size_t wxStrlcpy(char *dst, const char *src, size_t n);
/**
This function replaces the dangerous standard function @e sprintf() and is
@@ -149,7 +161,7 @@ size_t wxStrlcpy(T *dst, const T *src, size_t n);
@header{wx/wxcrt.h}
*/
int wxSnprintf(wxChar* buf, size_t len, const wxChar* format, ...);
int wxSnprintf(char* buf, size_t len, const char* format, ...);
/**
The same as wxSnprintf() but takes a @c va_list argument instead of an
@@ -166,8 +178,7 @@ int wxSnprintf(wxChar* buf, size_t len, const wxChar* format, ...);
@header{wx/wxcrt.h}
*/
int wxVsnprintf(wxChar* buf, size_t len,
const wxChar* format, va_list argPtr);
int wxVsnprintf(char* buf, size_t len, const char* format, va_list argPtr);
//@}