Annotation of /trunk/indra/llcharacter/llgesture.h
Parent Directory
|
Revision Log
Revision 137 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file llgesture.h | ||
| 3 : | * @brief A gesture is a combination of a triggering chat phrase or | ||
| 4 : | * key, a sound, an animation, and a chat string. | ||
| 5 : | * | ||
| 6 : | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
| 7 : | * | ||
| 8 : | mjm | 137 | * Copyright (c) 2002-2010, Linden Research, Inc. |
| 9 : | mjm | 135 | * |
| 10 : | * Second Life Viewer Source Code | ||
| 11 : | * The source code in this file ("Source Code") is provided by Linden Lab | ||
| 12 : | * to you under the terms of the GNU General Public License, version 2.0 | ||
| 13 : | * ("GPL"), unless you have obtained a separate licensing agreement | ||
| 14 : | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
| 15 : | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
| 16 : | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
| 17 : | * | ||
| 18 : | * There are special exceptions to the terms and conditions of the GPL as | ||
| 19 : | * it is applied to this Source Code. View the full text of the exception | ||
| 20 : | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
| 21 : | * online at | ||
| 22 : | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 23 : | * | ||
| 24 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 25 : | * that you have read and understood your obligations described above, | ||
| 26 : | * and agree to abide by those obligations. | ||
| 27 : | * | ||
| 28 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 29 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 30 : | * COMPLETENESS OR PERFORMANCE. | ||
| 31 : | * $/LicenseInfo$ | ||
| 32 : | */ | ||
| 33 : | |||
| 34 : | #ifndef LL_LLGESTURE_H | ||
| 35 : | #define LL_LLGESTURE_H | ||
| 36 : | |||
| 37 : | #include "llanimationstates.h" | ||
| 38 : | #include "lluuid.h" | ||
| 39 : | #include "llstring.h" | ||
| 40 : | #include "lldarray.h" | ||
| 41 : | |||
| 42 : | class LLGesture | ||
| 43 : | { | ||
| 44 : | public: | ||
| 45 : | LLGesture(); | ||
| 46 : | LLGesture(KEY key, MASK mask, const std::string &trigger, | ||
| 47 : | const LLUUID &sound_item_id, const std::string &animation, | ||
| 48 : | const std::string &output_string); | ||
| 49 : | |||
| 50 : | LLGesture(U8 **buffer, S32 max_size); // deserializes, advances buffer | ||
| 51 : | LLGesture(const LLGesture &gesture); | ||
| 52 : | const LLGesture &operator=(const LLGesture &rhs); | ||
| 53 : | |||
| 54 : | virtual ~LLGesture() {}; | ||
| 55 : | |||
| 56 : | // Accessors | ||
| 57 : | KEY getKey() const { return mKey; } | ||
| 58 : | MASK getMask() const { return mMask; } | ||
| 59 : | const std::string& getTrigger() const { return mTrigger; } | ||
| 60 : | const LLUUID& getSound() const { return mSoundItemID; } | ||
| 61 : | const std::string& getAnimation() const { return mAnimation; } | ||
| 62 : | const std::string& getOutputString() const { return mOutputString; } | ||
| 63 : | |||
| 64 : | // Triggers if a key/mask matches it | ||
| 65 : | virtual BOOL trigger(KEY key, MASK mask); | ||
| 66 : | |||
| 67 : | // Triggers if case-insensitive substring matches (assumes string is lowercase) | ||
| 68 : | virtual BOOL trigger(const std::string &string); | ||
| 69 : | |||
| 70 : | // non-endian-neutral serialization | ||
| 71 : | U8 *serialize(U8 *buffer) const; | ||
| 72 : | U8 *deserialize(U8 *buffer, S32 max_size); | ||
| 73 : | static S32 getMaxSerialSize(); | ||
| 74 : | |||
| 75 : | protected: | ||
| 76 : | KEY mKey; // usually a function key | ||
| 77 : | MASK mMask; // usually MASK_NONE, or MASK_SHIFT | ||
| 78 : | std::string mTrigger; // string, no whitespace allowed | ||
| 79 : | std::string mTriggerLower; // lowercase version of mTrigger | ||
| 80 : | LLUUID mSoundItemID; // ItemID of sound to play, LLUUID::null if none | ||
| 81 : | std::string mAnimation; // canonical name of animation or face animation | ||
| 82 : | std::string mOutputString; // string to say | ||
| 83 : | |||
| 84 : | static const S32 MAX_SERIAL_SIZE; | ||
| 85 : | }; | ||
| 86 : | |||
| 87 : | class LLGestureList | ||
| 88 : | { | ||
| 89 : | public: | ||
| 90 : | LLGestureList(); | ||
| 91 : | virtual ~LLGestureList(); | ||
| 92 : | |||
| 93 : | // Triggers if a key/mask matches one in the list | ||
| 94 : | BOOL trigger(KEY key, MASK mask); | ||
| 95 : | |||
| 96 : | // Triggers if substring matches and generates revised string. | ||
| 97 : | BOOL triggerAndReviseString(const std::string &string, std::string* revised_string); | ||
| 98 : | |||
| 99 : | // Used for construction from UI | ||
| 100 : | S32 count() const { return mList.count(); } | ||
| 101 : | virtual LLGesture* get(S32 i) const { return mList.get(i); } | ||
| 102 : | virtual void put(LLGesture* gesture) { mList.put( gesture ); } | ||
| 103 : | void deleteAll(); | ||
| 104 : | |||
| 105 : | // non-endian-neutral serialization | ||
| 106 : | U8 *serialize(U8 *buffer) const; | ||
| 107 : | U8 *deserialize(U8 *buffer, S32 max_size); | ||
| 108 : | S32 getMaxSerialSize(); | ||
| 109 : | |||
| 110 : | protected: | ||
| 111 : | // overridden by child class to use local LLGesture implementation | ||
| 112 : | virtual LLGesture *create_gesture(U8 **buffer, S32 max_size); | ||
| 113 : | |||
| 114 : | protected: | ||
| 115 : | LLDynamicArray<LLGesture*> mList; | ||
| 116 : | |||
| 117 : | static const S32 SERIAL_HEADER_SIZE; | ||
| 118 : | }; | ||
| 119 : | |||
| 120 : | #endif |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

