186
187 // Compares the symbol with a string.
188 bool equals(const char* str, int len) const {
189 int l = utf8_length();
190 if (l != len) return false;
191 while (l-- > 0) {
192 if (str[l] != char_at(l))
193 return false;
194 }
195 assert(l == -1, "we should be at the beginning");
196 return true;
197 }
198 bool equals(const char* str) const { return equals(str, (int) strlen(str)); }
199
200 // Tests if the symbol starts with the given prefix.
201 bool starts_with(const char* prefix, int len) const;
202 bool starts_with(const char* prefix) const {
203 return starts_with(prefix, (int) strlen(prefix));
204 }
205 bool is_Q_signature() const;
206 Symbol* fundamental_name(TRAPS);
207 bool is_same_fundamental_type(Symbol*) const;
208
209 // Tests if the symbol starts with the given prefix.
210 int index_of_at(int i, const char* str, int len) const;
211
212 // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
213 // note that the ordering is not alfabetical
214 inline int fast_compare(const Symbol* other) const;
215
216 // Returns receiver converted to null-terminated UTF-8 string; string is
217 // allocated in resource area, or in the char buffer provided by caller.
218 char* as_C_string() const;
219 char* as_C_string(char* buf, int size) const;
220
221 // Returns an escaped form of a Java string.
222 char* as_quoted_ascii() const;
223
224 // Returns a null terminated utf8 string in a resource array
225 char* as_utf8() const { return as_C_string(); }
|
186
187 // Compares the symbol with a string.
188 bool equals(const char* str, int len) const {
189 int l = utf8_length();
190 if (l != len) return false;
191 while (l-- > 0) {
192 if (str[l] != char_at(l))
193 return false;
194 }
195 assert(l == -1, "we should be at the beginning");
196 return true;
197 }
198 bool equals(const char* str) const { return equals(str, (int) strlen(str)); }
199
200 // Tests if the symbol starts with the given prefix.
201 bool starts_with(const char* prefix, int len) const;
202 bool starts_with(const char* prefix) const {
203 return starts_with(prefix, (int) strlen(prefix));
204 }
205 bool is_Q_signature() const;
206 bool is_Q_array_signature() const;
207 Symbol* fundamental_name(TRAPS);
208 bool is_same_fundamental_type(Symbol*) const;
209
210 // Tests if the symbol starts with the given prefix.
211 int index_of_at(int i, const char* str, int len) const;
212
213 // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
214 // note that the ordering is not alfabetical
215 inline int fast_compare(const Symbol* other) const;
216
217 // Returns receiver converted to null-terminated UTF-8 string; string is
218 // allocated in resource area, or in the char buffer provided by caller.
219 char* as_C_string() const;
220 char* as_C_string(char* buf, int size) const;
221
222 // Returns an escaped form of a Java string.
223 char* as_quoted_ascii() const;
224
225 // Returns a null terminated utf8 string in a resource array
226 char* as_utf8() const { return as_C_string(); }
|