Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Unicode conversion (attention all devs)
rickg22:
Uh oh... I just noticed from the docs.
wxString& operator <<(const wxString& str)
wxString& operator <<(const char* psz)
wxString& operator <<(char ch)
Apparently the << 's can be used with either normal strings or wxstrings, but not with wxChar's. UGH i have to change one or two sources back... :-/
byo:
--- Quote from: tiwag on August 05, 2005, 10:32:03 pm ---what to do here ?
--- Code: --- // indent code accordingly
wxString code = it->second;
code.Replace("\n", '\n' + lineIndent);
--- End code ---
from the docs:
--- Quote ---wxString::Replace
size_t Replace(const char* szOld, const char* szNew, bool replaceAll = true)
Replace first (or all) occurrences of substring with another one.
replaceAll: global replace (default), or only the first occurrence.
Returns the number of replacements made.
--- End quote ---
wxString::Replace() seems to be not fit for unicode ? or what ?
--- End quote ---
wxWidgets documentation about wxString class seems to be outdated - in header files there's such declaration:
--- Code: --- size_t Replace(const wxChar *szOld,
const wxChar *szNew,
bool bReplaceAll = true);
--- End code ---
I would change the code to:
--- Code: --- // indent code accordingly
wxString code = it->second;
code.Replace(_T("\n"), _T('\n') + lineIndent);
--- End code ---
byo:
--- Quote from: rickg22 on August 05, 2005, 11:05:15 pm ---Uh oh... I just noticed from the docs.
wxString& operator <<(const wxString& str)
wxString& operator <<(const char* psz)
wxString& operator <<(char ch)
Apparently the << 's can be used with either normal strings or wxstrings, but not with wxChar's. UGH i have to change one or two sources back... :-/
--- End quote ---
Same as in my previous post - documentation outdated. In header files for both wx 2.4 and 2.6 is:
--- Code: --- // string += C string
wxString& operator<<(const wxChar *psz)
{ append(psz); return *this; }
// string += char
--- End code ---
Urxae:
--- Quote from: rickg22 on August 05, 2005, 11:05:15 pm ---Uh oh... I just noticed from the docs.
wxString& operator <<(const wxString& str)
wxString& operator <<(const char* psz)
wxString& operator <<(char ch)
Apparently the << 's can be used with either normal strings or wxstrings, but not with wxChar's. UGH i have to change one or two sources back... :-/
--- End quote ---
I wouldn't if I were you, cause that would be wrong :P. The docs are generated by automated tools that among other things resolve typedefs such as wxChar to whatever they're typedeffed to. I've noticed on several occasions that they seem to be generated in non-unicode mode. If you actually look in <wx/string.h> (2.6.1) you'll see this:
--- Code: --- // string += C string
wxString& operator<<(const wxChar *psz)
{ append(psz); return *this; }
// string += char
wxString& operator<<(wxChar ch) { append(1, ch); return *this; }
--- End code ---
Damn. Beaten. Twice even :shock:.
tiwag:
--- Quote from: byo on August 05, 2005, 11:08:34 pm ---
--- Quote from: tiwag on August 05, 2005, 10:32:03 pm ---what to do here ?
--- Code: --- // indent code accordingly
wxString code = it->second;
code.Replace("\n", '\n' + lineIndent);
--- End code ---
from the docs:
--- Quote ---wxString::Replace
size_t Replace(const char* szOld, const char* szNew, bool replaceAll = true)
Replace first (or all) occurrences of substring with another one.
replaceAll: global replace (default), or only the first occurrence.
Returns the number of replacements made.
--- End quote ---
wxString::Replace() seems to be not fit for unicode ? or what ?
--- End quote ---
wxWidgets documentation about wxString class seems to be outdated - in header files there's such declaration:
--- Code: --- size_t Replace(const wxChar *szOld,
const wxChar *szNew,
bool bReplaceAll = true);
--- End code ---
I would change the code to:
--- Code: --- // indent code accordingly
wxString code = it->second;
code.Replace(_T("\n"), _T('\n') + lineIndent);
--- End code ---
--- End quote ---
thats what i've already done ... thanks byo ... i really got unsure for a moment ... :shock:
cbeditor.cpp was really a brainteaser ... puuh
btw
i really don't like the fact, that we can't rely on the wx.chm docs
that's a lot of additional work to study the header's all the time
somewhat boring ... but what can we do else ?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version