224 bool ends_with(char suffix_char) const {
225 return contains_byte_at(utf8_length() - 1, suffix_char);
226 }
227
228 // Tests if the symbol contains the given utf8 substring
229 // at the given byte position.
230 bool contains_utf8_at(int position, const char* substring, int len) const {
231 assert(len >= 0 && substring != nullptr, "substring must be valid");
232 if (position < 0) return false; // can happen with ends_with
233 if (position + len > utf8_length()) return false;
234 return (memcmp((char*)base() + position, substring, len) == 0);
235 }
236
237 // Tests if the symbol contains the given byte at the given position.
238 bool contains_byte_at(int position, char code_byte) const {
239 if (position < 0) return false; // can happen with ends_with
240 if (position >= utf8_length()) return false;
241 return code_byte == char_at(position);
242 }
243
244 // Test if the symbol has the give substring at or after the i-th char.
245 int index_of_at(int i, const char* substr, int substr_len) const;
246
247 // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
248 // note that the ordering is not alfabetical
249 inline int fast_compare(const Symbol* other) const;
250
251 // Returns receiver converted to null-terminated UTF-8 string; string is
252 // allocated in resource area, or in the char buffer provided by caller.
253 char* as_C_string() const;
254 char* as_C_string(char* buf, int size) const;
255
256 // Returns an escaped form of a Java string.
257 char* as_quoted_ascii() const;
258
259 // Returns a null terminated utf8 string in a resource array
260 char* as_utf8() const { return as_C_string(); }
261
262 jchar* as_unicode(int& length) const;
263
|
224 bool ends_with(char suffix_char) const {
225 return contains_byte_at(utf8_length() - 1, suffix_char);
226 }
227
228 // Tests if the symbol contains the given utf8 substring
229 // at the given byte position.
230 bool contains_utf8_at(int position, const char* substring, int len) const {
231 assert(len >= 0 && substring != nullptr, "substring must be valid");
232 if (position < 0) return false; // can happen with ends_with
233 if (position + len > utf8_length()) return false;
234 return (memcmp((char*)base() + position, substring, len) == 0);
235 }
236
237 // Tests if the symbol contains the given byte at the given position.
238 bool contains_byte_at(int position, char code_byte) const {
239 if (position < 0) return false; // can happen with ends_with
240 if (position >= utf8_length()) return false;
241 return code_byte == char_at(position);
242 }
243
244 // True if this is a descriptor for a method with void return.
245 // (Assumes it is a valid descriptor.)
246 bool is_void_method_signature() const {
247 return starts_with('(') && ends_with('V');
248 }
249
250 Symbol* fundamental_name(TRAPS);
251 bool is_same_fundamental_type(Symbol*) const;
252
253 // Test if the symbol has the give substring at or after the i-th char.
254 int index_of_at(int i, const char* substr, int substr_len) const;
255
256 // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
257 // note that the ordering is not alfabetical
258 inline int fast_compare(const Symbol* other) const;
259
260 // Returns receiver converted to null-terminated UTF-8 string; string is
261 // allocated in resource area, or in the char buffer provided by caller.
262 char* as_C_string() const;
263 char* as_C_string(char* buf, int size) const;
264
265 // Returns an escaped form of a Java string.
266 char* as_quoted_ascii() const;
267
268 // Returns a null terminated utf8 string in a resource array
269 char* as_utf8() const { return as_C_string(); }
270
271 jchar* as_unicode(int& length) const;
272
|