-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f51c5bf
commit 6ae2b6e
Showing
5 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
}); | ||
|
||
}); |