D'oh! Darn kids! The broke into my yard and messed up my code. (Angry old
man shakes fist at cloud...) The previous example is pretty confusing
because I'm calling the wrong routine to register elements. (I haven't
written this bit of code yet.)

OBRegister_RegisterObject (Object is
RootObject;1;"Object_New";"Object_ToText")
C_BOOLEAN($required)
C_BOOLEAN($optional)
$required:=True
$optional:=False
OBRegister_RegisterElement (Object is RootObject;"Root.header";Is
object;$required)
OBRegister_RegisterElement (Object is RootObject;"Root.header";Abstract
type is ObjectType;$required)
OBRegister_RegisterElement (Object is RootObject;"Root.version_number";Is
real;$required)
OBRegister_RegisterElement (Object is RootObject;"Root.instance_name";Is
text;$optional)
OBRegister_RegisterElement (Object is RootObject;"Root.body";Is
object;$required)

So, OBRegister_RegisterObject for the overall type,
OBRegister_RegisterElement for the object type's elements and their rules.
(Again, the rule set is simple here: "type" and required or not.)

Oh, I meant to mention that anyone that's looked at Cannon's object module
will have seen that he very helpful extends basic JSON types to support
things like dates and other useful types. Same idea here - you can *store*
data as text or numbers but then *interpret* them as something better.
That's the point of a type like "ObjectType" or "MethodName" or
"ErrorName", etc.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to