Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

vos/metaobjects/misc/hypercard.cc

Go to the documentation of this file.
00001 /* $Id: hypercard.cc,v 1.11 2003/07/23 00:17:27 reed Exp $ */
00002 
00003 
00004 
00005 /* This file was generated by otd2cpp.pl, a script for ADR by Reed Hedges <reed@zerohour.net>.
00006    Search for TODO for stuff that needs editing. You will want to especially fill in constructors,
00007    destructors, message handlers, non-property subobjects...
00008 
00009    I can make no garuntee that this code will work, or even that it even is safe to run.
00010    Use it at your own risk.
00011 */
00012 
00013 /** @file hypercard.cc Code: a MetaObject for Hypercard object types. */
00014 
00015 #include <vos/corelibs/vos/vos.hh>
00016 #include <vos/metaobjects/property/property.hh>
00017 #include "hypercard.hh"
00018 
00019 /* Constructors */
00020 
00021 Hypercard::Hypercard(MetaObject* s) : MetaObject(s) {
00022 
00023 }
00024 
00025 LocalHypercard::LocalHypercard(MetaObject* s) : Hypercard(s), MetaObject(s) {
00026 
00027 }
00028 
00029 
00030 void Hypercard::initialize() {
00031     defaultPropertyAC = &NoPropertyAccessControl::static_;
00032 }
00033 
00034 void Hypercard::initialize(PropertyAccessControl* ac) {
00035     defaultPropertyAC = ac;
00036 }
00037 
00038 
00039 /* Initialize required subobjects: */
00040 void LocalHypercard::initialize() {
00041     Hypercard::initialize();
00042 //  pREF(MetaObject*, obj, MetaFactory::createLocalObject("link", Site::getDefaultPeer(), &NoAccessControl::static_NoAccessControl, 0), set_link(obj) );    //TODO: make specific to  [otd2cpp only knows about properties]; customize access control
00043 }
00044 
00045 void LocalHypercard::initialize(PropertyAccessControl* ac) {
00046     Hypercard::initialize(ac);
00047 }
00048 
00049 
00050 RemoteHypercard::RemoteHypercard(MetaObject* s) : Hypercard(s), MetaObject(s) {
00051 
00052     // TODO add code here if necesary
00053 
00054 }
00055 
00056 
00057 
00058 /* Return type string ("hypercard") */
00059 
00060 const string Hypercard::getType() {
00061     return string("misc:hypercard");
00062 }
00063 
00064 /* Register extenders with libvos MetaFactory */
00065 void Hypercard::registerExtenders() {
00066     static bool done = false;
00067     if(! done) {
00068     LocalSite::addLocalObjectExtension(typeid(LocalHypercard).name(), &LocalHypercard::new_LocalHypercard);
00069     LocalSite::addLocalObjectExtension(typeid(Hypercard).name(), &LocalHypercard::new_LocalHypercard);
00070     LocalSite::addLocalObjectExtension("misc:hypercard", &LocalHypercard::new_LocalHypercard);
00071     RemoteSite::addRemoteObjectExtension(typeid(RemoteHypercard).name(), &RemoteHypercard::new_RemoteHypercard);
00072     RemoteSite::addRemoteObjectExtension(typeid(Hypercard).name(), &RemoteHypercard::new_RemoteHypercard);
00073     RemoteSite::addRemoteObjectExtension("misc:hypercard", &RemoteHypercard::new_RemoteHypercard);
00074     done = true;
00075     }
00076 }
00077 
00078 
00079 /* Get and set Subproperties and other Subobjects */
00080 
00081 Vobject& Hypercard::getLink() {
00082     return findObject("misc:link");
00083 }
00084 
00085 void Hypercard::setLink(Vobject* newobj) {
00086     try {
00087         rREF(ParentChildRelation&, pcr, findChild("misc:link"),
00088              setChild(pcr.position, "misc:link", newobj);
00089             );
00090     } catch (NoSuchObjectError) {
00091         insertChild(-1, "misc:link", newobj);
00092     }
00093 }
00094 
00095 string Hypercard::getDescription() {
00096     string d;
00097     rREF(Vobject&, obj, findObject("misc:description"),
00098         Property* p = meta_cast<Property*>(&obj);
00099         if(!p) throw bad_cast();
00100         p->read(d);
00101     );
00102     return d;
00103 }
00104 
00105 void Hypercard::setDescription(const string& description, const string& type, PropertyAccessControl* accesscontrol) {
00106     if(accesscontrol == NULL)
00107         accesscontrol = defaultPropertyAC;
00108     Property::setProperty(*this, "misc:description", description, type, accesscontrol);
00109 }
00110 
00111 /* Process local object messages */
00112 void LocalHypercard::sendMessage(Message* m) {
00113 
00114     /* Let superclass have message */
00115     Hypercard::sendMessage(m);
00116 }
00117 
00118 
00119 string Hypercard::getTitle() {
00120     string t;
00121     rREF(Vobject&, obj, findObject("misc:title"),
00122         Property* p = meta_cast<Property*>(&obj);
00123         if(!p) throw bad_cast();
00124         p->read(t);
00125     );
00126     return t;
00127 }
00128 
00129 void Hypercard::setTitle(const string& title, const string& type, PropertyAccessControl* ac) {
00130     if(ac == NULL)
00131         ac = defaultPropertyAC;
00132     Property::setProperty(*this, "misc:title", title, type, ac);
00133 }
00134 
00135 
00136 
00137 
00138 /* Process remote update messages */
00139 void RemoteHypercard::sendUpdateMessage(Message* m) {
00140 
00141 
00142     /* branch to update message handlers specific to RemoteHypercard */
00143 
00144     /* let superclass have message... */
00145     Hypercard::sendUpdateMessage(m);
00146 }
00147 
00148 
00149 
00150 MetaObject* LocalHypercard::new_LocalHypercard(MetaObject* s, const string& type) {
00151     LocalHypercard* o = new LocalHypercard(s);
00152     return o;
00153 }
00154 
00155 MetaObject* RemoteHypercard::new_RemoteHypercard(MetaObject* s, const string& type) {
00156     return new RemoteHypercard(s);
00157 }
00158 

Generated on Tue Aug 12 03:55:44 2003 for Interreality Project - VOS by doxygen 1.3.2