📄 apr__strings_8h-source.html
字号:
00179 <span class="comment"> * dst_size, the actual number of characters copied is</span>
00180 <span class="comment"> * dst_size - 1.</span>
00181 <span class="comment"> * @return Pointer to the NUL terminator of the destination string, dst</span>
00182 <span class="comment"> * @remark</span>
00183 <span class="comment"> * <PRE></span>
00184 <span class="comment"> * Note the differences between this function and strncpy():</span>
00185 <span class="comment"> * 1) strncpy() doesn't always NUL terminate; apr_cpystrn() does.</span>
00186 <span class="comment"> * 2) strncpy() pads the destination string with NULs, which is often </span>
00187 <span class="comment"> * unnecessary; apr_cpystrn() does not.</span>
00188 <span class="comment"> * 3) strncpy() returns a pointer to the beginning of the dst string;</span>
00189 <span class="comment"> * apr_cpystrn() returns a pointer to the NUL terminator of dst, </span>
00190 <span class="comment"> * to allow a check for truncation.</span>
00191 <span class="comment"> * </PRE></span>
00192 <span class="comment"> */</span>
00193 APR_DECLARE(<span class="keywordtype">char</span> *) apr_cpystrn(<span class="keywordtype">char</span> *dst, const <span class="keywordtype">char</span> *src,
00194 apr_size_t dst_size);
00195 <span class="comment"></span>
00196 <span class="comment">/**</span>
00197 <span class="comment"> * Strip spaces from a string</span>
00198 <span class="comment"> * @param dest The destination string. It is okay to modify the string</span>
00199 <span class="comment"> * in place. Namely dest == src</span>
00200 <span class="comment"> * @param src The string to rid the spaces from.</span>
00201 <span class="comment"> * @return The destination string, dest.</span>
00202 <span class="comment"> */</span>
00203 APR_DECLARE(<span class="keywordtype">char</span> *) apr_collapse_spaces(<span class="keywordtype">char</span> *dest, const <span class="keywordtype">char</span> *src);
00204 <span class="comment"></span>
00205 <span class="comment">/**</span>
00206 <span class="comment"> * Convert the arguments to a program from one string to an array of </span>
00207 <span class="comment"> * strings terminated by a NULL pointer</span>
00208 <span class="comment"> * @param arg_str The arguments to convert</span>
00209 <span class="comment"> * @param argv_out Output location. This is a pointer to an array of strings.</span>
00210 <span class="comment"> * @param token_context Pool to use.</span>
00211 <span class="comment"> */</span>
00212 APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const <span class="keywordtype">char</span> *arg_str,
00213 <span class="keywordtype">char</span> ***argv_out,
00214 apr_pool_t *token_context);
00215 <span class="comment"></span>
00216 <span class="comment">/**</span>
00217 <span class="comment"> * Split a string into separate null-terminated tokens. The tokens are </span>
00218 <span class="comment"> * delimited in the string by one or more characters from the sep</span>
00219 <span class="comment"> * argument.</span>
00220 <span class="comment"> * @param str The string to separate; this should be specified on the</span>
00221 <span class="comment"> * first call to apr_strtok() for a given string, and NULL</span>
00222 <span class="comment"> * on subsequent calls.</span>
00223 <span class="comment"> * @param sep The set of delimiters</span>
00224 <span class="comment"> * @param last Internal state saved by apr_strtok() between calls.</span>
00225 <span class="comment"> * @return The next token from the string</span>
00226 <span class="comment"> */</span>
00227 APR_DECLARE(<span class="keywordtype">char</span> *) apr_strtok(<span class="keywordtype">char</span> *str, const <span class="keywordtype">char</span> *sep, <span class="keywordtype">char</span> **last);
00228 <span class="comment"></span>
00229 <span class="comment">/**</span>
00230 <span class="comment"> * @defgroup APR_Strings_Snprintf snprintf implementations</span>
00231 <span class="comment"> * @warning</span>
00232 <span class="comment"> * These are snprintf implementations based on apr_vformatter().</span>
00233 <span class="comment"> *</span>
00234 <span class="comment"> * Note that various standards and implementations disagree on the return</span>
00235 <span class="comment"> * value of snprintf, and side-effects due to %n in the formatting string.</span>
00236 <span class="comment"> * apr_snprintf (and apr_vsnprintf) behaves as follows:</span>
00237 <span class="comment"> *</span>
00238 <span class="comment"> * Process the format string until the entire string is exhausted, or</span>
00239 <span class="comment"> * the buffer fills. If the buffer fills then stop processing immediately</span>
00240 <span class="comment"> * (so no further %n arguments are processed), and return the buffer</span>
00241 <span class="comment"> * length. In all cases the buffer is NUL terminated. It will return the</span>
00242 <span class="comment"> * number of characters inserted into the buffer, not including the</span>
00243 <span class="comment"> * terminating NUL. As a special case, if len is 0, apr_snprintf will</span>
00244 <span class="comment"> * return the number of characters that would have been inserted if</span>
00245 <span class="comment"> * the buffer had been infinite (in this case, *buffer can be NULL)</span>
00246 <span class="comment"> *</span>
00247 <span class="comment"> * In no event does apr_snprintf return a negative number.</span>
00248 <span class="comment"> * @{</span>
00249 <span class="comment"> */</span>
00250 <span class="comment"></span>
00251 <span class="comment">/**</span>
00252 <span class="comment"> * snprintf routine based on apr_vformatter. This means it understands the</span>
00253 <span class="comment"> * same extensions.</span>
00254 <span class="comment"> * @param buf The buffer to write to</span>
00255 <span class="comment"> * @param len The size of the buffer</span>
00256 <span class="comment"> * @param format The format string</span>
00257 <span class="comment"> * @param ... The arguments to use to fill out the format string.</span>
00258 <span class="comment"> */</span>
00259 APR_DECLARE_NONSTD(<span class="keywordtype">int</span>) apr_snprintf(<span class="keywordtype">char</span> *buf, apr_size_t len,
00260 const <span class="keywordtype">char</span> *format, ...)
00261 __attribute__((format(printf,3,4)));
00262 <span class="comment"></span>
00263 <span class="comment">/**</span>
00264 <span class="comment"> * vsnprintf routine based on apr_vformatter. This means it understands the</span>
00265 <span class="comment"> * same extensions.</span>
00266 <span class="comment"> * @param buf The buffer to write to</span>
00267 <span class="comment"> * @param len The size of the buffer</span>
00268 <span class="comment"> * @param format The format string</span>
00269 <span class="comment"> * @param ap The arguments to use to fill out the format string.</span>
00270 <span class="comment"> */</span>
00271 APR_DECLARE(<span class="keywordtype">int</span>) apr_vsnprintf(<span class="keywordtype">char</span> *buf, apr_size_t len, const <span class="keywordtype">char</span> *format,
00272 va_list ap);<span class="comment"></span>
00273 <span class="comment">/** @} */</span>
00274 <span class="comment"></span>
00275 <span class="comment">/**</span>
00276 <span class="comment"> * create a string representation of an int, allocated from a pool</span>
00277 <span class="comment"> * @param p The pool from which to allocate</span>
00278 <span class="comment"> * @param n The number to format</span>
00279 <span class="comment"> * @return The string representation of the number</span>
00280 <span class="comment"> */</span>
00281 APR_DECLARE(<span class="keywordtype">char</span> *) apr_itoa(apr_pool_t *p, <span class="keywordtype">int</span> n);
00282 <span class="comment"></span>
00283 <span class="comment">/**</span>
00284 <span class="comment"> * create a string representation of a long, allocated from a pool</span>
00285 <span class="comment"> * @param p The pool from which to allocate</span>
00286 <span class="comment"> * @param n The number to format</span>
00287 <span class="comment"> * @return The string representation of the number</span>
00288 <span class="comment"> */</span>
00289 APR_DECLARE(<span class="keywordtype">char</span> *) apr_ltoa(apr_pool_t *p, <span class="keywordtype">long</span> n);
00290 <span class="comment"></span>
00291 <span class="comment">/**</span>
00292 <span class="comment"> * create a string representation of an apr_off_t, allocated from a pool</span>
00293 <span class="comment"> * @param p The pool from which to allocate</span>
00294 <span class="comment"> * @param n The number to format</span>
00295 <span class="comment"> * @return The string representation of the number</span>
00296 <span class="comment"> */</span>
00297 APR_DECLARE(<span class="keywordtype">char</span> *) apr_off_t_toa(apr_pool_t *p, apr_off_t n);
00298 <span class="comment"></span>
00299 <span class="comment">/**</span>
00300 <span class="comment"> * Convert a numeric string into an apr_off_t numeric value.</span>
00301 <span class="comment"> * @param offset The value of the parsed string.</span>
00302 <span class="comment"> * @param buf The string to parse. It may contain optional whitespace,</span>
00303 <span class="comment"> * followed by an optional '+' (positive, default) or '-' (negative)</span>
00304 <span class="comment"> * character, followed by an optional '0x' prefix if base is 0 or 16,</span>
00305 <span class="comment"> * followed by numeric digits appropriate for base.</span>
00306 <span class="comment"> * @param end A pointer to the end of the valid character in buf. If</span>
00307 <span class="comment"> * not NULL, it is set to the first invalid character in buf.</span>
00308 <span class="comment"> * @param base A numeric base in the range between 2 and 36 inclusive,</span>
00309 <span class="comment"> * or 0. If base is zero, buf will be treated as base ten unless its</span>
00310 <span class="comment"> * digits are prefixed with '0x', in which case it will be treated as</span>
00311 <span class="comment"> * base 16.</span>
00312 <span class="comment"> */</span>
00313 APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const <span class="keywordtype">char</span> *buf,
00314 <span class="keywordtype">char</span> **end, <span class="keywordtype">int</span> base);
00315 <span class="comment"></span>
00316 <span class="comment">/**</span>
00317 <span class="comment"> * parse a numeric string into a 64-bit numeric value</span>
00318 <span class="comment"> * @param buf The string to parse. It may contain optional whitespace,</span>
00319 <span class="comment"> * followed by an optional '+' (positive, default) or '-' (negative)</span>
00320 <span class="comment"> * character, followed by an optional '0x' prefix if base is 0 or 16,</span>
00321 <span class="comment"> * followed by numeric digits appropriate for base.</span>
00322 <span class="comment"> * @param end A pointer to the end of the valid character in buf. If</span>
00323 <span class="comment"> * not NULL, it is set to the first invalid character in buf.</span>
00324 <span class="comment"> * @param base A numeric base in the range between 2 and 36 inclusive,</span>
00325 <span class="comment"> * or 0. If base is zero, buf will be treated as base ten unless its</span>
00326 <span class="comment"> * digits are prefixed with '0x', in which case it will be treated as</span>
00327 <span class="comment"> * base 16.</span>
00328 <span class="comment"> * @return The numeric value of the string. On overflow, errno is set</span>
00329 <span class="comment"> * to ERANGE.</span>
00330 <span class="comment"> */</span>
00331 APR_DECLARE(apr_int64_t) apr_strtoi64(const <span class="keywordtype">char</span> *buf, <span class="keywordtype">char</span> **end, <span class="keywordtype">int</span> base);
00332 <span class="comment"></span>
00333 <span class="comment">/**</span>
00334 <span class="comment"> * parse a base-10 numeric string into a 64-bit numeric value.</span>
00335 <span class="comment"> * Equivalent to apr_strtoi64(buf, (char**)NULL, 10).</span>
00336 <span class="comment"> * @param buf The string to parse</span>
00337 <span class="comment"> * @return The numeric value of the string</span>
00338 <span class="comment"> */</span>
00339 APR_DECLARE(apr_int64_t) apr_atoi64(const <span class="keywordtype">char</span> *buf);
00340 <span class="comment"></span>
00341 <span class="comment">/**</span>
00342 <span class="comment"> * Format a binary size (magnitiudes are 2^10 rather than 10^3) from an apr_off_t,</span>
00343 <span class="comment"> * as bytes, K, M, T, etc, to a four character compacted human readable string.</span>
00344 <span class="comment"> * @param size The size to format</span>
00345 <span class="comment"> * @param buf The 5 byte text buffer (counting the trailing null)</span>
00346 <span class="comment"> * @return The buf passed to apr_strfsize()</span>
00347 <span class="comment"> * @remark All negative sizes report ' - ', apr_strfsize only formats positive values.</span>
00348 <span class="comment"> */</span>
00349 APR_DECLARE(<span class="keywordtype">char</span> *) apr_strfsize(apr_off_t size, <span class="keywordtype">char</span> *buf);
00350 <span class="comment"></span>
00351 <span class="comment">/** @} */</span>
00352
00353 #ifdef __cplusplus
00354 }
00355 #endif
00356
00357 #endif <span class="comment">/* !APR_STRINGS_H */</span>
</div></pre><hr size="1"><address style="align: right;"><small>Generated on Mon Feb 7 13:18:25 2005 for Apache Portable Runtime by
<a href="../../../www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -