ICU-410 add API facades for string unescaping

X-SVN-Rev: 1707
This commit is contained in:
Markus Scherer 2000-06-29 19:36:20 +00:00
parent c685f44e89
commit 6aea18ee6e
4 changed files with 50 additions and 0 deletions

View File

@ -71,6 +71,25 @@ U_COMMON_API ostream &operator<<(ostream& stream, const UnicodeString& s);
# define UNICODE_STRING(cs, length) UnicodeString(cs, length, "")
#endif
/**
* Unescape an entire string.
* ### TBD
*/
U_COMMON_API UnicodeString
u_unescape(const UnicodeString &s);
/**
* Unescape one escape sequence in a string and return the code point.
* <code>s[offset]</code> must be the beginning of an escape sequence.
* <code>offset</code> is advanced to the first character after the
* escape sequence.
* If an error occurs, then U+ffff is returned and the offset is not
* advanced.
* ### TBD
*/
U_COMMON_API UChar32
u_unescape(const UnicodeString &s, int32_t &offset);
/**
* UnicodeString is a concrete implementation of the abstract class Replaceable.
* It is a string class that stores Unicode characters directly and provides

View File

@ -232,4 +232,13 @@ U_CAPI char* U_EXPORT2 u_austrcpy(char *s1,
# define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
#endif
/**
* Unescape a string of invariant characters and write
* the resulting Unicode characters to the destination.
* ### TBD
*/
U_CAPI int32_t U_EXPORT2
u_unescapeChars(const char *s,
UChar *dest, int32_t destSize);
#endif

View File

@ -85,6 +85,21 @@ us_arrayCopy(const UChar *src, int32_t srcStart,
UConverter* UnicodeString::fgDefaultConverter = 0;
//========================================
// Unescaping
//========================================
U_COMMON_API UnicodeString
u_unescape(const UnicodeString &s) {
/* ### TBD */
return s;
}
U_COMMON_API UChar32
u_unescape(const UnicodeString &s, int32_t &offset) {
/* ### TBD */
return 0xffff;
}
//========================================
// Constructors
//========================================

View File

@ -326,3 +326,10 @@ releaseDefaultConverter(UConverter *converter)
ucnv_close(converter);
}
}
U_CAPI int32_t U_EXPORT2
u_unescapeChars(const char *s,
UChar *dest, int32_t destSize) {
/* ### TBD */
return 0;
}