Skip to content

v0.2.54..v0.2.55 changeset RelationJs.cpp

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-js/src/main/cpp/hoot/js/elements/RelationJs.cpp b/hoot-js/src/main/cpp/hoot/js/elements/RelationJs.cpp
index 3c866ce..76f8e3d 100644
--- a/hoot-js/src/main/cpp/hoot/js/elements/RelationJs.cpp
+++ b/hoot-js/src/main/cpp/hoot/js/elements/RelationJs.cpp
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 #include "RelationJs.h"
 
@@ -72,6 +72,8 @@ void RelationJs::Init(Handle<Object> target)
   ElementJs::_addBaseFunctions(tpl);
   tpl->PrototypeTemplate()->Set(String::NewFromUtf8(current, "replaceElement"),
       FunctionTemplate::New(current, replaceElement));
+  tpl->PrototypeTemplate()->Set(String::NewFromUtf8(current, "getType"),
+      FunctionTemplate::New(current, getType));
 
   _constructor.Reset(current, tpl->GetFunction());
   target->Set(String::NewFromUtf8(current, "Relation"), ToLocal(&_constructor));
@@ -135,5 +137,15 @@ void RelationJs::replaceElement(const FunctionCallbackInfo<Value>& args)
   }
 }
 
+void RelationJs::getType(const FunctionCallbackInfo<Value>& args)
+{
+  Isolate* current = args.GetIsolate();
+  HandleScope scope(current);
+
+  ConstRelationPtr relation = ObjectWrap::Unwrap<RelationJs>(args.This())->getConstRelation();
+
+  args.GetReturnValue().Set(String::NewFromUtf8(current, relation->getType().toUtf8().data()));
+}
+
 }
 
Clone this wiki locally