diff --git a/src/attributes/serial/base.js b/src/attributes/serial/base.js new file mode 100644 index 00000000..82dae422 --- /dev/null +++ b/src/attributes/serial/base.js @@ -0,0 +1,27 @@ +/** + * @file gpf.attributes.serial attributes base class + */ +/*#ifndef(UMD)*/ +"use strict"; +/*global _gpfDefine*/ // Shortcut for gpf.define +/*global _gpfAttribute*/ // Shortcut for gpf.attributes.Attribute +/*exported _gpfAttributeSerialBase*/ // Shortcut for gpf.attributes.serial.Base +/*#endif*/ + +/** + * @namespace gpf.attributes.serial + * @description Root namespace for serialization attributes + */ +gpf.attributes.serial = {}; + +/** + * Base class for all serialization attributes + * + * @class gpf.attributes.serial.Base + */ +var _gpfAttributeSerialBase = _gpfDefine({ + $class: "gpf.attributes.serial.Base", + $extend: _gpfAttribute, + $abstract: true + +}); diff --git a/src/attributes/serial/name.js b/src/attributes/serial/name.js new file mode 100644 index 00000000..45f8bd7a --- /dev/null +++ b/src/attributes/serial/name.js @@ -0,0 +1,35 @@ +/** + * @file gpf.attributes.serial.Name attribute + */ +/*#ifndef(UMD)*/ +"use strict"; +/*global _gpfDefine*/ // Shortcut for gpf.define +/*global _gpfAttribute*/ // Shortcut for gpf.attributes.Attribute +/*global _gpfAttributeSerialBase*/ // Shortcut for gpf.attributes.serial.Base +/*exported _gpfAttributeSerialName*/ // Shortcut for gpf.attributes.serial.Name +/*#endif*/ + +/** + * @namespace gpf.attributes.serial + * @description Root namespace for serialization attributes + */ +gpf.attributes.serial = {}; + +/** + * Base class for all serialization attributes + * + * @class gpf.attributes.serial.Base + */ +var _gpfAttributeSerialBase = _gpfDefine({ + $class: "gpf.attributes.serial.Name", + $extend: _gpfAttributeSerialBase, + + constructor: function (name) { + this._sName = name; + }, + + getName: function () { + return this._sName; + } + +}); diff --git a/src/serial/property.js b/src/serial/property.js new file mode 100644 index 00000000..f1420c3a --- /dev/null +++ b/src/serial/property.js @@ -0,0 +1,14 @@ +/** + * @file Serialization types + */ +/*#ifndef(UMD)*/ +"use strict"; +/*#endif*/ + +/** + * Filter property read specification + * + * @typedef gpf.typedef.serializableProperty + * @property {String} name Name of the property + * @see gpf.serial.Name + */ diff --git a/src/serial/query.js b/src/serial/query.js new file mode 100644 index 00000000..ec790960 --- /dev/null +++ b/src/serial/query.js @@ -0,0 +1,15 @@ +/** + * @file Serialization helper + */ +/*#ifndef(UMD)*/ +"use strict"; +/*#endif*/ + + + +function _gpfSerialQuery (classConstructor) { + +} + +/** @gpf:sameas _query*/ +gpf.serial.query = _gpfSerialQuery; diff --git a/test/serial/query.js b/test/serial/query.js new file mode 100644 index 00000000..e8b2459f --- /dev/null +++ b/test/serial/query.js @@ -0,0 +1,23 @@ +"use strict"; + +describe("serial/query", function () { + + var Test; + + before(function () { + Test = gpf.define({ + $class: "Test" + + "[_name]": [new gpf.attributes.serial.Name("Name")] + _name: "" + + }); + }); + + it("lists serializable properties", function () { + var properties = gpf.serial.query(Test); + assert(properties._name); + assert(properties._name.name === "Name"); + }); + +});