Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc / node_modules / protobufjs / src / ProtoBuf / Reflect / T.js
diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/T.js b/legacy-libs/grpc/node_modules/protobufjs/src/ProtoBuf/Reflect/T.js
new file mode 100644 (file)
index 0000000..12d2b13
--- /dev/null
@@ -0,0 +1,81 @@
+/**\r
+ * Constructs a Reflect base class.\r
+ * @exports ProtoBuf.Reflect.T\r
+ * @constructor\r
+ * @abstract\r
+ * @param {!ProtoBuf.Builder} builder Builder reference\r
+ * @param {?ProtoBuf.Reflect.T} parent Parent object\r
+ * @param {string} name Object name\r
+ */\r
+var T = function(builder, parent, name) {\r
+\r
+    /**\r
+     * Builder reference.\r
+     * @type {!ProtoBuf.Builder}\r
+     * @expose\r
+     */\r
+    this.builder = builder;\r
+\r
+    /**\r
+     * Parent object.\r
+     * @type {?ProtoBuf.Reflect.T}\r
+     * @expose\r
+     */\r
+    this.parent = parent;\r
+\r
+    /**\r
+     * Object name in namespace.\r
+     * @type {string}\r
+     * @expose\r
+     */\r
+    this.name = name;\r
+\r
+    /**\r
+     * Fully qualified class name\r
+     * @type {string}\r
+     * @expose\r
+     */\r
+    this.className;\r
+};\r
+\r
+/**\r
+ * @alias ProtoBuf.Reflect.T.prototype\r
+ * @inner\r
+ */\r
+var TPrototype = T.prototype;\r
+\r
+/**\r
+ * Returns the fully qualified name of this object.\r
+ * @returns {string} Fully qualified name as of ".PATH.TO.THIS"\r
+ * @expose\r
+ */\r
+TPrototype.fqn = function() {\r
+    var name = this.name,\r
+        ptr = this;\r
+    do {\r
+        ptr = ptr.parent;\r
+        if (ptr == null)\r
+            break;\r
+        name = ptr.name+"."+name;\r
+    } while (true);\r
+    return name;\r
+};\r
+\r
+/**\r
+ * Returns a string representation of this Reflect object (its fully qualified name).\r
+ * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.\r
+ * @return String representation\r
+ * @expose\r
+ */\r
+TPrototype.toString = function(includeClass) {\r
+    return (includeClass ? this.className + " " : "") + this.fqn();\r
+};\r
+\r
+/**\r
+ * Builds this type.\r
+ * @throws {Error} If this type cannot be built directly\r
+ * @expose\r
+ */\r
+TPrototype.build = function() {\r
+    throw Error(this.toString(true)+" cannot be built directly");\r
+};\r