util/dsymtable.cc
changeset 350 2c3c4dc34979
parent 279 c0453b7f99df
child 596 4efb11e44065
--- a/util/dsymtable.cc	Mon Jul 11 09:47:27 2011 +0100
+++ b/util/dsymtable.cc	Fri Jul 29 16:03:28 2011 +0100
@@ -91,6 +91,28 @@
 #endif
 
 
+
+/* Determine how many entries are associated to key identifier_str */ 
+/* returns:
+ *         0: if no entry is found
+ *         1: if 1 entry is found
+ *         2: if more than 1 entry is found 
+ */
+template<typename value_type, value_type null_value>
+int dsymtable_c<value_type, null_value>::multiplicity(const char *identifier_str) {
+  iterator lower = _base.lower_bound(identifier_str);
+  if (lower == _base.end()) return 0;
+
+  iterator upper = _base.upper_bound(identifier_str);
+  iterator second = lower;
+  second++;
+  
+  if (second == upper) return 1;
+  
+  return 2;
+}
+
+
 /* returns null_value if not found! */
 template<typename value_type, value_type null_value>
 value_type dsymtable_c<value_type, null_value>::find_value(const char *identifier_str) {
@@ -104,11 +126,11 @@
 
 
 template<typename value_type, value_type null_value>
-value_type dsymtable_c<value_type, null_value>::find_value(const symbol_c *symbol) {
+const char * dsymtable_c<value_type, null_value>::symbol_to_string(const symbol_c *symbol) {
   const token_c *name = dynamic_cast<const token_c *>(symbol);
   if (name == NULL)
     ERROR;
-  return find_value(name->value);
+  return name->value;
 }