@@ -87,6 +87,22 @@ class U_COMMON_API CharString : public UMemory {
8787 * The caller must uprv_free() the result.
8888 */
8989 char *cloneData (UErrorCode &errorCode) const ;
90+ /* *
91+ * Copies the contents of the string into dest.
92+ * Checks if there is enough space in dest, extracts the entire string if possible,
93+ * and NUL-terminates dest if possible.
94+ *
95+ * If the string fits into dest but cannot be NUL-terminated (length()==capacity),
96+ * then the error code is set to U_STRING_NOT_TERMINATED_WARNING.
97+ * If the string itself does not fit into dest (length()>capacity),
98+ * then the error code is set to U_BUFFER_OVERFLOW_ERROR.
99+ *
100+ * @param dest Destination string buffer.
101+ * @param capacity Size of the dest buffer (number of chars).
102+ * @param errorCode ICU error code.
103+ * @return length()
104+ */
105+ int32_t extract (char *dest, int32_t capacity, UErrorCode &errorCode) const ;
90106
91107 bool operator ==(StringPiece other) const {
92108 return len == other.length () && (len == 0 || uprv_memcmp (data (), other.data (), len) == 0 );
@@ -141,13 +157,13 @@ class U_COMMON_API CharString : public UMemory {
141157
142158 /* *
143159 * Appends a filename/path part, e.g., a directory name.
144- * First appends a U_FILE_SEP_CHAR if necessary.
160+ * First appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if necessary.
145161 * Does nothing if s is empty.
146162 */
147163 CharString &appendPathPart (StringPiece s, UErrorCode &errorCode);
148164
149165 /* *
150- * Appends a U_FILE_SEP_CHAR if this string is not empty
166+ * Appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if this string is not empty
151167 * and does not already end with a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR.
152168 */
153169 CharString &ensureEndsWithFileSeparator (UErrorCode &errorCode);
@@ -160,6 +176,12 @@ class U_COMMON_API CharString : public UMemory {
160176
161177 CharString (const CharString &other); // forbid copying of this class
162178 CharString &operator =(const CharString &other); // forbid copying of this class
179+
180+ /* *
181+ * Returns U_FILE_ALT_SEP_CHAR if found in string, and U_FILE_SEP_CHAR is not found.
182+ * Otherwise returns U_FILE_SEP_CHAR.
183+ */
184+ char getDirSepChar () const ;
163185};
164186
165187U_NAMESPACE_END
0 commit comments