X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cc81d32f2bf8c159f3b1bf6ddaf62e6d77720209..0bd2681966523df88ad5cf8e505b532843e58d74:/docs/latex/wx/tokenizr.tex diff --git a/docs/latex/wx/tokenizr.tex b/docs/latex/wx/tokenizr.tex index c9e0c44732..85aa9f0945 100644 --- a/docs/latex/wx/tokenizr.tex +++ b/docs/latex/wx/tokenizr.tex @@ -10,13 +10,13 @@ string to tokenize and also the delimiters which separate tokens in the string Then \helpref{GetNextToken}{wxstringtokenizergetnexttoken} may be called repeatedly until it \helpref{HasMoreTokens}{wxstringtokenizerhasmoretokens} -returns false. +returns \false. For example: \begin{verbatim} -wxStringTokenizer tkz("first:second:third:fourth", ":"); +wxStringTokenizer tkz(wxT("first:second:third:fourth"), wxT(":")); while ( tkz.HasMoreTokens() ) { wxString token = tkz.GetNextToken(); @@ -43,29 +43,44 @@ same as {\tt wxTOKEN\_STRTOK} if the delimiter string contains only whitespaces, same as {\tt wxTOKEN\_RET\_EMPTY} otherwise} \twocolitem{{\tt wxTOKEN\_RET\_EMPTY}}{In this mode, the empty tokens in the middle of the string will be returned, i.e. {\tt "a::b:"} will be tokenized in -three tokens `a', `' and `b'.} -\twocolitem{{\tt wxTOKEN\_RET\_EMPTY\_ALL}}{In this mode, empty trailing token -(after the last delimiter character) will be returned as well. The string as -above will contain four tokens: the already mentioned ones and another empty -one as the last one.} +three tokens `a', `' and `b'. Notice that all trailing delimiters are ignored +in this mode, not just the last one, i.e. a string \texttt{"a::b::"} would +still result in the same set of tokens.} +\twocolitem{{\tt wxTOKEN\_RET\_EMPTY\_ALL}}{In this mode, empty trailing tokens +(including the one after the last delimiter character) will be returned as +well. The string \texttt{"a::b:"} will be tokenized in four tokens: the already +mentioned ones and another empty one as the last one and a string +\texttt{"a::b::"} will have five tokens.} \twocolitem{{\tt wxTOKEN\_RET\_DELIMS}}{In this mode, the delimiter character after the end of the current token (there may be none if this is the last token) is returned appended to the token. Otherwise, it is the same mode as -{\tt wxTOKEN\_RET\_EMPTY}.} +\texttt{wxTOKEN\_RET\_EMPTY}. Notice that there is no mode like this one but +behaving like \texttt{wxTOKEN\_RET\_EMPTY\_ALL} instead of +\texttt{wxTOKEN\_RET\_EMPTY}, use \texttt{wxTOKEN\_RET\_EMPTY\_ALL} and +\helpref{GetLastDelimiter()}{wxstringtokenizergetlastdelimiter} to emulate it.} \twocolitem{{\tt wxTOKEN\_STRTOK}}{In this mode the class behaves exactly like -the standard {\tt strtok()} function. The empty tokens are never returned.} +the standard {\tt strtok()} function: the empty tokens are never returned.} \end{twocollist} \wxheading{Derived from} \helpref{wxObject}{wxobject} +\wxheading{See also} + +\helpref{wxStringTokenize}{wxstringtokenize} + \wxheading{Include files} +\wxheading{Library} + +\helpref{wxBase}{librarieslist} + \latexignore{\rtfignore{\wxheading{Members}}} + \membersection{wxStringTokenizer::wxStringTokenizer}\label{wxstringtokenizerwxstringtokenizer} \func{}{wxStringTokenizer}{\void} @@ -79,24 +94,44 @@ methods. Constructor. Pass the string to tokenize, a string containing delimiters and the mode specifying how the string should be tokenized. + \membersection{wxStringTokenizer::CountTokens}\label{wxstringtokenizercounttokens} \constfunc{int}{CountTokens}{\void} -Returns the number of tokens in the input string. +Returns the number of tokens remaining in the input string. The number of +tokens returned by this function is decremented each time +\helpref{GetNextToken}{wxstringtokenizergetnexttoken} is called and when it +reaches $0$ \helpref{HasMoreTokens}{wxstringtokenizerhasmoretokens} returns +\false. + \membersection{wxStringTokenizer::HasMoreTokens}\label{wxstringtokenizerhasmoretokens} \constfunc{bool}{HasMoreTokens}{\void} -Returns true if the tokenizer has further tokens, false if none are left. +Returns \true if the tokenizer has further tokens, \false if none are left. + + +\membersection{wxStringTokenizer::GetLastDelimiter}\label{wxstringtokenizergetlastdelimiter} + +\func{wxChar}{GetLastDelimiter}{\void} + +Returns the delimiter which ended scan for the last token returned by +\helpref{GetNextToken()}{wxstringtokenizergetnexttoken} or \texttt{NUL} if +there had been no calls to this function yet or if it returned the trailing +empty token in \texttt{wxTOKEN\_RET\_EMPTY\_ALL} mode. + +\newsince{2.7.0} + \membersection{wxStringTokenizer::GetNextToken}\label{wxstringtokenizergetnexttoken} -\func{wxString}{GetNextToken}{\void} +\constfunc{wxString}{GetNextToken}{\void} Returns the next token or empty string if the end of string was reached. + \membersection{wxStringTokenizer::GetPosition}\label{wxstringtokenizergetposition} \constfunc{size\_t}{GetPosition}{\void} @@ -105,12 +140,14 @@ Returns the current position (i.e. one index after the last returned token or 0 if GetNextToken() has never been called) in the original string. + \membersection{wxStringTokenizer::GetString}\label{wxstringtokenizergetstring} \constfunc{wxString}{GetString}{\void} Returns the part of the starting string without all token already extracted. + \membersection{wxStringTokenizer::SetString}\label{wxstringtokenizersetstring} \func{void}{SetString}{\param{const wxString\& }{to\_tokenize}, \param{const wxString\& }{delims = " $\backslash$t$\backslash$r$\backslash$n"}, \param{wxStringTokenizerMode }{mode = wxTOKEN\_DEFAULT}}