]> git.saurik.com Git - wxWidgets.git/blob - include/wx/stc/private.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / stc / private.h
1 ////////////////////////////////////////////////////////////////////////////
2 // Name: wx/stc/private.h
3 // Purpose: Private declarations for wxSTC
4 // Author: Robin Dunn
5 // Created: 2007-07-15
6 // Copyright: (c) 2000 by Total Control Software
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_STC_PRIVATE_H_
11 #define _WX_STC_PRIVATE_H_
12
13 #include "wx/defs.h"
14 #include "wx/string.h"
15
16 //----------------------------------------------------------------------
17 // Utility functions used within wxSTC
18
19 #if wxUSE_UNICODE
20
21 extern wxString stc2wx(const char* str);
22 extern wxString stc2wx(const char* str, size_t len);
23 extern wxCharBuffer wx2stc(const wxString& str);
24
25 // This function takes both wxString and wxCharBuffer because it uses either
26 // one or the other of them depending on the build mode. In Unicode it uses the
27 // length of the already converted buffer to avoid doing the conversion again
28 // just to compute the length.
29 inline size_t wx2stclen(const wxString& WXUNUSED(str), const wxCharBuffer& buf)
30 {
31 return buf.length() - 1;
32 }
33
34 #else // not UNICODE
35
36 inline wxString stc2wx(const char* str) {
37 return wxString(str);
38 }
39 inline wxString stc2wx(const char* str, size_t len) {
40 return wxString(str, len);
41 }
42 inline const char* wx2stc(const wxString& str) {
43 return str.mbc_str();
44 }
45
46 // As explained above, the buffer argument is only used in Unicode build.
47 inline size_t wx2stclen(const wxString& str, const char* WXUNUSED(buf))
48 {
49 return str.length();
50 }
51
52 #endif // UNICODE
53
54 #endif // _WX_STC_PRIVATE_H_