📄 cpl__string_8h.html
字号:
</table></div><div class="memdoc"><p>Binary to hexadecimal translation.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>nBytes</em> </td><td>number of bytes of binary data in pabyData. </td></tr> <tr><td valign="top"></td><td valign="top"><em>pabyData</em> </td><td>array of data bytes to translate.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>hexadecimal translation, zero terminated. Free with CPLFree(). </dd></dl></div></div><p><a class="anchor" name="df2c0e5051d8f5c7fc742e4be41e935a"></a><!-- doxytag: member="cpl_string.h::CPLEscapeString" ref="df2c0e5051d8f5c7fc742e4be41e935a" args="(const char *pszString, int nLength, int nScheme)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">char* CPLEscapeString </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszInput</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>nLength</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>nScheme</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Apply escaping to string to preserve special characters.<p>This function will "escape" a variety of special characters to make the string suitable to embed within a string constant or to write within a text stream but in a form that can be reconstitued to it's original form. The escaping will even preserve zero bytes allowing preservation of raw binary data.<p>CPLES_BackslashQuotable(0): This scheme turns a binary string into a form suitable to be placed within double quotes as a string constant. The backslash, quote, '' and newline characters are all escaped in the usual C style.<p>CPLES_XML(1): This scheme converts the '<', '<' and '&' characters into their XML/HTML equivelent (>, < and &) making a string safe to embed as CDATA within an XML element. The '' is not escaped and should not be included in the input.<p>CPLES_URL(2): Everything except alphanumerics and the underscore are converted to a percent followed by a two digit hex encoding of the character (leading zero supplied if needed). This is the mechanism used for encoding values to be passed in URLs.<p>CPLES_SQL(3): All single quotes are replaced with two single quotes. Suitable for use when constructing literal values for SQL commands where the literal will be enclosed in single quotes.<p>CPLES_CSV(4): If the values contains commas, double quotes, or newlines it placed in double quotes, and double quotes in the value are doubled. Suitable for use when constructing field values for .csv files. Note that <a class="el" href="cpl__string_8h.html#74938e1e92b5847af925600af609f8d3">CPLUnescapeString()</a> currently does not support this format, only <a class="el" href="cpl__string_8h.html#df2c0e5051d8f5c7fc742e4be41e935a">CPLEscapeString()</a>. See cpl_csv.cpp for csv parsing support.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>pszInput</em> </td><td>the string to escape. </td></tr> <tr><td valign="top"></td><td valign="top"><em>nLength</em> </td><td>The number of bytes of data to preserve. If this is -1 the strlen(pszString) function will be used to compute the length. </td></tr> <tr><td valign="top"></td><td valign="top"><em>nScheme</em> </td><td>the encoding scheme to use.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>an escaped, zero terminated string that should be freed with CPLFree() when no longer needed. </dd></dl></div></div><p><a class="anchor" name="ababd56ea0317416780a1acc19aa61a3"></a><!-- doxytag: member="cpl_string.h::CPLHexToBinary" ref="ababd56ea0317416780a1acc19aa61a3" args="(const char *pszHex, int *pnBytes)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">GByte* CPLHexToBinary </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszHex</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int * </td> <td class="paramname"> <em>pnBytes</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Hexadecimal to binary translation<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em></em> </td><td></td></tr> </table></dl></div></div><p><a class="anchor" name="40ff577b83aca84a603414183e6903d3"></a><!-- doxytag: member="cpl_string.h::CPLParseNameValue" ref="40ff577b83aca84a603414183e6903d3" args="(const char *pszNameValue, char **ppszKey)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* CPLParseNameValue </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszNameValue</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char ** </td> <td class="paramname"> <em>ppszKey</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Parse NAME=VALUE string into name and value components.<p>Note that if ppszKey is non-NULL, the key (or name) portion will be allocated using VSIMalloc(), and returned in that pointer. It is the applications responsibility to free this string, but the application should not modify or free the returned value portion.<p>This function also support "NAME:VALUE" strings and will strip white space from around the delimeter when forming name and value strings.<p>Eventually CSLFetchNameValue() and friends may be modified to use <a class="el" href="cpl__string_8h.html#40ff577b83aca84a603414183e6903d3">CPLParseNameValue()</a>.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>pszNameValue</em> </td><td>string in "NAME=VALUE" format. </td></tr> <tr><td valign="top"></td><td valign="top"><em>ppszKey</em> </td><td>optional pointer though which to return the name portion. </td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>the value portion (pointing into original string). </dd></dl></div></div><p><a class="anchor" name="74938e1e92b5847af925600af609f8d3"></a><!-- doxytag: member="cpl_string.h::CPLUnescapeString" ref="74938e1e92b5847af925600af609f8d3" args="(const char *pszString, int *pnLength, int nScheme)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">char* CPLUnescapeString </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszInput</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int * </td> <td class="paramname"> <em>pnLength</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>nScheme</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table></div><div class="memdoc"><p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -