]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/gtk/private/string.h | |
3 | // Purpose: wxGtkString class declaration | |
4 | // Author: Vadim Zeitlin | |
5 | // Created: 2006-10-19 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> | |
8 | // Licence: wxWindows licence | |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_GTK_PRIVATE_STRING_H_ | |
12 | #define _WX_GTK_PRIVATE_STRING_H_ | |
13 | ||
14 | // ---------------------------------------------------------------------------- | |
15 | // Convenience class for g_freeing a gchar* on scope exit automatically | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
18 | class wxGtkString | |
19 | { | |
20 | public: | |
21 | explicit wxGtkString(gchar *s) : m_str(s) { } | |
22 | ~wxGtkString() { g_free(m_str); } | |
23 | ||
24 | const gchar *c_str() const { return m_str; } | |
25 | ||
26 | operator gchar *() const { return m_str; } | |
27 | ||
28 | private: | |
29 | gchar *m_str; | |
30 | ||
31 | wxDECLARE_NO_COPY_CLASS(wxGtkString); | |
32 | }; | |
33 | ||
34 | #endif // _WX_GTK_PRIVATE_STRING_H_ | |
35 |