Changeset 18523 in vbox
- Timestamp:
- Mar 30, 2009 11:37:35 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 45388
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/string.h
r18424 r18523 50 50 /* 51 51 * Same case as with FreeBSD kernel: 52 * The string.h stuff clashes with sys/syst m.h52 * The string.h stuff clashes with sys/system.h 53 53 * ffs = find first set bit. 54 54 */ … … 193 193 * @param psz The string. 194 194 * @param cch The max string length. Use RTSTR_MAX to process the entire string. 195 * @param fFlags Teserved for future. Pass 0.195 * @param fFlags Reserved for future. Pass 0. 196 196 */ 197 197 RTDECL(int) RTStrValidateEncodingEx(const char *psz, size_t cch, uint32_t fFlags); … … 254 254 * If *ppusz is NULL or cCps is zero a buffer of at least cCps items 255 255 * will be allocated to hold the translated string. 256 * If a buffer was requ irestit must be freed using RTUtf16Free().256 * If a buffer was requested it must be freed using RTUtf16Free(). 257 257 * @param cCps The number of code points in the unicode string. This includes the terminator. 258 258 * @param pcCps Where to store the length of the translated string. (Optional) … … 269 269 * strings will be rejected. The primary purpose of this function is to 270 270 * help allocate buffers for RTStrToUtf16Ex of the correct size. For most 271 * other pur oses RTStrCalcUtf16LenEx() should be used.271 * other purposes RTStrCalcUtf16LenEx() should be used. 272 272 * 273 273 * @returns Number of RTUTF16 items. … … 313 313 * If *ppwsz is NULL or cwc is zero a buffer of at least cwc items 314 314 * will be allocated to hold the translated string. 315 * If a buffer was requ irestit must be freed using RTUtf16Free().315 * If a buffer was requested it must be freed using RTUtf16Free(). 316 316 * @param cwc The buffer size in RTUTF16s. This includes the terminator. 317 317 * @param pcwc Where to store the length of the translated string. (Optional) … … 363 363 * and return the pointer to the char following it. 364 364 * 365 * This function will not consider anything at or following the the365 * This function will not consider anything at or following the 366 366 * buffer area pointed to by psz. It is therefore not suitable for 367 367 * inserting code points into a string, only appending/overwriting. … … 370 370 * @param psz The string. 371 371 * @param CodePoint The code point to write. 372 * This s ould not be RTUNICP_INVALID or any other charater373 * out of the UTF-8 range.372 * This should not be RTUNICP_INVALID or any other 373 * character out of the UTF-8 range. 374 374 * 375 375 * @remark This is a worker function for RTStrPutCp(). … … 461 461 * and return the pointer to the char following it. 462 462 * 463 * This function will not consider anything at or following the the463 * This function will not consider anything at or following the 464 464 * buffer area pointed to by psz. It is therefore not suitable for 465 465 * inserting code points into a string, only appending/overwriting. … … 468 468 * @param psz The string. 469 469 * @param CodePoint The code point to write. 470 * This s ould not be RTUNICP_INVALID or any other charater471 * out of the UTF-8 range.470 * This should not be RTUNICP_INVALID or any other 471 * character out of the UTF-8 range. 472 472 * 473 473 * @remark We optimize this operation by using an inline function for … … 970 970 size_t *poffPattern); 971 971 972 973 972 /** @defgroup rt_str_conv String To/From Number Conversions 974 973 * @ingroup grp_rt_str … … 977 976 /** 978 977 * Converts a string representation of a number to a 64-bit unsigned number. 979 *980 * @returns iprt status code.981 * Warnings are used to indicate convertion problems.982 * @retval VWRN_NUMBER_TOO_BIG983 * @retval VWRN_NEGATIVE_UNSIGNED984 * @retval VWRN_TRAILING_CHARS985 * @retval VWRN_TRAILING_SPACES986 * @retval VINF_SUCCESS987 * @retval VERR_NO_DIGITS988 *989 * @param pszValue Pointer to the string value.990 * @param ppszNext Where to store the pointer to the first char following the number. (Optional)991 * @param uBase The base of the representation used.992 * If 0 the function will look for known prefixes before defaulting to 10.993 * @param pu64 Where to store the converted number. (optional)994 */995 RTDECL(int) RTStrToUInt64Ex(const char *pszValue, char **ppszNext, unsigned uBase, uint64_t *pu64);996 997 /**998 * Converts a string representation of a number to a 64-bit unsigned number,999 * making sure the full string is converted.1000 *1001 * @returns iprt status code.1002 * Warnings are used to indicate convertion problems.1003 * @retval VWRN_NUMBER_TOO_BIG1004 * @retval VWRN_NEGATIVE_UNSIGNED1005 * @retval VINF_SUCCESS1006 * @retval VERR_NO_DIGITS1007 * @retval VERR_TRAILING_SPACES1008 * @retval VERR_TRAILING_CHARS1009 *1010 * @param pszValue Pointer to the string value.1011 * @param uBase The base of the representation used.1012 * If 0 the function will look for known prefixes before defaulting to 10.1013 * @param pu64 Where to store the converted number. (optional)1014 */1015 RTDECL(int) RTStrToUInt64Full(const char *pszValue, unsigned uBase, uint64_t *pu64);1016 1017 /**1018 * Converts a string representation of a number to a 64-bit unsigned number.1019 * The base is guessed.1020 *1021 * @returns 64-bit unsigned number on success.1022 * @returns 0 on failure.1023 * @param pszValue Pointer to the string value.1024 */1025 RTDECL(uint64_t) RTStrToUInt64(const char *pszValue);1026 1027 /**1028 * Converts a string representation of a number to a 32-bit unsigned number.1029 978 * 1030 979 * @returns iprt status code. … … 1041 990 * @param uBase The base of the representation used. 1042 991 * If 0 the function will look for known prefixes before defaulting to 10. 1043 * @param pu 32Where to store the converted number. (optional)1044 */ 1045 RTDECL(int) RTStrToUInt 32Ex(const char *pszValue, char **ppszNext, unsigned uBase, uint32_t *pu32);1046 1047 /** 1048 * Converts a string representation of a number to a 32-bit unsigned number,992 * @param pu64 Where to store the converted number. (optional) 993 */ 994 RTDECL(int) RTStrToUInt64Ex(const char *pszValue, char **ppszNext, unsigned uBase, uint64_t *pu64); 995 996 /** 997 * Converts a string representation of a number to a 64-bit unsigned number, 1049 998 * making sure the full string is converted. 1050 999 * 1051 1000 * @returns iprt status code. 1052 * Warnings are used to indicate conver tion problems.1001 * Warnings are used to indicate conversion problems. 1053 1002 * @retval VWRN_NUMBER_TOO_BIG 1054 1003 * @retval VWRN_NEGATIVE_UNSIGNED … … 1061 1010 * @param uBase The base of the representation used. 1062 1011 * If 0 the function will look for known prefixes before defaulting to 10. 1063 * @param pu 32Where to store the converted number. (optional)1064 */ 1065 RTDECL(int) RTStrToUInt 32Full(const char *pszValue, unsigned uBase, uint32_t *pu32);1012 * @param pu64 Where to store the converted number. (optional) 1013 */ 1014 RTDECL(int) RTStrToUInt64Full(const char *pszValue, unsigned uBase, uint64_t *pu64); 1066 1015 1067 1016 /** … … 1069 1018 * The base is guessed. 1070 1019 * 1071 * @returns 32-bit unsigned number on success.1020 * @returns 64-bit unsigned number on success. 1072 1021 * @returns 0 on failure. 1073 1022 * @param pszValue Pointer to the string value. 1074 1023 */ 1075 RTDECL(uint 32_t) RTStrToUInt32(const char *pszValue);1076 1077 /** 1078 * Converts a string representation of a number to a 16-bit unsigned number.1024 RTDECL(uint64_t) RTStrToUInt64(const char *pszValue); 1025 1026 /** 1027 * Converts a string representation of a number to a 32-bit unsigned number. 1079 1028 * 1080 1029 * @returns iprt status code. … … 1091 1040 * @param uBase The base of the representation used. 1092 1041 * If 0 the function will look for known prefixes before defaulting to 10. 1093 * @param pu 16Where to store the converted number. (optional)1094 */ 1095 RTDECL(int) RTStrToUInt 16Ex(const char *pszValue, char **ppszNext, unsigned uBase, uint16_t *pu16);1096 1097 /** 1098 * Converts a string representation of a number to a 16-bit unsigned number,1042 * @param pu32 Where to store the converted number. (optional) 1043 */ 1044 RTDECL(int) RTStrToUInt32Ex(const char *pszValue, char **ppszNext, unsigned uBase, uint32_t *pu32); 1045 1046 /** 1047 * Converts a string representation of a number to a 32-bit unsigned number, 1099 1048 * making sure the full string is converted. 1100 1049 * 1101 1050 * @returns iprt status code. 1102 * Warnings are used to indicate conver tion problems.1051 * Warnings are used to indicate conversion problems. 1103 1052 * @retval VWRN_NUMBER_TOO_BIG 1104 1053 * @retval VWRN_NEGATIVE_UNSIGNED … … 1111 1060 * @param uBase The base of the representation used. 1112 1061 * If 0 the function will look for known prefixes before defaulting to 10. 1113 * @param pu16 Where to store the converted number. (optional) 1114 */ 1115 RTDECL(int) RTStrToUInt16Full(const char *pszValue, unsigned uBase, uint16_t *pu16); 1062 * @param pu32 Where to store the converted number. (optional) 1063 */ 1064 RTDECL(int) RTStrToUInt32Full(const char *pszValue, unsigned uBase, uint32_t *pu32); 1065 1066 /** 1067 * Converts a string representation of a number to a 64-bit unsigned number. 1068 * The base is guessed. 1069 * 1070 * @returns 32-bit unsigned number on success. 1071 * @returns 0 on failure. 1072 * @param pszValue Pointer to the string value. 1073 */ 1074 RTDECL(uint32_t) RTStrToUInt32(const char *pszValue); 1116 1075 1117 1076 /** 1118 1077 * Converts a string representation of a number to a 16-bit unsigned number. 1119 * The base is guessed.1120 *1121 * @returns 16-bit unsigned number on success.1122 * @returns 0 on failure.1123 * @param pszValue Pointer to the string value.1124 */1125 RTDECL(uint16_t) RTStrToUInt16(const char *pszValue);1126 1127 /**1128 * Converts a string representation of a number to a 8-bit unsigned number.1129 1078 * 1130 1079 * @returns iprt status code. … … 1141 1090 * @param uBase The base of the representation used. 1142 1091 * If 0 the function will look for known prefixes before defaulting to 10. 1143 * @param pu 8Where to store the converted number. (optional)1144 */ 1145 RTDECL(int) RTStrToUInt 8Ex(const char *pszValue, char **ppszNext, unsigned uBase, uint8_t *pu8);1146 1147 /** 1148 * Converts a string representation of a number to a 8-bit unsigned number,1092 * @param pu16 Where to store the converted number. (optional) 1093 */ 1094 RTDECL(int) RTStrToUInt16Ex(const char *pszValue, char **ppszNext, unsigned uBase, uint16_t *pu16); 1095 1096 /** 1097 * Converts a string representation of a number to a 16-bit unsigned number, 1149 1098 * making sure the full string is converted. 1150 1099 * 1151 1100 * @returns iprt status code. 1152 * Warnings are used to indicate conver tion problems.1101 * Warnings are used to indicate conversion problems. 1153 1102 * @retval VWRN_NUMBER_TOO_BIG 1154 1103 * @retval VWRN_NEGATIVE_UNSIGNED … … 1161 1110 * @param uBase The base of the representation used. 1162 1111 * If 0 the function will look for known prefixes before defaulting to 10. 1112 * @param pu16 Where to store the converted number. (optional) 1113 */ 1114 RTDECL(int) RTStrToUInt16Full(const char *pszValue, unsigned uBase, uint16_t *pu16); 1115 1116 /** 1117 * Converts a string representation of a number to a 16-bit unsigned number. 1118 * The base is guessed. 1119 * 1120 * @returns 16-bit unsigned number on success. 1121 * @returns 0 on failure. 1122 * @param pszValue Pointer to the string value. 1123 */ 1124 RTDECL(uint16_t) RTStrToUInt16(const char *pszValue); 1125 1126 /** 1127 * Converts a string representation of a number to a 8-bit unsigned number. 1128 * 1129 * @returns iprt status code. 1130 * Warnings are used to indicate conversion problems. 1131 * @retval VWRN_NUMBER_TOO_BIG 1132 * @retval VWRN_NEGATIVE_UNSIGNED 1133 * @retval VWRN_TRAILING_CHARS 1134 * @retval VWRN_TRAILING_SPACES 1135 * @retval VINF_SUCCESS 1136 * @retval VERR_NO_DIGITS 1137 * 1138 * @param pszValue Pointer to the string value. 1139 * @param ppszNext Where to store the pointer to the first char following the number. (Optional) 1140 * @param uBase The base of the representation used. 1141 * If 0 the function will look for known prefixes before defaulting to 10. 1142 * @param pu8 Where to store the converted number. (optional) 1143 */ 1144 RTDECL(int) RTStrToUInt8Ex(const char *pszValue, char **ppszNext, unsigned uBase, uint8_t *pu8); 1145 1146 /** 1147 * Converts a string representation of a number to a 8-bit unsigned number, 1148 * making sure the full string is converted. 1149 * 1150 * @returns iprt status code. 1151 * Warnings are used to indicate conversion problems. 1152 * @retval VWRN_NUMBER_TOO_BIG 1153 * @retval VWRN_NEGATIVE_UNSIGNED 1154 * @retval VINF_SUCCESS 1155 * @retval VERR_NO_DIGITS 1156 * @retval VERR_TRAILING_SPACES 1157 * @retval VERR_TRAILING_CHARS 1158 * 1159 * @param pszValue Pointer to the string value. 1160 * @param uBase The base of the representation used. 1161 * If 0 the function will look for known prefixes before defaulting to 10. 1163 1162 * @param pu8 Where to store the converted number. (optional) 1164 1163 */ … … 1199 1198 * 1200 1199 * @returns iprt status code. 1201 * Warnings are used to indicate conver tion problems.1200 * Warnings are used to indicate conversion problems. 1202 1201 * @retval VWRN_NUMBER_TOO_BIG 1203 1202 * @retval VINF_SUCCESS … … 1247 1246 * 1248 1247 * @returns iprt status code. 1249 * Warnings are used to indicate conver tion problems.1248 * Warnings are used to indicate conversion problems. 1250 1249 * @retval VWRN_NUMBER_TOO_BIG 1251 1250 * @retval VINF_SUCCESS … … 1295 1294 * 1296 1295 * @returns iprt status code. 1297 * Warnings are used to indicate conver tion problems.1296 * Warnings are used to indicate conversion problems. 1298 1297 * @retval VWRN_NUMBER_TOO_BIG 1299 1298 * @retval VINF_SUCCESS … … 1343 1342 * 1344 1343 * @returns iprt status code. 1345 * Warnings are used to indicate conver tion problems.1344 * Warnings are used to indicate conversion problems. 1346 1345 * @retval VWRN_NUMBER_TOO_BIG 1347 1346 * @retval VINF_SUCCESS … … 1411 1410 * 1412 1411 * @returns true on success. 1413 * @returns false if the string colli eded with an existing string.1412 * @returns false if the string collided with an existing string. 1414 1413 * @param pStrSpace The space to insert it into. 1415 1414 * @param pStr The string node. … … 1619 1618 * If *ppsz is NULL or cch is zero a buffer of at least cch chars 1620 1619 * will be allocated to hold the translated string. 1621 * If a buffer was requ irestit must be freed using RTUtf16Free().1620 * If a buffer was requested it must be freed using RTUtf16Free(). 1622 1621 * @param cch The buffer size in chars (the type). This includes the terminator. 1623 1622 * @param pcch Where to store the length of the translated string. (Optional) … … 1634 1633 * strings will be rejected. The primary purpose of this function is to 1635 1634 * help allocate buffers for RTUtf16ToUtf8() of the correct size. For most 1636 * other pur oses RTUtf16ToUtf8Ex() should be used.1635 * other purposes RTUtf16ToUtf8Ex() should be used. 1637 1636 * 1638 1637 * @returns Number of char (bytes). … … 1684 1683 * and return the pointer to the char following it. 1685 1684 * 1686 * This function will not consider anything at or following the the1685 * This function will not consider anything at or following the 1687 1686 * buffer area pointed to by pwsz. It is therefore not suitable for 1688 1687 * inserting code points into a string, only appending/overwriting. … … 1691 1690 * @param pwsz The string. 1692 1691 * @param CodePoint The code point to write. 1693 * This s ould not be RTUNICP_INVALID or any other charater1694 * out of the UTF-16 range.1692 * This should not be RTUNICP_INVALID or any other 1693 * character out of the UTF-16 range. 1695 1694 * 1696 1695 * @remark This is an internal worker for RTUtf16GetCpEx(). … … 1744 1743 * and return the pointer to the char following it. 1745 1744 * 1746 * This function will not consider anything at or following the the1745 * This function will not consider anything at or following the 1747 1746 * buffer area pointed to by pwsz. It is therefore not suitable for 1748 1747 * inserting code points into a string, only appending/overwriting. … … 1751 1750 * @param pwsz The string. 1752 1751 * @param CodePoint The code point to write. 1753 * This s ould not be RTUNICP_INVALID or any other charater1754 * out of the UTF-16 range.1752 * This should not be RTUNICP_INVALID or any other 1753 * character out of the UTF-16 range. 1755 1754 * 1756 1755 * @remark We optimize this operation by using an inline function for
Note:
See TracChangeset
for help on using the changeset viewer.