/home/tetron/hack/vos/libs/vos/metaobjects/misc/avatar.hh
Go to the documentation of this file.00001 /* $Id: avatar.hh,v 1.7 2005/12/18 09:59:40 tetron Exp $ */ 00002 00003 /* Copyright (C) 2002,2003,2004 Reed Hedges 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 */ 00020 00021 00022 #ifndef _AVATAR_HH_ 00023 #define _AVATAR_HH_ 00024 00025 #include <vos/vos/vos.hh> 00026 #include <vos/metaobjects/misc/hypercard.hh> 00027 00028 00029 #include "miscdefs.hh" 00030 namespace VOS { 00031 00032 /** @class Avatar avatar.hh vos/metaobjects/misc/avatar.hh 00033 * @ingroup libmetaobject_misc 00034 00035 Indicates that this object represents a human or automated agent. 00036 It is the representative of the human user or automated agent. 00037 In a 3D environment, will usually be used with an A3DL::Object3D type 00038 (such as A3DL::Model) 00039 It will also often be used with a Talkative metaobject. 00040 */ 00041 00042 class MISC_API Avatar : public MetaObject 00043 { 00044 00045 public: 00046 00047 /** @name Presence Codes 00048 * This is a simple schema, that mirrors the four presence codes 00049 * in the <a href="http://www.jabber.org">Jabber</a> IM system. 00050 * In the future there may be more. If you think something should 00051 * be added, <a href="http://interreality.org/lists">let us know</a>. 00052 */ 00053 //@{ 00054 static const unsigned short AVAILABLE; ///< for "chat" 00055 static const unsigned short AWAY; ///< for "away" 00056 static const unsigned short EXTENDEDAWAY; ///< for "xa" 00057 static const unsigned short BUSY; ///< for "dnd" 00058 //@} 00059 00060 /** @internal */ 00061 Avatar(VobjectBase* superobject); 00062 00063 00064 /** Return type string ("misc:avatar") */ 00065 const std::string getVOSType(); 00066 00067 /** @internal */ 00068 static MetaObject* new_Avatar(VobjectBase* s, const std::string& t); 00069 00070 /** 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.). */ 00071 std::string getNick(); 00072 00073 /** Get Property object for nick. */ 00074 VUtil::vRef<Property> getNickObj(); 00075 00076 /** Set Property object for nick */ 00077 void setNickObj(Property* obj); 00078 00079 /** Set misc:nick property. 00080 @param value The new value. Should be a short string of plain text. 00081 */ 00082 void setNick(const std::string& value); 00083 00084 /** Add a PropertyListener to the misc:nick property. */ 00085 void addNickListener(PropertyListener* listener); 00086 00087 /** Remove a PropertyListener from the misc:nick property. */ 00088 void removeNickListener(PropertyListener* listener); 00089 00090 /** Get the value of misc:fullname property (A text string containing the full name of the user or agent.). */ 00091 std::string getFullname(); 00092 00093 /** Get the datatype of misc:fullname property. */ 00094 std::string getFullnameDatatype(); 00095 00096 /** Set misc:fullname property. 00097 @param value The new value 00098 @param datatype The new datatype: if omitted, then the 00099 existing datatype will be preserved 00100 */ 00101 void setFullname(const std::string& value, const std::string& datatype = "?"); 00102 00103 /** Get the fullname Property object */ 00104 VUtil::vRef<Property> getFullnameObj(); 00105 00106 /** Set the fullname object */ 00107 void setFullnameObj(Property* obj); 00108 00109 /** Get the value of misc:info property. 00110 * This is for More information about the user or agent, for example a 00111 * <a href="http://www.foaf-project.org">FOAF document</a>, a picture, a 00112 * short biographical text, a URL to a web page or email address, or 00113 * whatever. (Use the datatype of the property to distinguish; I 00114 * recommend checking out FOAF) 00115 * @todo support multiple "info" properties. 00116 */ 00117 std::string getInfo(); 00118 00119 /** Get the datatype of misc:info property. */ 00120 std::string getInfoDatatype(); 00121 00122 /** Set misc:info property. 00123 @param value The new value 00124 @param datatype The new datatype: if omitted, then the existing datatype will be preserved. */ 00125 void setInfo(const std::string& value, const std::string& datatype = "?"); 00126 00127 /** Get info Property object */ 00128 VUtil::vRef<Property> getInfoObj(); 00129 00130 /** Set info Property object */ 00131 void setInfoObj(Property* obj); 00132 00133 /** Add PropertyListener to misc:info property */ 00134 void addInfoListener(PropertyListener* listener); 00135 00136 /** Remove a PropertyListener from misc:info property */ 00137 void removeInfoListener(PropertyListener* listener); 00138 00139 /** Set the user identifier (typically "user@host"). 00140 This can be used 00141 by specialized applications to work with other external programs 00142 in a Unix or Unix-like network. Basically not generally useful 00143 for much and will rarely be used. 00144 */ 00145 void setUserId(const std::string& userid); 00146 00147 /** Get the user identifier (typically "user@host") 00148 This can be used 00149 by specialized applications to work with other external programs 00150 in a Unix or Unix-like network. Basically not generally useful 00151 for much and will rarely be used :) 00152 * @throws NoSuchObjectError No user-id property exitst 00153 * @throws bad_cast user-id subobject is not a Property. */ 00154 std::string getUserId(); 00155 00156 /** Get a numeric code that represents the value of misc:presence_code property (A text std::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. */ 00157 unsigned short getPresence(); 00158 00159 /** Set misc:presence_code property according to the parameter code. 00160 @param code The new numeric code. See above for list of constants. 00161 */ 00162 void setPresence(unsigned short code); 00163 00164 /** Get info Property object */ 00165 VUtil::vRef<Property> getPresenceObj(); 00166 00167 /** Set info Property object */ 00168 void setPresenceObj(Property* obj); 00169 00170 /** Add a PropertyListener to the misc:presence_code property. */ 00171 void addPresenceListener(PropertyListener* listener); 00172 00173 /** Remove a PropertyListener from the misc:presence_code property. */ 00174 void removePresenceListener(PropertyListener* listener); 00175 00176 /** Get the value of misc: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.")). */ 00177 std::string getPresenceDescription(); 00178 00179 /** Get the datatype of misc:presence_description property. */ 00180 std::string getPresenceDescriptionDatatype(); 00181 00182 /** Set misc:presence_description property. 00183 @param value The new value 00184 @param datatype The new datatype: if omitted, then the existing datatype will be preserved. */ 00185 void setPresenceDescription(const std::string& value, const std::string& datatype = "?"); 00186 00187 /** Get info Property object */ 00188 VUtil::vRef<Property> getPresenceDescriptionObj(); 00189 00190 /** Set info Property object */ 00191 void setPresenceDescriptionObj(Property* obj); 00192 00193 00194 /** Set object currently "selected" by this avatar. 00195 * This can be used as a pointer or indicator to an object of interest, 00196 * which can therefore be used by other users or applications. 00197 * @param obj The selected object. If 0, then any existing object is 00198 * removed. Otherwise: If there is no "misc:selected-object" child, 00199 * then a new Hypercard will be created linking to 'obj' and added. 00200 * If such a child does exist and is a hypercard, then its link will 00201 * be replaced with obj. 00202 */ 00203 void setSelectedObj(Vobject* obj); 00204 00205 /** Get "selected" object. 00206 @see setSelectedObj 00207 */ 00208 VUtil::vRef<Vobject> getSelectedObj(); 00209 00210 /** Get "selected" hypercard. 00211 @see setSelectedObj 00212 */ 00213 VUtil::vRef<Hypercard> getSelectedHypercard(); 00214 00215 /** Set "selected" hypercard. 00216 @see setSelectedObj 00217 */ 00218 void setSelectedHypercard(Hypercard* hc); 00219 00220 /** Set this user's local timezone's offset from GMT (UTC). E.g. 00221 if you are in GMT use 0. If you are in US Eastern standard without 00222 daylight savings, use -5, etc. 00223 */ 00224 void setLocalTimezone(int tz); 00225 00226 /** Get this user's local timezone's offset from GMT (UTC). 00227 @see setLocalTimezone 00228 */ 00229 int getLocalTimezone(); 00230 00231 00232 }; 00233 00234 } // namespace VOS 00235 00236 00237 #ifndef MISC_EXPORTS 00238 IMPORT_METAOBJECT_FACTORIES(Avatar) 00239 #endif 00240 00241 #endif // #ifdef _AVATAR_HH_ 00242