219 assert(len >= 0 && substring != NULL, "substring must be valid");
220 if (position < 0) return false; // can happen with ends_with
221 if (position + len > utf8_length()) return false;
222 return (memcmp((char*)base() + position, substring, len) == 0);
223 }
224
225 // Tests if the symbol contains the given byte at the given position.
226 bool contains_byte_at(int position, char code_byte) const {
227 if (position < 0) return false; // can happen with ends_with
228 if (position >= utf8_length()) return false;
229 return code_byte == char_at(position);
230 }
231
232 // True if this is a descriptor for a method with void return.
233 // (Assumes it is a valid descriptor.)
234 bool is_void_method_signature() const {
235 return starts_with('(') && ends_with('V');
236 }
237
238 bool is_Q_signature() const;
239 bool is_Q_array_signature() const;
240 bool is_Q_method_signature() const;
241 bool is_Q_singledim_array_signature() const;
242 Symbol* fundamental_name(TRAPS);
243 bool is_same_fundamental_type(Symbol*) const;
244
245 // Tests if the symbol starts with the given prefix.
246 int index_of_at(int i, const char* str, int len) const;
247
248 // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
249 // note that the ordering is not alfabetical
250 inline int fast_compare(const Symbol* other) const;
251
252 // Returns receiver converted to null-terminated UTF-8 string; string is
253 // allocated in resource area, or in the char buffer provided by caller.
254 char* as_C_string() const;
255 char* as_C_string(char* buf, int size) const;
256
257 // Returns an escaped form of a Java string.
258 char* as_quoted_ascii() const;
|
219 assert(len >= 0 && substring != NULL, "substring must be valid");
220 if (position < 0) return false; // can happen with ends_with
221 if (position + len > utf8_length()) return false;
222 return (memcmp((char*)base() + position, substring, len) == 0);
223 }
224
225 // Tests if the symbol contains the given byte at the given position.
226 bool contains_byte_at(int position, char code_byte) const {
227 if (position < 0) return false; // can happen with ends_with
228 if (position >= utf8_length()) return false;
229 return code_byte == char_at(position);
230 }
231
232 // True if this is a descriptor for a method with void return.
233 // (Assumes it is a valid descriptor.)
234 bool is_void_method_signature() const {
235 return starts_with('(') && ends_with('V');
236 }
237
238 bool is_Q_signature() const;
239 bool is_L_signature() const;
240 bool is_Q_array_signature() const;
241 bool is_Q_method_signature() const;
242 bool is_Q_singledim_array_signature() const;
243 Symbol* fundamental_name(TRAPS);
244 bool is_same_fundamental_type(Symbol*) const;
245
246 // Tests if the symbol starts with the given prefix.
247 int index_of_at(int i, const char* str, int len) const;
248
249 // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
250 // note that the ordering is not alfabetical
251 inline int fast_compare(const Symbol* other) const;
252
253 // Returns receiver converted to null-terminated UTF-8 string; string is
254 // allocated in resource area, or in the char buffer provided by caller.
255 char* as_C_string() const;
256 char* as_C_string(char* buf, int size) const;
257
258 // Returns an escaped form of a Java string.
259 char* as_quoted_ascii() const;
|