Changeset 13927 in vbox for trunk/include
- Timestamp:
- Nov 6, 2008 6:07:59 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 38950
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/string.h
r13549 r13927 302 302 * Get the unicode code point at the given string position. 303 303 * 304 * @returns unicode code point.305 * @returns RTUNICP_INVALIDif the encoding is invalid.304 * @returns iprt status code 305 * @returns VERR_INVALID_UTF8_ENCODING if the encoding is invalid. 306 306 * @param ppsz The string. 307 307 * @param pCp Where to store the unicode code point. 308 * Stores RTUNICP_INVALID if the encoding is invalid. 308 309 */ 309 310 RTDECL(int) RTStrGetCpExInternal(const char **ppsz, PRTUNICP pCp); 311 312 /** 313 * Get the unicode code point at the given string position for a string of a 314 * given length. 315 * 316 * @returns iprt status code 317 * @returns VERR_INVALID_UTF8_ENCODING if the encoding is invalid. 318 * @param ppsz The string. 319 * @param pCp Where to store the unicode code point. 320 * Stores RTUNICP_INVALID if the encoding is invalid. 321 * @param pcch Pointer to the length of the string. This will be 322 * decremented by the size of the code point. 323 */ 324 RTDECL(int) RTStrGetCpNExInternal(const char **ppsz, PRTUNICP pCp, size_t *pcch); 310 325 311 326 /** … … 370 385 } 371 386 return RTStrGetCpExInternal(ppsz, pCp); 387 } 388 389 /** 390 * Get the unicode code point at the given string position for a string of a 391 * given maximum length. 392 * 393 * @returns iprt status code. 394 * @param ppsz Pointer to the string pointer. This will be updated to 395 * point to the char following the current code point. 396 * @param pCp Where to store the code point. 397 * RTUNICP_INVALID is stored here on failure. 398 * @param pcch Pointer to the maximum string length. This will be 399 * decremented by the size of the code point found. 400 * 401 * @remark We optimize this operation by using an inline function for 402 * the most frequent and simplest sequence, the rest is 403 * handled by RTStrGetCpNExInternal(). 404 */ 405 DECLINLINE(int) RTStrGetCpNEx(const char **ppsz, PRTUNICP pCp, size_t *pcch) 406 { 407 const unsigned char uch = **(const unsigned char **)ppsz; 408 if (*pcch != 0 && !(uch & RT_BIT(7))) 409 { 410 (*ppsz)++; 411 (*pcch)--; 412 *pCp = uch; 413 return VINF_SUCCESS; 414 } 415 return RTStrGetCpNExInternal(ppsz, pCp, pcch); 372 416 } 373 417 … … 738 782 739 783 /** 740 * Performs a case insensitive string compare between two UTF-8 strings. 741 * 742 * This is a simplified compare, as only the simplified lower/upper case folding 743 * specified by the unicode specs are used. It does not consider character pairs 744 * as they are used in some languages, just simple upper & lower case compares. 745 * 746 * The result is the difference between the mismatching codepoints after they 747 * both have been lower cased. 748 * 749 * If the string encoding is invalid the function will assert (strict builds) 750 * and use RTStrCmp for the remainder of the string. 784 * Performs a case sensitive string compare between two UTF-8 strings, given 785 * a maximum string length. 786 * 787 * Encoding errors are ignored by the current implementation. So, the only 788 * difference between this and the CRT strncmp function is the handling of 789 * NULL arguments. 751 790 * 752 791 * @returns < 0 if the first string less than the second string. … … 755 794 * @param psz1 First UTF-8 string. Null is allowed. 756 795 * @param psz2 Second UTF-8 string. Null is allowed. 796 * @param cchMax The maximum string length 797 */ 798 RTDECL(int) RTStrNCmp(const char *psz1, const char *psz2, size_t cchMax); 799 800 /** 801 * Performs a case insensitive string compare between two UTF-8 strings. 802 * 803 * This is a simplified compare, as only the simplified lower/upper case folding 804 * specified by the unicode specs are used. It does not consider character pairs 805 * as they are used in some languages, just simple upper & lower case compares. 806 * 807 * The result is the difference between the mismatching codepoints after they 808 * both have been lower cased. 809 * 810 * If the string encoding is invalid the function will assert (strict builds) 811 * and use RTStrCmp for the remainder of the string. 812 * 813 * @returns < 0 if the first string less than the second string. 814 * @returns 0 if the first string identical to the second string. 815 * @returns > 0 if the first string greater than the second string. 816 * @param psz1 First UTF-8 string. Null is allowed. 817 * @param psz2 Second UTF-8 string. Null is allowed. 757 818 */ 758 819 RTDECL(int) RTStrICmp(const char *psz1, const char *psz2); 820 821 /** 822 * Performs a case insensitive string compare between two UTF-8 strings, given a 823 * maximum string length. 824 * 825 * This is a simplified compare, as only the simplified lower/upper case folding 826 * specified by the unicode specs are used. It does not consider character pairs 827 * as they are used in some languages, just simple upper & lower case compares. 828 * 829 * The result is the difference between the mismatching codepoints after they 830 * both have been lower cased. 831 * 832 * If the string encoding is invalid the function will assert (strict builds) 833 * and use RTStrCmp for the remainder of the string. 834 * 835 * @returns < 0 if the first string less than the second string. 836 * @returns 0 if the first string identical to the second string. 837 * @returns > 0 if the first string greater than the second string. 838 * @param psz1 First UTF-8 string. Null is allowed. 839 * @param psz2 Second UTF-8 string. Null is allowed. 840 * @param cchMax Maximum string length 841 */ 842 RTDECL(int) RTStrNICmp(const char *psz1, const char *psz2, size_t cchMax); 759 843 760 844 /**
Note:
See TracChangeset
for help on using the changeset viewer.