00001 /* $Id: avatar.hh,v 1.26 2003/08/06 01:37:24 reed Exp $ */ 00002 00003 00004 /* This file was generated by otd2cpp.pl, a script for VOS by Reed Hedges <reed@zerohour.net>. 00005 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 avatar.hh Defines MetaObject class for Avatar type (revision 0). 00014 00015 */ 00016 00017 #ifndef _AVATAR_HH_ 00018 #define _AVATAR_HH_ 00019 00020 #include <vos/corelibs/vos/vos.hh> 00021 #include <vos/metaobjects/property/property.hh> 00022 #include <vos/metaobjects/misc/hypercard.hh> 00023 00024 00025 #if defined(_WIN32) && defined(_MSC_VER) 00026 # ifdef MISC_EXPORTS 00027 # define MISC_API __declspec(dllexport) 00028 # else 00029 # define MISC_API __declspec(dllimport) 00030 # endif 00031 #else 00032 # define MISC_API 00033 #endif 00034 00035 /** MetaObject implementing Avatar Object Type. 00036 00037 Indicates that this object represents a human or automated agent. This object is the 00038 manifestation and representative of the human user or automated agent in the virtual world. 00039 In a 3D environment, will usually be used with an 3dobject.* type (such as 3dobject.model). 00040 00041 */ 00042 00043 class MISC_API Avatar : public virtual MetaObject 00044 { 00045 protected: 00046 PropertyAccessControl* defaultAccessControl; 00047 00048 public: 00049 00050 /** @name Presence Codes 00051 * This is a simple schema, that mirrors the four presence codes 00052 * in the <a href="http://www.jabber.org">Jabber</a> IM system. 00053 * In the future there may be more. If you think something should 00054 * be added, <a href="http://interreality.org/lists">let us know</a>. 00055 */ 00056 //@{ 00057 static const unsigned short AVAILABLE; ///< for "chat" 00058 static const unsigned short AWAY; ///< for "away" 00059 static const unsigned short EXTENDEDAWAY; ///< for "xa" 00060 static const unsigned short BUSY; ///< for "dnd" 00061 //@} 00062 00063 /** Constructor */ 00064 Avatar(MetaObject* superobject); 00065 00066 00067 /** Return type string ("avatar") */ 00068 const string getType(); 00069 00070 /** Register Extenders */ 00071 static void registerExtenders(); 00072 00073 /** @name Access Subobjects */ 00074 //@{ 00075 00076 /** Get the value of avatar:nick property (A text string containing a short name that can be used to identify this avatar. If this property is omitted, the object's contextual name may be used.). */ 00077 string getNick(); 00078 00079 /** Get Property object for nick. */ 00080 Property* getNickObj(); 00081 00082 /** Set Property object for nick */ 00083 void setNickObj(Property* obj); 00084 00085 /** Set avatar:nick property. 00086 @param value The new value. Should be a short string of plain text. 00087 */ 00088 void setNick(const string& value, PropertyAccessControl* pac = 0); 00089 00090 /** Add a PropertyListener to the avatar:nick property. */ 00091 void addNickListener(PropertyListener* listener); 00092 00093 /** Remove a PropertyListener from the avatar:nick property. */ 00094 void removeNickListener(PropertyListener* listener); 00095 00096 /** Get the value of avatar:fullname property (A text string containing the full name of the user or agent.). */ 00097 string getFullname(); 00098 00099 /** Get the datatype of avatar:fullname property. */ 00100 string getFullnameDatatype(); 00101 00102 /** Set avatar:fullname property. 00103 @param value The new value 00104 @param datatype The new datatype: if omitted, then the existing datatype will be preserved. 00105 @param pac Property access control to set o the property. The previously set default will be used if pac is omitted or 0. 00106 */ 00107 void setFullname(const string& value, const string& datatype = "?", PropertyAccessControl* pac = 0); 00108 00109 /** Get the fullname Property object */ 00110 Property* getFullnameObj(); 00111 00112 /** Set the fullname object */ 00113 void setFullnameObj(Property* obj); 00114 00115 /** Get the value of avatar:info property. 00116 * This is for More information about the user or agent, for example a 00117 * <a href="http://www.foaf-project.org">FOAF document</a>, a picture, a 00118 * short biographical text, a URL to a web page or email address, or 00119 * whatever. (Use the datatype of the property to distinguish; I 00120 * recommend checking out FOAF) 00121 * @todo support multiple "info" properties. 00122 */ 00123 string getInfo(); 00124 00125 /** Get the datatype of avatar:info property. */ 00126 string getInfoDatatype(); 00127 00128 /** Set avatar:info property. 00129 @param value The new value 00130 @param datatype The new datatype: if omitted, then the existing datatype will be preserved. */ 00131 void setInfo(const string& value, const string& datatype = "?", PropertyAccessControl* pac = 0); 00132 00133 /** Get info Property object */ 00134 Property* getInfoObj(); 00135 00136 /** Set info Property object */ 00137 void setInfoObj(Property* obj); 00138 00139 /** Add PropertyListener to avatar:info property */ 00140 void addInfoListener(PropertyListener* listener); 00141 00142 /** Remove a PropertyListener from avatar:info property */ 00143 void removeInfoListener(PropertyListener* listener); 00144 00145 /** Set the user identifier (typically "user@host") */ 00146 void setUserId(const string& userid, PropertyAccessControl* pac = 0); 00147 00148 /** Get the user identifier (typically "user@host") 00149 * @throws sNoSuchObjectError No user-id property exitst 00150 * @throws bad_cast user-id subobject is not a Property. */ 00151 string getUserId(); 00152 00153 /** Get a numeric code that represents the value of avatar:presence_code property (A text string indicating the presence/status/availability of the user or agent.) The returned value will match one of the constants Avatar::AVAILABLE Avatar::AWAY, Avatar::EXTENDEDAWAY, or Avatar::BUSY. */ 00154 unsigned short getPresence(); 00155 00156 /** Set avatar:presence_code property according to the parameter code. 00157 @param code The new numeric code. See above for list of constants. 00158 */ 00159 void setPresence(unsigned short code, PropertyAccessControl* pac = 0); 00160 00161 /** Get info Property object */ 00162 Property* getPresenceObj(); 00163 00164 /** Set info Property object */ 00165 void setPresenceObj(Property* obj); 00166 00167 /** Add a PropertyListener to the avatar:presence_code property. */ 00168 void addPresenceListener(PropertyListener* listener); 00169 00170 /** Remove a PropertyListener from the avatar:presence_code property. */ 00171 void removePresenceListener(PropertyListener* listener); 00172 00173 /** Get the value of avatar:presence_description property (Text describing the presence/status/availability of the user or agent in a more free-form manner (e.g. "Went to find more coffee. Back in a bit.")). */ 00174 string getPresenceDescription(); 00175 00176 /** Get the datatype of avatar:presence_description property. */ 00177 string getPresenceDescriptionDatatype(); 00178 00179 /** Set avatar:presence_description property. 00180 @param value The new value 00181 @param datatype The new datatype: if omitted, then the existing datatype will be preserved. */ 00182 void setPresenceDescription(const string& value, const string& datatype = "?", PropertyAccessControl* pac = 0); 00183 00184 /** Get info Property object */ 00185 Property* getPresenceDescriptionObj(); 00186 00187 /** Set info Property object */ 00188 void setPresenceDescriptionObj(Property* obj); 00189 00190 /** Get "selected" object */ 00191 Vobject* getSelectedObj(); 00192 00193 /** Set "selected" object. 00194 * If 'obj' is 0, then any existing object is removed. Otherwise: 00195 * If there is no "misc:selected-object" child, then a new Hypercard 00196 * will be created linking to 'obj' and added. If such a child does 00197 * exist and is a hypercard, then its link will be replaced with obj. 00198 */ 00199 void setSelectedObj(Vobject* obj); 00200 00201 /** Get "selected" hypercard */ 00202 Hypercard* getSelectedHypercard(); 00203 00204 /** Set "selected" hypercard. */ 00205 void setSelectedHypercard(Hypercard* hc); 00206 //@} 00207 00208 00209 /** Initialize */ 00210 virtual void initialize(); 00211 00212 /** Set access control policy for subobjects */ 00213 void setPropertyAccessControl(PropertyAccessControl* pac); 00214 00215 /** Get property access control policy */ 00216 PropertyAccessControl* getPropertyAccessControl(); 00217 00218 }; 00219 00220 00221 00222 /** Local version of Avatar. */ 00223 00224 class MISC_API LocalAvatar : public virtual Avatar 00225 { 00226 public: 00227 00228 /** Constructor */ 00229 LocalAvatar(MetaObject* superobject); 00230 00231 /** Static generator, for factory. */ 00232 static MetaObject* new_LocalAvatar(MetaObject* superobject, const string& type); 00233 00234 /** Called when this object gets a message */ 00235 virtual void sendMessage(Message* m); 00236 00237 00238 }; 00239 00240 00241 /** Remote version of Avatar. */ 00242 00243 class MISC_API RemoteAvatar : public virtual Avatar 00244 { 00245 00246 public: 00247 00248 /** Constructor */ 00249 RemoteAvatar(MetaObject* superobject); 00250 00251 /** Static generator, for factory. */ 00252 static MetaObject* new_RemoteAvatar(MetaObject* superobject, const string& type); 00253 00254 /** Called when this object gets an update message from its Local master across the network. */ 00255 void sendUpdateMessage(Message *m); 00256 00257 }; 00258 00259 00260 #endif // #ifdef _AVATAR_HH_ 00261