ParseBT Class ReferenceSplits a string whatever way you want. More...
Detailed DescriptionSplits a string whatever way you want.ParseBT.h - parse a string Written: 1999-Feb-10 ah@instrumentpolen.se
Definition at line 55 of file ParseBT.h. Constructor & Destructor Documentation
ParseBT.cpp - parse a string Written: 1999-Feb-10 ah@instrumentpolen.se Definition at line 35 of file ParseBT.cpp. References pa_breakchar, pa_disable, pa_enable, pa_nospace, pa_ord, pa_quote, pa_splits, pa_the_ptr, and pa_the_str. 00036 { 00037 pa_the_str = NULL; 00038 pa_splits = NULL; 00039 pa_ord = NULL; 00040 pa_the_ptr = 0; 00041 pa_breakchar = 0; 00042 pa_enable = pa_disable = 0; 00043 pa_nospace = 0; 00044 pa_quote = false; 00045 }
Definition at line 47 of file ParseBT.cpp. References pa_breakchar, pa_disable, pa_enable, pa_nospace, pa_ord, pa_quote, pa_splits, pa_the_ptr, and pa_the_str. 00048 { 00049 pa_the_str = NULL; 00050 pa_splits = NULL; 00051 pa_ord = NULL; 00052 pa_the_ptr = 0; 00053 pa_breakchar = 0; 00054 pa_enable = pa_disable = 0; 00055 pa_nospace = 0; 00056 pa_quote = false; 00057 00058 pa_the_str = new char[strlen(s) + 1]; 00059 strcpy(pa_the_str,s); 00060 pa_ord = new char[strlen(s) + 1]; 00061 *pa_ord = 0; 00062 }
Definition at line 64 of file ParseBT.cpp. References pa_breakchar, pa_disable, pa_enable, pa_nospace, pa_ord, pa_quote, pa_splits, pa_the_ptr, and pa_the_str. 00065 { 00066 pa_the_str = NULL; 00067 pa_splits = NULL; 00068 pa_ord = NULL; 00069 pa_the_ptr = 0; 00070 pa_breakchar = 0; 00071 pa_enable = pa_disable = 0; 00072 pa_nospace = 0; 00073 pa_quote = false; 00074 00075 pa_the_str = new char[strlen(s) + 1]; 00076 strcpy(pa_the_str,s); 00077 pa_splits = new char[strlen(sp) + 1]; 00078 strcpy(pa_splits,sp); 00079 pa_ord = new char[strlen(s) + 1]; 00080 *pa_ord = 0; 00081 }
Definition at line 83 of file ParseBT.cpp. References pa_breakchar, pa_disable, pa_enable, pa_nospace, pa_ord, pa_quote, pa_splits, pa_the_ptr, and pa_the_str. 00084 { 00085 pa_the_str = NULL; 00086 pa_splits = NULL; 00087 pa_ord = NULL; 00088 pa_the_ptr = 0; 00089 pa_breakchar = 0; 00090 pa_enable = pa_disable = 0; 00091 pa_nospace = 0; 00092 pa_quote = false; 00093 00094 pa_the_str = new char[strlen(s) + 1]; 00095 strcpy(pa_the_str,s); 00096 pa_splits = new char[strlen(sp) + 1]; 00097 strcpy(pa_splits,sp); 00098 pa_ord = new char[strlen(s) + 1]; 00099 *pa_ord = 0; 00100 pa_nospace = 1; 00101 }
Member Function Documentation
Definition at line 114 of file ParseBT.cpp. References pa_splits. Referenced by getrest(), getrestlen(), getsplit(), getword(), and getwordlen(). 00115 { 00116 short i; 00117 00118 if (pa_splits) 00119 for (i = 0; (size_t)i < strlen(pa_splits); i++) 00120 if (pa_splits[i] == c) 00121 return 1; 00122 return 0; 00123 }
Definition at line 125 of file ParseBT.cpp. References C, issplit(), pa_ord, pa_the_ptr, and pa_the_str. Referenced by getsplit(). 00126 { 00127 int x; 00128 00129 if (C == '=') 00130 { 00131 x = pa_the_ptr++; 00132 } else 00133 { 00134 while (C && (issplit(C))) 00135 pa_the_ptr++; 00136 x = pa_the_ptr; 00137 while (C && !issplit(C) && C != '=') 00138 pa_the_ptr++; 00139 } 00140 if (x == pa_the_ptr && C == '=') 00141 pa_the_ptr++; 00142 strncpy(pa_ord,pa_the_str + x,pa_the_ptr - x); 00143 pa_ord[pa_the_ptr - x] = 0; 00144 }
Definition at line 234 of file ParseBT.cpp. References getsplit(), and pa_ord. 00235 { 00236 ParseBT::getsplit(); 00237 strcpy(s,pa_ord); 00238 }
Definition at line 146 of file ParseBT.cpp. References C, DEB, issplit(), pa_breakchar, pa_disable, pa_enable, pa_nospace, pa_ord, pa_quote, pa_the_ptr, and pa_the_str. Referenced by getvalue(), and getword(). 00147 { 00148 int x; 00149 int disabled = 0; 00150 int quote = 0; 00151 00152 if (pa_nospace) 00153 { 00154 while (C && issplit(C)) 00155 pa_the_ptr++; 00156 x = pa_the_ptr; 00157 while (C && !issplit(C) && (C != pa_breakchar || !pa_breakchar || disabled)) 00158 { 00159 if (pa_breakchar && C == pa_disable) 00160 disabled = 1; 00161 if (pa_breakchar && C == pa_enable) 00162 disabled = 0; 00163 if (pa_quote && C == '"') 00164 quote = 1; 00165 pa_the_ptr++; 00166 while (quote && C && C != '"') 00167 { 00168 pa_the_ptr++; 00169 } 00170 if (pa_quote && C == '"') 00171 { 00172 pa_the_ptr++; 00173 } 00174 quote = 0; 00175 } 00176 } else 00177 { 00178 if (C == pa_breakchar && pa_breakchar) 00179 { 00180 x = pa_the_ptr++; 00181 } else 00182 { 00183 while (C && (C == ' ' || C == 9 || C == 13 || C == 10 || issplit(C))) 00184 pa_the_ptr++; 00185 x = pa_the_ptr; 00186 #define DEB(x) 00187 DEB(printf("Split starts at %d\n",x);) 00188 while (C && C != ' ' && C != 9 && C != 13 && C != 10 && !issplit(C) && 00189 (C != pa_breakchar || !pa_breakchar || disabled)) 00190 { 00191 DEB(printf("Char '%c'\n",C);) 00192 if (pa_breakchar && C == pa_disable) 00193 disabled = 1; 00194 if (pa_breakchar && C == pa_enable) 00195 disabled = 0; 00196 if (pa_quote && C == '"') 00197 { 00198 quote = 1; 00199 pa_the_ptr++; 00200 while (quote && C && C != '"') 00201 { 00202 pa_the_ptr++; 00203 } 00204 if (pa_quote && C == '"') 00205 { 00206 pa_the_ptr++; 00207 } 00208 } 00209 else 00210 pa_the_ptr++; 00211 quote = 0; 00212 } 00213 } 00214 if (x == pa_the_ptr && C == pa_breakchar && pa_breakchar) 00215 pa_the_ptr++; 00216 } 00217 strncpy(pa_ord,pa_the_str + x,pa_the_ptr - x); 00218 pa_ord[pa_the_ptr - x] = 0; 00219 }
Definition at line 221 of file ParseBT.cpp. References getword(), and pa_ord. 00222 { 00223 ParseBT::getword(); 00224 strcpy(s,pa_ord); 00225 }
Definition at line 227 of file ParseBT.cpp. References getword(), and pa_ord. 00228 { 00229 ParseBT::getword(); 00230 strncpy(s,pa_ord,l - 1); 00231 s[l - 1] = 0; 00232 }
Definition at line 240 of file ParseBT.cpp. References getword(), and pa_ord. 00241 { 00242 ParseBT::getword(); 00243 *s = 0; 00244 while (strlen(s) + strlen(pa_ord) < (size_t)l) 00245 strcat(s,fill); 00246 strcat(s,pa_ord); 00247 }
Definition at line 249 of file ParseBT.cpp. References C, issplit(), pa_the_ptr, and pa_the_str. 00250 { 00251 while (C && (C == ' ' || C == 9 || issplit(C))) 00252 pa_the_ptr++; 00253 strcpy(s,pa_the_str + pa_the_ptr); 00254 }
Definition at line 256 of file ParseBT.cpp. References getword(), and pa_ord. 00257 { 00258 ParseBT::getword(); 00259 return atol(pa_ord); 00260 }
Definition at line 262 of file ParseBT.cpp. References pa_breakchar. 00263 { 00264 pa_breakchar = c; 00265 }
Definition at line 267 of file ParseBT.cpp. References C, issplit(), pa_breakchar, and pa_the_ptr. 00268 { 00269 int x,y = pa_the_ptr,len; 00270 00271 if (C == pa_breakchar && pa_breakchar) 00272 { 00273 x = pa_the_ptr++; 00274 } else 00275 { 00276 while (C && (C == ' ' || C == 9 || C == 13 || C == 10 || issplit(C))) 00277 pa_the_ptr++; 00278 x = pa_the_ptr; 00279 while (C && C != ' ' && C != 9 && C != 13 && C != 10 && !issplit(C) && (C != pa_breakchar || !pa_breakchar)) 00280 pa_the_ptr++; 00281 } 00282 if (x == pa_the_ptr && C == pa_breakchar && pa_breakchar) 00283 pa_the_ptr++; 00284 len = pa_the_ptr - x; 00285 pa_the_ptr = y; 00286 return len; 00287 }
Definition at line 289 of file ParseBT.cpp. References C, issplit(), pa_the_ptr, and pa_the_str. 00290 { 00291 int y = pa_the_ptr,len; 00292 00293 while (C && (C == ' ' || C == 9 || issplit(C))) 00294 pa_the_ptr++; 00295 len = strlen(pa_the_str + pa_the_ptr); 00296 pa_the_ptr = y; 00297 return len; 00298 }
Definition at line 78 of file ParseBT.h. References pa_disable. 00078 { 00079 pa_disable = c; 00080 }
Definition at line 300 of file ParseBT.cpp. References C, pa_ord, pa_the_ptr, and pa_the_str. Referenced by getline(). 00301 { 00302 int x; 00303 00304 // while (C && (C == 13 || C == 10)) 00305 // pa_the_ptr++; 00306 x = pa_the_ptr; 00307 while (C && C != 13 && C != 10) 00308 pa_the_ptr++; 00309 strncpy(pa_ord,pa_the_str + x,pa_the_ptr - x); 00310 pa_ord[pa_the_ptr - x] = 0; 00311 if (C == 13) 00312 pa_the_ptr++; 00313 if (C == 10) 00314 pa_the_ptr++; 00315 }
Member Data Documentation
Definition at line 88 of file ParseBT.h. Referenced by getline(), getrest(), getrestlen(), getsplit(), getword(), ParseBT(), and ~ParseBT().
Definition at line 90 of file ParseBT.h. Referenced by getline(), getsplit(), getvalue(), getword(), ParseBT(), and ~ParseBT().
Definition at line 91 of file ParseBT.h. Referenced by getline(), getptr(), getrest(), getrestlen(), getsplit(), getword(), getwordlen(), and ParseBT().
Definition at line 92 of file ParseBT.h. Referenced by getword(), getwordlen(), ParseBT(), and setbreak().
The documentation for this class was generated from the following files: |