| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wxcrt.h |
| 3 | // Purpose: interface of global functions |
| 4 | // Author: wxWidgets team |
| 5 | // RCS-ID: $Id$ |
| 6 | // Licence: wxWindows license |
| 7 | ///////////////////////////////////////////////////////////////////////////// |
| 8 | |
| 9 | /** @ingroup group_funcmacro_string */ |
| 10 | //@{ |
| 11 | |
| 12 | /** |
| 13 | @returns @true if the pointer is either @NULL or points to an empty string, |
| 14 | @false otherwise. |
| 15 | |
| 16 | @header{wx/wxcrt.h} |
| 17 | */ |
| 18 | bool wxIsEmpty(const char* p); |
| 19 | |
| 20 | /** |
| 21 | This is a safe version of standard function @e strlen(): it does exactly |
| 22 | the same thing (i.e. returns the length of the string) except that it |
| 23 | returns 0 if @a p is the @NULL pointer. |
| 24 | |
| 25 | @header{wx/wxcrt.h} |
| 26 | */ |
| 27 | size_t wxStrlen(const char* p); |
| 28 | |
| 29 | /** |
| 30 | This function complements the standard C function @e stricmp() which |
| 31 | performs case-insensitive comparison. |
| 32 | |
| 33 | @returns A negative value, 0, or positive value if @a p1 is less than, |
| 34 | equal to or greater than @a p2. The comparison is case-sensitive. |
| 35 | |
| 36 | @header{wx/wxcrt.h} |
| 37 | */ |
| 38 | int wxStrcmp(const char* p1, const char* p2); |
| 39 | |
| 40 | /** |
| 41 | This function complements the standard C function @e strcmp() which performs |
| 42 | case-sensitive comparison. |
| 43 | |
| 44 | @returns A negative value, 0, or positive value if @a p1 is less than, |
| 45 | equal to or greater than @e p2. The comparison is case-insensitive. |
| 46 | |
| 47 | @header{wx/wxcrt.h} |
| 48 | */ |
| 49 | int wxStricmp(const char* p1, const char* p2); |
| 50 | |
| 51 | /** |
| 52 | @deprecated Use wxString instead. |
| 53 | |
| 54 | This macro is defined as: |
| 55 | |
| 56 | @code |
| 57 | #define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0)) |
| 58 | @endcode |
| 59 | |
| 60 | @header{wx/wxcrt.h} |
| 61 | */ |
| 62 | bool wxStringEq(const wxString& s1, const wxString& s2); |
| 63 | |
| 64 | /** |
| 65 | @deprecated Use wxString::Find() instead. |
| 66 | |
| 67 | Returns @true if the substring @a s1 is found within @a s2, ignoring case |
| 68 | if @a exact is @false. If @a subString is @false, no substring matching is |
| 69 | done. |
| 70 | |
| 71 | @header{wx/wxcrt.h} |
| 72 | */ |
| 73 | bool wxStringMatch(const wxString& s1, const wxString& s2, |
| 74 | bool subString = true, bool exact = false); |
| 75 | |
| 76 | /** |
| 77 | This is a convenience function wrapping wxStringTokenizer which simply |
| 78 | returns all tokens found in the given @a string in an array. |
| 79 | |
| 80 | Please see wxStringTokenizer::wxStringTokenizer() for a description of the |
| 81 | other parameters. |
| 82 | |
| 83 | @header{wx/wxcrt.h} |
| 84 | */ |
| 85 | wxArrayString wxStringTokenize(const wxString& string, |
| 86 | const wxString& delims = wxDEFAULT_DELIMITERS, |
| 87 | wxStringTokenizerMode mode = wxTOKEN_DEFAULT); |
| 88 | |
| 89 | /** |
| 90 | This function replaces the dangerous standard function @e sprintf() and is |
| 91 | like @e snprintf() available on some platforms. The only difference with |
| 92 | @e sprintf() is that an additional argument - buffer size - is taken and |
| 93 | the buffer is never overflowed. |
| 94 | |
| 95 | Returns the number of characters copied to the buffer or -1 if there is not |
| 96 | enough space. |
| 97 | |
| 98 | @see wxVsnprintf(), wxString::Printf() |
| 99 | |
| 100 | @header{wx/wxcrt.h} |
| 101 | */ |
| 102 | int wxSnprintf(wxChar* buf, size_t len, const wxChar* format, ...); |
| 103 | |
| 104 | /** |
| 105 | The same as wxSnprintf() but takes a @c va_list argument instead of an |
| 106 | arbitrary number of parameters. |
| 107 | |
| 108 | @note If @c wxUSE_PRINTF_POS_PARAMS is set to 1, then this function |
| 109 | supports positional arguments (see wxString::Printf() for more |
| 110 | information). However other functions of the same family (wxPrintf(), |
| 111 | wxSprintf(), wxFprintf(), wxVfprintf(), wxVfprintf(), wxVprintf(), |
| 112 | wxVsprintf()) currently do not to support positional parameters even |
| 113 | when @c wxUSE_PRINTF_POS_PARAMS is 1. |
| 114 | |
| 115 | @see wxSnprintf(), wxString::PrintfV() |
| 116 | |
| 117 | @header{wx/wxcrt.h} |
| 118 | */ |
| 119 | int wxVsnprintf(wxChar* buf, size_t len, |
| 120 | const wxChar* format, va_list argPtr); |
| 121 | |
| 122 | //@} |
| 123 | |