Skip to content

Commit

Permalink
WIP (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBuchholz committed Aug 20, 2018
1 parent f51c5bf commit 6ae2b6e
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/attributes/serial/base.js
Original file line number Diff line number Diff line change
@@ -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

});
35 changes: 35 additions & 0 deletions src/attributes/serial/name.js
Original file line number Diff line number Diff line change
@@ -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;
}

});
14 changes: 14 additions & 0 deletions src/serial/property.js
Original file line number Diff line number Diff line change
@@ -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
*/
15 changes: 15 additions & 0 deletions src/serial/query.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @file Serialization helper
*/
/*#ifndef(UMD)*/
"use strict";
/*#endif*/



function _gpfSerialQuery (classConstructor) {

}

/** @gpf:sameas _query*/
gpf.serial.query = _gpfSerialQuery;
23 changes: 23 additions & 0 deletions test/serial/query.js
Original file line number Diff line number Diff line change
@@ -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");
});

});

0 comments on commit 6ae2b6e

Please sign in to comment.