properties property refactor
Posted: Sun Oct 11, 2015 7:40 am
Hi
I'm wondering about refactoring the properties property so that it runs off kProperties rather than requiring the maintenance of props.cpp.
So... what I'm thinking is to do this we would need to add a bool to MCPropertyInfo indicating if the property should be in the properties array (fits within the rules - writable & no duplication). Then we need to add a bool to LT to indicate if a token is a synonym or not which will allow us to work out what the array keys should be for a property. Then we need a method for each object type that will iterate over kProperties and set the array and then call the super class for it to set them and so on. I think that should cover it. I'm not sure if there are any overloaded properties though which would throw a spanner in the works...
The only thing I can't work out is how to camel case without maintaining a separate list but I think we can live without camel casing if we end up with a properties property that needs no constant maintenance.
One advantage is we could fairly easily extend it to allow for things like getting a complete array of properties (including all the ones that aren't included because of the properties property rules) or just the writable properties or just the read only properties etc and so on...
Cheers
Monte
I'm wondering about refactoring the properties property so that it runs off kProperties rather than requiring the maintenance of props.cpp.
So... what I'm thinking is to do this we would need to add a bool to MCPropertyInfo indicating if the property should be in the properties array (fits within the rules - writable & no duplication). Then we need to add a bool to LT to indicate if a token is a synonym or not which will allow us to work out what the array keys should be for a property. Then we need a method for each object type that will iterate over kProperties and set the array and then call the super class for it to set them and so on. I think that should cover it. I'm not sure if there are any overloaded properties though which would throw a spanner in the works...
The only thing I can't work out is how to camel case without maintaining a separate list but I think we can live without camel casing if we end up with a properties property that needs no constant maintenance.
One advantage is we could fairly easily extend it to allow for things like getting a complete array of properties (including all the ones that aren't included because of the properties property rules) or just the writable properties or just the read only properties etc and so on...
Cheers
Monte