00001
00033 #ifndef LL_LLGESTURE_H
00034 #define LL_LLGESTURE_H
00035
00036 #include "llanimationstates.h"
00037 #include "lluuid.h"
00038 #include "llstring.h"
00039 #include "lldarray.h"
00040
00041 class LLGesture
00042 {
00043 public:
00044 LLGesture();
00045 LLGesture(KEY key, MASK mask, const std::string &trigger,
00046 const LLUUID &sound_item_id, const std::string &animation,
00047 const std::string &output_string);
00048
00049 LLGesture(U8 **buffer, S32 max_size);
00050 LLGesture(const LLGesture &gesture);
00051 const LLGesture &operator=(const LLGesture &rhs);
00052
00053 virtual ~LLGesture() {};
00054
00055
00056 KEY getKey() const { return mKey; }
00057 MASK getMask() const { return mMask; }
00058 const std::string& getTrigger() const { return mTrigger; }
00059 const LLUUID& getSound() const { return mSoundItemID; }
00060 const std::string& getAnimation() const { return mAnimation; }
00061 const std::string& getOutputString() const { return mOutputString; }
00062
00063
00064 virtual BOOL trigger(KEY key, MASK mask);
00065
00066
00067 virtual BOOL trigger(const LLString &string);
00068
00069
00070 U8 *serialize(U8 *buffer) const;
00071 U8 *deserialize(U8 *buffer, S32 max_size);
00072 static S32 getMaxSerialSize();
00073
00074 protected:
00075 KEY mKey;
00076 MASK mMask;
00077 std::string mTrigger;
00078 std::string mTriggerLower;
00079 LLUUID mSoundItemID;
00080 std::string mAnimation;
00081 std::string mOutputString;
00082
00083 static const S32 MAX_SERIAL_SIZE;
00084 };
00085
00086 class LLGestureList
00087 {
00088 public:
00089 LLGestureList();
00090 virtual ~LLGestureList();
00091
00092
00093 BOOL trigger(KEY key, MASK mask);
00094
00095
00096 BOOL triggerAndReviseString(const LLString &string, LLString* revised_string);
00097
00098
00099 S32 count() const { return mList.count(); }
00100 virtual LLGesture* get(S32 i) const { return mList.get(i); }
00101 virtual void put(LLGesture* gesture) { mList.put( gesture ); }
00102 void deleteAll();
00103
00104
00105 U8 *serialize(U8 *buffer) const;
00106 U8 *deserialize(U8 *buffer, S32 max_size);
00107 S32 getMaxSerialSize();
00108
00109 protected:
00110
00111 virtual LLGesture *create_gesture(U8 **buffer, S32 max_size);
00112
00113 protected:
00114 LLDynamicArray<LLGesture*> mList;
00115
00116 static const S32 SERIAL_HEADER_SIZE;
00117 };
00118
00119 #endif