⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wxstring.tex

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 TEX
📖 第 1 页 / 共 4 页
字号:
bit numbers is not supported by the underlying C run-time library. Compilerswith C99 support and Microsoft Visual C++ version 7 and higher do support this.\wxheading{See also}\helpref{wxString::ToLong}{wxstringtolong},\\\helpref{wxString::ToULongLong}{wxstringtoulonglong}\membersection{wxString::ToULong}\label{wxstringtoulong}\constfunc{bool}{ToULong}{\param{unsigned long}{ *val}, \param{int }{base = $10$}}Attempts to convert the string to an unsigned integer in base {\it base}.Returns \true on success in which case the number is stored in thelocation pointed to by {\it val} or \false if the string does notrepresent a valid number in the given base. Please notice that this functionbehaves in the same way as the standard \texttt{strtoul()} and so it simplyconverts negative numbers to unsigned representation instead of rejecting them(e.g. $-1$ is returned as \texttt{ULONG\_MAX}).See \helpref{wxString::ToLong}{wxstringtolong} for the more detaileddescription of the {\it base} parameter.\wxheading{See also}\helpref{wxString::ToDouble}{wxstringtodouble},\\\helpref{wxString::ToLong}{wxstringtolong}\membersection{wxString::ToULongLong}\label{wxstringtoulonglong}\constfunc{bool}{ToULongLong}{\param{wxULongLong\_t}{ *val}, \param{int }{base = $10$}}This is exactly the same as \helpref{ToULong}{wxstringtoulong} but works with 64bit integer numbers.Please see \helpref{ToLongLong}{wxstringtolonglong} for additional remarks.\membersection{wxString::Trim}\label{wxstringtrim}\func{wxString\&}{Trim}{\param{bool}{ fromRight = true}}Removes white-space (space, tabs, form feed, newline and carriage return) fromthe left or from the right end of the string (right is default).\membersection{wxString::Truncate}\label{wxstringtruncate}\func{wxString\&}{Truncate}{\param{size\_t}{ len}}Truncate the string to the given length.\membersection{wxString::UngetWriteBuf}\label{wxstringungetwritebuf}\func{void}{UngetWriteBuf}{\void}\func{void}{UngetWriteBuf}{\param{size\_t }{len}}Puts the string back into a reasonable state (in which it can be usednormally), after\rtfsp\helpref{wxString::GetWriteBuf}{wxstringgetwritebuf} was called.The version of the function without the {\it len} parameter will calculate thenew string length itself assuming that the string is terminated by the first{\tt NUL} character in it while the second one will use the specified lengthand thus is the only version which should be used with the strings withembedded {\tt NUL}s (it is also slightly more efficient as {\tt strlen()} doesn't have to be called).\membersection{wxString::Upper}\label{wxstringupper}\constfunc{wxString}{Upper}{\void}Returns this string converted to upper case.\membersection{wxString::UpperCase}\label{wxstringuppercase}\func{void}{UpperCase}{\void}The same as MakeUpper.This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::wc\_str}\label{wxstringwcstr}\constfunc{const wchar\_t*}{wc\_str}{\param{wxMBConv\&}{ conv}}\constfunc{const wxWCharBuffer}{wc\_str}{\param{wxMBConv\&}{ conv}}Returns wide character representation of the string.In ANSI build, converts using \arg{conv}'s \helpref{cMB2WC}{wxmbconvcmb2wc}method and returns wxWCharBuffer. In Unicode build, this function is sameas \helpref{c\_str}{wxstringcstr}.The macro wxWX2WCbuf is defined as the correct return type (without const).\wxheading{See also}\helpref{wxMBConv}{wxmbconv},\helpref{c\_str}{wxstringcstr}, \helpref{mb\_str}{wxstringwcstr},\helpref{fn\_str}{wxstringfnstr}\membersection{wxString::operator!}\label{wxstringoperatornot}\constfunc{bool}{operator!}{\void}Empty string is \false, so !string will only return \true if the string is empty.This allows the tests for NULLness of a {\it const wxChar *} pointer and emptinessof the string to look the same in the code and makes it easier to port old codeto wxString.See also \helpref{IsEmpty()}{wxstringisempty}.\membersection{wxString::operator $=$}\label{wxstringoperatorassign}\func{wxString\&}{operator $=$}{\param{const wxString\&}{ str}}\func{wxString\&}{operator $=$}{\param{const wxChar*}{ psz}}\func{wxString\&}{operator $=$}{\param{wxChar}{ c}}Assignment: the effect of each operation is the same as for the correspondingconstructor (see \helpref{wxString constructors}{wxstringconstruct}).\membersection{wxString::operator $+$}\label{wxstringoperatorplus}Concatenation: all these operators return a new string equal to theconcatenation of the operands.\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const wxChar*}{ y}}\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{wxChar}{ y}}\func{wxString}{operator $+$}{\param{const wxChar*}{ x}, \param{const wxString\&}{ y}}\membersection{wxString::operator $+=$}\label{wxstringplusequal}\func{void}{operator $+=$}{\param{const wxString\&}{ str}}\func{void}{operator $+=$}{\param{const wxChar*}{ psz}}\func{void}{operator $+=$}{\param{wxChar}{ c}}Concatenation in place: the argument is appended to the string.\membersection{wxString::operator []}\label{wxstringoperatorbracket}\func{wxChar\&}{operator []}{\param{size\_t}{ i}}\constfunc{wxChar}{operator []}{\param{size\_t}{ i}}\func{wxChar\&}{operator []}{\param{int}{ i}}\constfunc{wxChar}{operator []}{\param{int}{ i}}Element extraction.\membersection{wxString::operator ()}\label{wxstringoperatorparenth}\func{wxString}{operator ()}{\param{size\_t}{ start}, \param{size\_t}{ len}}Same as Mid (substring extraction).\membersection{wxString::operator \cinsert}\label{wxstringoperatorout}\func{wxString\&}{operator \cinsert}{\param{const wxString\&}{ str}}\func{wxString\&}{operator \cinsert}{\param{const wxChar*}{ psz}}\func{wxString\&}{operator \cinsert}{\param{wxChar }{ch}}Same as $+=$.\func{wxString\&}{operator \cinsert}{\param{int}{ i}}\func{wxString\&}{operator \cinsert}{\param{float}{ f}}\func{wxString\&}{operator \cinsert}{\param{double}{ d}}These functions work as C++ stream insertion operators: they insert the givenvalue into the string. Precision or format cannot be set using them, you can use \helpref{Printf}{wxstringprintf} for this.\membersection{wxString::operator \cextract}\label{wxstringoperatorin}\func{friend istream\&}{operator \cextract}{\param{istream\&}{ is}, \param{wxString\&}{ str}}Extraction from a stream.\membersection{wxString::operator const wxChar*}\label{wxstringoperatorconstcharpt}\constfunc{}{operator const wxChar*}{\void}Implicit conversion to a C string.\membersection{Comparison operators}\label{wxstringcomparison}\func{bool}{operator $==$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\func{bool}{operator $==$}{\param{const wxString\&}{ x}, \param{const wxChar*}{ t}}\func{bool}{operator $!=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\func{bool}{operator $!=$}{\param{const wxString\&}{ x}, \param{const wxChar*}{ t}}\func{bool}{operator $>$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\func{bool}{operator $>$}{\param{const wxString\&}{ x}, \param{const wxChar*}{ t}}\func{bool}{operator $>=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\func{bool}{operator $>=$}{\param{const wxString\&}{ x}, \param{const wxChar*}{ t}}\func{bool}{operator $<$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\func{bool}{operator $<$}{\param{const wxString\&}{ x}, \param{const wxChar*}{ t}}\func{bool}{operator $<=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\func{bool}{operator $<=$}{\param{const wxString\&}{ x}, \param{const wxChar*}{ t}}\wxheading{Remarks}These comparisons are case-sensitive.\section{\class{wxStringBuffer}}\label{wxstringbuffer}This tiny class allows to conveniently access the \helpref{wxString}{wxstring} internal buffer as a writable pointer without any risk of forgetting to restorethe string to the usable state later.For example, assuming you have a low-level OS function called {\tt GetMeaningOfLifeAsString(char *)} returning the value in the providedbuffer (which must be writable, of course) you might call it like this:\begin{verbatim}    wxString theAnswer;    GetMeaningOfLifeAsString(wxStringBuffer(theAnswer, 1024));    if ( theAnswer != "42" )    {        wxLogError("Something is very wrong!");    }\end{verbatim}Note that the exact usage of this depends on whether on not wxUSE\_STL is enabled.  IfwxUSE\_STL is enabled, wxStringBuffer creates a separate empty character buffer, andif wxUSE\_STL is disabled, it uses GetWriteBuf() from wxString, keeping the same bufferwxString uses intact.  In other words, relying on wxStringBuffer containing the old wxString data is probably not a good idea if you want to build your program in bothwith and without wxUSE\_STL.\wxheading{Derived from}None\wxheading{Include files}<wx/string.h>\latexignore{\rtfignore{\wxheading{Members}}}\membersection{wxStringBuffer::wxStringBuffer}\label{wxstringbufferctor}\func{}{wxStringBuffer}{\param{const wxString\& }{str}, \param{size\_t }{len}}Constructs a writable string buffer object associated with the given stringand containing enough space for at least {\it len} characters. Basically, thisis equivalent to calling \helpref{GetWriteBuf}{wxstringgetwritebuf} andsaving the result.\membersection{wxStringBuffer::\destruct{wxStringBuffer}}\label{wxstringbufferdtor}\func{}{\destruct{wxStringBuffer}}{\void}Restores the string passed to the constructor to the usable state by calling \helpref{UngetWriteBuf}{wxstringungetwritebuf} on it.\membersection{wxStringBuffer::operator wxChar *}\label{wxstringbufferwxchar}\func{wxChar *}{operator wxChar *}{\void}Returns the writable pointer to a buffer of the size at least equal to thelength specified in the constructor.\section{\class{wxStringBufferLength}}\label{wxstringbufferlength}This tiny class allows to conveniently access the \helpref{wxString}{wxstring} internal buffer as a writable pointer without any risk of forgetting to restorethe string to the usable state later, and allows the user to set the internallength of the string.For example, assuming you have a low-level OS function called {\tt int GetMeaningOfLifeAsString(char *)} copying the value in the providedbuffer (which must be writable, of course), and returning the actual lengthof the string, you might call it like this:\begin{verbatim}    wxString theAnswer;    wxStringBuffer theAnswerBuffer(theAnswer, 1024);    int nLength = GetMeaningOfLifeAsString(theAnswerBuffer);    theAnswerBuffer.SetLength(nLength);    if ( theAnswer != "42" )    {        wxLogError("Something is very wrong!");    }\end{verbatim}Note that the exact usage of this depends on whether on not wxUSE\_STL is enabled.  IfwxUSE\_STL is enabled, wxStringBuffer creates a separate empty character buffer, andif wxUSE\_STL is disabled, it uses GetWriteBuf() from wxString, keeping the same bufferwxString uses intact.  In other words, relying on wxStringBuffer containing the old wxString data is probably not a good idea if you want to build your program in bothwith and without wxUSE\_STL.Note that SetLength {\tt must} be called before wxStringBufferLength destructs.\wxheading{Derived from}None\wxheading{Include files}<wx/string.h>\latexignore{\rtfignore{\wxheading{Members}}}\membersection{wxStringBufferLength::wxStringBufferLength}\label{wxstringbufferlengthctor}\func{}{wxStringBufferLength}{\param{const wxString\& }{str}, \param{size\_t }{len}}Constructs a writable string buffer object associated with the given stringand containing enough space for at least {\it len} characters. Basically, thisis equivalent to calling \helpref{GetWriteBuf}{wxstringgetwritebuf} andsaving the result.\membersection{wxStringBufferLength::\destruct{wxStringBufferLength}}\label{wxstringbufferlengthdtor}\func{}{\destruct{wxStringBufferLength}}{\void}Restores the string passed to the constructor to the usable state by calling \helpref{UngetWriteBuf}{wxstringungetwritebuf} on it.\membersection{wxStringBufferLength::SetLength}\label{wxstringbufferlengthsetlength}\func{void}{SetLength}{\param{size\_t }{nLength}}Sets the internal length of the string referred to by wxStringBufferLength to {\it nLength} characters.Must be called before wxStringBufferLength destructs.\membersection{wxStringBufferLength::operator wxChar *}\label{wxstringbufferlengthwxchar}\func{wxChar *}{operator wxChar *}{\void}Returns the writable pointer to a buffer of the size at least equal to thelength specified in the constructor.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -