Skip to content

v0.2.54..v0.2.55 changeset ElementId.h

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/elements/ElementId.h b/hoot-core/src/main/cpp/hoot/core/elements/ElementId.h
index 2f0640c..c94c845 100644
--- a/hoot-core/src/main/cpp/hoot/core/elements/ElementId.h
+++ b/hoot-core/src/main/cpp/hoot/core/elements/ElementId.h
@@ -22,11 +22,12 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 #ifndef ELEMENTID_H
 #define ELEMENTID_H
 
+// Hoot
 #include <hoot/core/elements/ElementType.h>
 
 // Standard
@@ -52,52 +53,22 @@ public:
 
   static std::string className() { return "ElementId"; }
 
-  ElementId() : _type(ElementType::Unknown), _id(-std::numeric_limits<int>::max()) {}
-
-  ElementId(ElementType type, long id) : _type(type), _id(id) {}
+  ElementId();
+  ElementId(ElementType type, long id);
+  ElementId(QString str);
 
   long getId() const { return _id; }
 
   ElementType getType() const { return _type; }
 
-  bool isNull() const { return _type == ElementType::Unknown; }
-
-  bool operator!=(const ElementId& other) const { return !(*this == other); }
-  bool operator==(const ElementId& other) const
-  {
-    return getType() == other.getType() && getId() == other.getId();
-  }
+  bool isNull() const;
 
-  bool operator<(const ElementId& other) const
-  {
-    if (getType().getEnum() < other.getType().getEnum())
-    {
-      return true;
-    }
-    else if (getType().getEnum() > other.getType().getEnum())
-    {
-      return false;
-    }
-    else
-    {
-      return getId() < other.getId();
-    }
-  }
+  bool operator!=(const ElementId& other) const;
+  bool operator==(const ElementId& other) const;
+  bool operator<(const ElementId& other) const;
 
-  QString toString() const
-  {
-    // Now printing element ids as "(id)" rather than ":id" as they used to be. This makes it easier
-    // to trace the events of a single feature when searching through log output w/o having to look
-    // at features that you don't want. e.g. Searching through text for "Way:-1" in the past would
-    // give you "Way:-1", "Way:-12".  Now, you can search for "Way(-1)" instead and not return
-    // results for "Way(-12)".
-    return getType().toString() + "(" + QString::number(getId()) + ")";
-  }
-
-  QString toString()
-  {
-    return const_cast<const ElementId*>(this)->toString();
-  }
+  QString toString() const;
+  QString toString();
 
   /**
    * Shorthand for ElementId(ElementType::Node, nid)
Clone this wiki locally