]> git.saurik.com Git - wxWidgets.git/blame - 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
CommitLineData
ea88e9bc
VS
1////////////////////////////////////////////////////////////////////////////
2// Name: wx/stc/private.h
3// Purpose: Private declarations for wxSTC
4// Author: Robin Dunn
5// Created: 2007-07-15
ea88e9bc 6// Copyright: (c) 2000 by Total Control Software
526954c5 7// Licence: wxWindows licence
ea88e9bc
VS
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
21extern wxString stc2wx(const char* str);
22extern wxString stc2wx(const char* str, size_t len);
2ed48ef8 23extern wxCharBuffer wx2stc(const wxString& str);
ea88e9bc 24
d7b46878
VZ
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.
29inline size_t wx2stclen(const wxString& WXUNUSED(str), const wxCharBuffer& buf)
30{
31 return buf.length() - 1;
32}
33
ea88e9bc
VS
34#else // not UNICODE
35
36inline wxString stc2wx(const char* str) {
37 return wxString(str);
38}
39inline wxString stc2wx(const char* str, size_t len) {
40 return wxString(str, len);
41}
2ed48ef8 42inline const char* wx2stc(const wxString& str) {
ea88e9bc
VS
43 return str.mbc_str();
44}
45
d7b46878
VZ
46// As explained above, the buffer argument is only used in Unicode build.
47inline size_t wx2stclen(const wxString& str, const char* WXUNUSED(buf))
48{
49 return str.length();
50}
51
ea88e9bc
VS
52#endif // UNICODE
53
54#endif // _WX_STC_PRIVATE_H_