From f04f39918777d57176a2755a6e99206f21b2d13c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 12 Jul 1998 22:40:00 +0000 Subject: [PATCH] wxGetEmptyString() function added git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@243 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/string.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/include/wx/string.h b/include/wx/string.h index a6282ddbaa..1145fffbf4 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -80,8 +80,19 @@ inline size_t WXDLLEXPORT Strlen(const char *psz) /// portable strcasecmp/_stricmp int WXDLLEXPORT Stricmp(const char *, const char *); +// ---------------------------------------------------------------------------- +// global data +// ---------------------------------------------------------------------------- + +// global pointer to empty string +extern const char *g_szNul; + +// return an empty wxString +class wxString; // not yet defined +inline const wxString& wxGetEmptyString() { return *(wxString *)&g_szNul; } + // --------------------------------------------------------------------------- -// string data prepended with some housekeeping info (used by String class), +// string data prepended with some housekeeping info (used by wxString class), // is never used directly (but had to be put here to allow inlining) // --------------------------------------------------------------------------- struct WXDLLEXPORT wxStringData @@ -107,8 +118,6 @@ struct WXDLLEXPORT wxStringData bool IsValid() const { return nRefs != 0; } }; -extern const char *g_szNul; // global pointer to empty string - // --------------------------------------------------------------------------- /** This is (yet another one) String class for C++ programmers. It doesn't use @@ -837,7 +846,7 @@ inline bool operator>=(const wxString& s1, const char * s2) { return s1.Cmp(s2) /// inline bool operator>=(const char * s1, const wxString& s2) { return s2.Cmp(s1) <= 0; } //@} - + // --------------------------------------------------------------------------- /** @name Global functions complementing standard C string library @memo replacements for strlen() and portable strcasecmp() -- 2.45.2