]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/strconv.h
switching to defines not having a value for __WXMAC__
[wxWidgets.git] / include / wx / strconv.h
index 9248f2cb7e9732214942952047b898296ea22360..a28fe448eb554fff9686cc3128a4b414c1232172 100644 (file)
@@ -41,10 +41,17 @@ class WXDLLIMPEXP_BASE wxMBConv
 public:
     // the actual conversion takes place here
     //
-    // note that n is the size of the output buffer, not the length of input
-    // (which is always supposed to be NUL-terminated)
-    virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const = 0;
-    virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const = 0;
+    // note that outputSize is the size of the output buffer, not the length of input
+    // (the latter is always supposed to be NUL-terminated)
+    virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const = 0;
+    virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const = 0;
+
+    // actual conversion for strings with embedded null characters
+    //
+    // outputSize is the size of the output buffer
+    // pszLen is the length of the input string (including all but last null character)
+    size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize, size_t pszLen) const;
+    size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize, size_t pszLen) const;
 
     // MB <-> WC
     const wxWCharBuffer cMB2WC(const char *psz) const;
@@ -75,8 +82,8 @@ public:
 class WXDLLIMPEXP_BASE wxMBConvLibc : public wxMBConv
 {
 public:
-    virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
-    virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
+    virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const;
+    virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const;
 };
 
 // not very accurately named because it is not necessarily of type wxMBConvLibc
@@ -91,8 +98,8 @@ WXDLLIMPEXP_DATA_BASE(extern wxMBConv&) wxConvLibc;
 class WXDLLIMPEXP_BASE wxMBConvUTF7 : public wxMBConv
 {
 public:
-    virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
-    virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
+    virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const;
+    virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const;
 };
 
 WXDLLIMPEXP_DATA_BASE(extern wxMBConvUTF7&) wxConvUTF7;
@@ -104,8 +111,8 @@ WXDLLIMPEXP_DATA_BASE(extern wxMBConvUTF7&) wxConvUTF7;
 class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConv
 {
 public:
-    virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
-    virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
+    virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const;
+    virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const;
 };
 
 WXDLLIMPEXP_DATA_BASE(extern wxMBConvUTF8&) wxConvUTF8;
@@ -117,8 +124,8 @@ WXDLLIMPEXP_DATA_BASE(extern wxMBConvUTF8&) wxConvUTF8;
 class WXDLLIMPEXP_BASE wxMBConvUTF16LE : public wxMBConv
 {
 public:
-    virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
-    virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
+    virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const;
+    virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const;
 };
 
 // ----------------------------------------------------------------------------
@@ -128,8 +135,8 @@ public:
 class WXDLLIMPEXP_BASE wxMBConvUTF16BE : public wxMBConv
 {
 public:
-    virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
-    virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
+    virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const;
+    virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const;
 };
 
 // ----------------------------------------------------------------------------
@@ -139,8 +146,8 @@ public:
 class WXDLLIMPEXP_BASE wxMBConvUTF32LE : public wxMBConv
 {
 public:
-    virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
-    virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
+    virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const;
+    virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const;
 };
 
 // ----------------------------------------------------------------------------
@@ -150,8 +157,8 @@ public:
 class WXDLLIMPEXP_BASE wxMBConvUTF32BE : public wxMBConv
 {
 public:
-    virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
-    virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
+    virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const;
+    virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const;
 };
 
 // ----------------------------------------------------------------------------
@@ -173,8 +180,8 @@ public:
 
     wxCSConv& operator=(const wxCSConv& conv);
 
-    virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
-    virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
+    virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const;
+    virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const;
 
     void Clear() ;