Link | trait_serializable(auto) |
Author | Ke Carlton |
Category | Session |
Version | 9.x |
License | Public Domain |
Posted | 17 Oct 2012 |
Updated | 17 Oct 2012 |
More by this author... |
This extends trait_serializable by adding an automatic mode which automatically serialises and deserialises public data members. Currently disregards inheritance.
session_start('sessionname',-path='/') session_addvar('sessionname','test') define user_example => type { trait { import trait_serializable } data public firstname = '', public lastname = '' public asstring => .firstname + ' ' + .lastname } 'Current: ' + var(test) $test = user_example $test->firstname = 'Bob' $test->lastname = 'Smith ' + date->second '\rNew: ' + $test
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define trait_serializable->acceptdeserializedelement(d::serialization_element) => protect => { local(tag) = tag(#d->key+'=') self->\#tag(#d->value) } define trait_serializable->serializationElements() => { local(m,t,out = array) with sig in .listmethods do { if(#sig->typename == .type ) => { #m = #sig->methodname->asstring if(#m->beginswith('\'') && #m->endswith('\'')) => { #t = #sig->methodname #m->replace('\'','') #m->replace('=','') #out->insert( serialization_element( #m,self->\#t() ) ) } } } return #out->asstaticarray }
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft