wx.wxString Class Reference

Inheritance diagram for wx.wxString:

wx.Object

List of all members.

Public Member Functions

override string ToString ()
 wxString (string str)
 wxString ()
 wxString (IntPtr wxObject)

Static Public Member Functions

static implicit operator string (wxString str)
static wxString SafeNew (IntPtr ptrToStr, bool memOwn)
static wxString SafeNew (IntPtr ptrToStr)
static wxString SafeNew (string str)

Protected Member Functions

override void CallDTor ()

Properties

int Length [get]
char this [int n] [get]


Detailed Description

Wrapper for the wxWidgets string class wxString.

Objectives:

The changed implementation follows the guidelines of the wxWidgets manual for implementations. The internal character encoding within the .NET framework is uniquely defined to UTF 16. The used constructors and selectors use an explicit conversion as argument (on the wx-c side) to convert from or to this encoding. So, the interface provided by wx-c is always UTF 16 whether the library is able to represent such strings internally or not. An MarshalAsAttribute is used to define a more verbatim marshalling scheme on DLL import.

So, any kind of conversion is done by wxWidgets (if necessary) and not by the .NET framework.

Refer to wxWCharBuffer and DisposableStringBox for remarks on helper classes for dealing with strings.


Constructor & Destructor Documentation

wx.wxString.wxString ( IntPtr  wxObject  ) 

wx.wxString.wxString (  ) 

wx.wxString.wxString ( string  str  ) 


Member Function Documentation

override void wx.wxString.CallDTor (  )  [protected, virtual]

This will be called by Dispose() to delete the C++ object. Overload this if you have to use another DTor.

Reimplemented from wx.Object.

static implicit wx.wxString.operator string ( wxString  str  )  [static]

static wxString wx.wxString.SafeNew ( IntPtr  ptrToStr,
bool  memOwn 
) [static]

static wxString wx.wxString.SafeNew ( IntPtr  ptrToStr  )  [static]

static wxString wx.wxString.SafeNew ( string  str  )  [static]

This will safely create an instance of wx.wxString without throwing exceptions on argument null. Instead the method will return result null on argument null.

override string wx.wxString.ToString (  ) 

Conversion of wxString into a string. This method works different on Unicode- and ANSI-builds of wxWidgets. On Unicode builds we can directly refer to the internal buffer using the indexer of this class. Otherwise we read a wxWCharBuffer and convert this.

Special case: PNET with internal UTF8 character encoding if WXNET_INTERNAL_USE_UTF8. In this case, we always have to decode.


Property Documentation

int wx.wxString.Length [get]

Returns the length of the encapsulated string.

char wx.wxString.this[int n] (  )  [get]

Get the n-th character. Returns a 2 byte UTF16 character. Only get implemented. Undefined positions will result in a 0. This works perfect on a Unicode build (ReflectConfig.CheckUseUnicode) since internal characer encoding of wxString is the same as the encoding in C#. On ANSI builds this will return blanks as replacemetns of non-ascii characters.

Correction: Microsoft and Mono use UTF16 as internal string representation just like wxWidgets with wide character Unicode support compiled in. However, PNET seems to use UTF 8 instead. If this assumes internal UTF 8 strings, this method will return ASCII only.


Manual of the wx.NET   (c) 2003-2011 the wx.NET project at   Get wx.NET at SourceForge.net. Fast, secure and Free Open Source software downloads