RToken.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <string.h>
00026 #include <stddef.h>
00027 #include <qcstring.h>
00028 #include <qstrlist.h>
00029
00030 namespace VCARD
00031 {
00032
00033 Q_UINT32
00034 RTokenise(const char * str, const char * delim, QStrList & l)
00035 {
00036
00037 l.clear();
00038
00039 if (!delim || !str || strlen(delim) == 0 || strlen(str) == 0) return 0;
00040
00041 char * len = (char *)(str + strlen(str));
00042
00043 register char * rstart = new char[strlen(str) + 1];
00044 register char * r = rstart;
00045
00046
00047 register const char * i = str;
00048
00049 while (i <= len) {
00050
00051 if (*i == '\\') {
00052 *r++ = *i++;
00053 if (i <= len)
00054 *r++ = *i++;
00055 continue;
00056 }
00057
00058 if (strchr(delim, *i) != 0) {
00059
00060
00061
00062
00063 *r = '\0';
00064
00065 l.append(rstart);
00066
00067 r = rstart;
00068 ++i;
00069 continue;
00070 }
00071
00072 *r++ = *i++;
00073 }
00074
00075
00076
00077 *r = '\0';
00078 l.append(rstart);
00079
00080
00081 r = 0;
00082
00083 delete [] rstart;
00084
00085 return l.count();
00086 }
00087
00088 }
This file is part of the documentation for kabc Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Apr 21 18:44:44 2004 by
doxygen 1.3.6-20040222 written by
Dimitri van Heesch, © 1997-2003