< prev index next >

src/hotspot/share/oops/symbol.hpp

Print this page
rev 55090 : secret-sfac


 181   }
 182 
 183   const u1* bytes() const { return base(); }
 184 
 185   int utf8_length() const { return length(); }
 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




 181   }
 182 
 183   const u1* bytes() const { return base(); }
 184 
 185   int utf8_length() const { return length(); }
 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     return contains_utf8_at(0, prefix, len);
 203   }
 204   bool starts_with(const char* prefix) const {
 205     return starts_with(prefix, (int) strlen(prefix));
 206   }
 207   bool starts_with(char prefix_char) const {
 208     return contains_byte_at(0, prefix_char);
 209   }
 210   // Tests if the symbol ends with the given suffix.
 211   bool ends_with(const char* suffix, int len) const {
 212     return contains_utf8_at(utf8_length() - len, suffix, len);
 213   }
 214   bool ends_with(const char* suffix) const {
 215     return ends_with(suffix, (int) strlen(suffix));
 216   }
 217   bool ends_with(char suffix_char) const {
 218     return contains_byte_at(utf8_length()-1, suffix_char);
 219   }
 220   // Tests if the symbol contains the given utf8 substring
 221   // or byte at the given byte position.
 222   bool contains_utf8_at(int position, const char* substring, int len) const;
 223   bool contains_byte_at(int position, char code_byte) const;
 224 
 225   // True if this is a descriptor for a method with void return.
 226   // (Assumes it is a valid descriptor.)
 227   bool is_void_method_signature() const {
 228     return starts_with('(') && ends_with('V');
 229   }
 230   
 231   bool is_Q_signature() const;
 232   Symbol* fundamental_name(TRAPS);
 233   bool is_same_fundamental_type(Symbol*) const;
 234 
 235   // Tests if the symbol starts with the given prefix.
 236   int index_of_at(int i, const char* str, int len) const;
 237 
 238   // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
 239   // note that the ordering is not alfabetical
 240   inline int fast_compare(const Symbol* other) const;
 241 
 242   // Returns receiver converted to null-terminated UTF-8 string; string is
 243   // allocated in resource area, or in the char buffer provided by caller.
 244   char* as_C_string() const;
 245   char* as_C_string(char* buf, int size) const;
 246 
 247   // Returns an escaped form of a Java string.
 248   char* as_quoted_ascii() const;
 249 
 250   // Returns a null terminated utf8 string in a resource array


< prev index next >