📄 apr__strings_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Apache Portable Runtime: apr_strings.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.7 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>apr_strings.h</h1><a href="apr__strings_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as</span>
00002 <span class="comment"> * applicable.</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
00005 <span class="comment"> * you may not use this file except in compliance with the License.</span>
00006 <span class="comment"> * You may obtain a copy of the License at</span>
00007 <span class="comment"> *</span>
00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span>
00009 <span class="comment"> *</span>
00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
00013 <span class="comment"> * See the License for the specific language governing permissions and</span>
00014 <span class="comment"> * limitations under the License.</span>
00015 <span class="comment"> */</span>
00016
00017 <span class="comment">/* Portions of this file are covered by */</span>
00018 <span class="comment">/* -*- mode: c; c-file-style: "k&r" -*-</span>
00019 <span class="comment"></span>
00020 <span class="comment"> strnatcmp.c -- Perform 'natural order' comparisons of strings in C.</span>
00021 <span class="comment"> Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au></span>
00022 <span class="comment"></span>
00023 <span class="comment"> This software is provided 'as-is', without any express or implied</span>
00024 <span class="comment"> warranty. In no event will the authors be held liable for any damages</span>
00025 <span class="comment"> arising from the use of this software.</span>
00026 <span class="comment"></span>
00027 <span class="comment"> Permission is granted to anyone to use this software for any purpose,</span>
00028 <span class="comment"> including commercial applications, and to alter it and redistribute it</span>
00029 <span class="comment"> freely, subject to the following restrictions:</span>
00030 <span class="comment"></span>
00031 <span class="comment"> 1. The origin of this software must not be misrepresented; you must not</span>
00032 <span class="comment"> claim that you wrote the original software. If you use this software</span>
00033 <span class="comment"> in a product, an acknowledgment in the product documentation would be</span>
00034 <span class="comment"> appreciated but is not required.</span>
00035 <span class="comment"> 2. Altered source versions must be plainly marked as such, and must not be</span>
00036 <span class="comment"> misrepresented as being the original software.</span>
00037 <span class="comment"> 3. This notice may not be removed or altered from any source distribution.</span>
00038 <span class="comment">*/</span>
00039
00040 <span class="preprocessor">#ifndef APR_STRINGS_H</span>
00041 <span class="preprocessor"></span><span class="preprocessor">#define APR_STRINGS_H</span>
00042 <span class="preprocessor"></span><span class="comment"></span>
00043 <span class="comment">/**</span>
00044 <span class="comment"> * @file apr_strings.h</span>
00045 <span class="comment"> * @brief APR Strings library</span>
00046 <span class="comment"> */</span>
00047
00048 <span class="preprocessor">#include "apr.h"</span>
00049 <span class="preprocessor">#include "<a class="code" href="apr__errno_8h.html">apr_errno.h</a>"</span>
00050 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
00051 <span class="preprocessor">#define APR_WANT_IOVEC</span>
00052 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="apr__want_8h.html">apr_want.h</a>"</span>
00053
00054 <span class="preprocessor">#if APR_HAVE_STDARG_H</span>
00055 <span class="preprocessor"></span><span class="preprocessor">#include <stdarg.h></span>
00056 <span class="preprocessor">#endif</span>
00057 <span class="preprocessor"></span>
00058 <span class="preprocessor">#ifdef __cplusplus</span>
00059 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00060 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
00061 <span class="comment"></span>
00062 <span class="comment">/**</span>
00063 <span class="comment"> * @defgroup apr_strings String routines</span>
00064 <span class="comment"> * @ingroup APR </span>
00065 <span class="comment"> * @{</span>
00066 <span class="comment"> */</span>
00067 <span class="comment"></span>
00068 <span class="comment">/**</span>
00069 <span class="comment"> * Do a natural order comparison of two strings.</span>
00070 <span class="comment"> * @param a The first string to compare</span>
00071 <span class="comment"> * @param b The second string to compare</span>
00072 <span class="comment"> * @return Either <0, 0, or >0. If the first string is less than the second</span>
00073 <span class="comment"> * this returns <0, if they are equivalent it returns 0, and if the</span>
00074 <span class="comment"> * first string is greater than second string it retuns >0.</span>
00075 <span class="comment"> */</span>
00076 APR_DECLARE(<span class="keywordtype">int</span>) apr_strnatcmp(<span class="keywordtype">char</span> const *a, <span class="keywordtype">char</span> const *b);
00077 <span class="comment"></span>
00078 <span class="comment">/**</span>
00079 <span class="comment"> * Do a natural order comparison of two strings ignoring the case of the </span>
00080 <span class="comment"> * strings.</span>
00081 <span class="comment"> * @param a The first string to compare</span>
00082 <span class="comment"> * @param b The second string to compare</span>
00083 <span class="comment"> * @return Either <0, 0, or >0. If the first string is less than the second</span>
00084 <span class="comment"> * this returns <0, if they are equivalent it returns 0, and if the</span>
00085 <span class="comment"> * first string is greater than second string it retuns >0.</span>
00086 <span class="comment"> */</span>
00087 APR_DECLARE(<span class="keywordtype">int</span>) apr_strnatcasecmp(<span class="keywordtype">char</span> const *a, <span class="keywordtype">char</span> const *b);
00088 <span class="comment"></span>
00089 <span class="comment">/**</span>
00090 <span class="comment"> * duplicate a string into memory allocated out of a pool</span>
00091 <span class="comment"> * @param p The pool to allocate out of</span>
00092 <span class="comment"> * @param s The string to duplicate</span>
00093 <span class="comment"> * @return The new string</span>
00094 <span class="comment"> */</span>
00095 APR_DECLARE(<span class="keywordtype">char</span> *) apr_pstrdup(apr_pool_t *p, const <span class="keywordtype">char</span> *s);
00096 <span class="comment"></span>
00097 <span class="comment">/**</span>
00098 <span class="comment"> * Create a null-terminated string by making a copy of a sequence</span>
00099 <span class="comment"> * of characters and appending a null byte</span>
00100 <span class="comment"> * @param p The pool to allocate out of</span>
00101 <span class="comment"> * @param s The block of characters to duplicate</span>
00102 <span class="comment"> * @param n The number of characters to duplicate</span>
00103 <span class="comment"> * @return The new string</span>
00104 <span class="comment"> * @remark This is a faster alternative to apr_pstrndup, for use</span>
00105 <span class="comment"> * when you know that the string being duplicated really</span>
00106 <span class="comment"> * has 'n' or more characters. If the string might contain</span>
00107 <span class="comment"> * fewer characters, use apr_pstrndup.</span>
00108 <span class="comment"> */</span>
00109 APR_DECLARE(<span class="keywordtype">char</span> *) apr_pstrmemdup(apr_pool_t *p, const <span class="keywordtype">char</span> *s, apr_size_t n);
00110 <span class="comment"></span>
00111 <span class="comment">/**</span>
00112 <span class="comment"> * duplicate the first n characters of a string into memory allocated </span>
00113 <span class="comment"> * out of a pool; the new string will be null-terminated</span>
00114 <span class="comment"> * @param p The pool to allocate out of</span>
00115 <span class="comment"> * @param s The string to duplicate</span>
00116 <span class="comment"> * @param n The number of characters to duplicate</span>
00117 <span class="comment"> * @return The new string</span>
00118 <span class="comment"> */</span>
00119 APR_DECLARE(<span class="keywordtype">char</span> *) apr_pstrndup(apr_pool_t *p, const <span class="keywordtype">char</span> *s, apr_size_t n);
00120 <span class="comment"></span>
00121 <span class="comment">/**</span>
00122 <span class="comment"> * Duplicate a block of memory.</span>
00123 <span class="comment"> *</span>
00124 <span class="comment"> * @param p The pool to allocate from</span>
00125 <span class="comment"> * @param m The memory to duplicate</span>
00126 <span class="comment"> * @param n The number of bytes to duplicate</span>
00127 <span class="comment"> * @return The new block of memory</span>
00128 <span class="comment"> */</span>
00129 APR_DECLARE(<span class="keywordtype">void</span> *) apr_pmemdup(apr_pool_t *p, const <span class="keywordtype">void</span> *m, apr_size_t n);
00130 <span class="comment"></span>
00131 <span class="comment">/**</span>
00132 <span class="comment"> * Concatenate multiple strings, allocating memory out a pool</span>
00133 <span class="comment"> * @param p The pool to allocate out of</span>
00134 <span class="comment"> * @param ... The strings to concatenate. The final string must be NULL</span>
00135 <span class="comment"> * @return The new string</span>
00136 <span class="comment"> */</span>
00137 APR_DECLARE_NONSTD(<span class="keywordtype">char</span> *) apr_pstrcat(apr_pool_t *p, ...);
00138 <span class="comment"></span>
00139 <span class="comment">/**</span>
00140 <span class="comment"> * Concatenate multiple strings specified in a writev-style vector</span>
00141 <span class="comment"> * @param p The pool from which to allocate</span>
00142 <span class="comment"> * @param vec The strings to concatenate</span>
00143 <span class="comment"> * @param nvec The number of strings to concatenate</span>
00144 <span class="comment"> * @param nbytes (output) strlen of new string (pass in NULL to omit)</span>
00145 <span class="comment"> * @return The new string</span>
00146 <span class="comment"> */</span>
00147 APR_DECLARE(<span class="keywordtype">char</span> *) apr_pstrcatv(apr_pool_t *p, const struct iovec *vec,
00148 apr_size_t nvec, apr_size_t *nbytes);
00149 <span class="comment"></span>
00150 <span class="comment">/**</span>
00151 <span class="comment"> * printf-style style printing routine. The data is output to a string </span>
00152 <span class="comment"> * allocated from a pool</span>
00153 <span class="comment"> * @param p The pool to allocate out of</span>
00154 <span class="comment"> * @param fmt The format of the string</span>
00155 <span class="comment"> * @param ap The arguments to use while printing the data</span>
00156 <span class="comment"> * @return The new string</span>
00157 <span class="comment"> */</span>
00158 APR_DECLARE(<span class="keywordtype">char</span> *) apr_pvsprintf(apr_pool_t *p, const <span class="keywordtype">char</span> *fmt, va_list ap);
00159 <span class="comment"></span>
00160 <span class="comment">/**</span>
00161 <span class="comment"> * printf-style style printing routine. The data is output to a string </span>
00162 <span class="comment"> * allocated from a pool</span>
00163 <span class="comment"> * @param p The pool to allocate out of</span>
00164 <span class="comment"> * @param fmt The format of the string</span>
00165 <span class="comment"> * @param ... The arguments to use while printing the data</span>
00166 <span class="comment"> * @return The new string</span>
00167 <span class="comment"> */</span>
00168 APR_DECLARE_NONSTD(<span class="keywordtype">char</span> *) apr_psprintf(apr_pool_t *p, const <span class="keywordtype">char</span> *fmt, ...)
00169 __attribute__((format(printf,2,3)));
00170 <span class="comment"></span>
00171 <span class="comment">/**</span>
00172 <span class="comment"> * Copy up to dst_size characters from src to dst; does not copy</span>
00173 <span class="comment"> * past a NUL terminator in src, but always terminates dst with a NUL</span>
00174 <span class="comment"> * regardless.</span>
00175 <span class="comment"> * @param dst The destination string</span>
00176 <span class="comment"> * @param src The source string</span>
00177 <span class="comment"> * @param dst_size The space available in dst; dst always receives</span>
00178 <span class="comment"> * NUL termination, so if src is longer than</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -