llcategory.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLCATEGORY_H
00033 #define LL_LLCATEGORY_H
00034 
00035 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00036 // Class LLCategory
00037 //
00038 // An instance of the LLCategory class represents a particular
00039 // category in a hierarchical classification system. For now, it is 4
00040 // levels deep with 255 (minus 1) possible values at each level. If a
00041 // non zero value is found at level 4, that is the leaf category,
00042 // otherwise, it is the first level that has a 0 in the next depth
00043 // level.
00044 //
00045 // To output the names of all top level categories, you could do the
00046 // following:
00047 //
00048 //      S32 count = LLCategory::none.getSubCategoryCount();
00049 //      for(S32 i = 0; i < count; i++)
00050 //      {
00051 //              llinfos << none.getSubCategory(i).lookupNmae() << llendl;
00052 //      }
00053 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00054 
00055 class LLMessageSystem;
00056 
00057 class LLCategory
00058 {
00059 public:
00060         // Nice default static const.
00061         static const LLCategory none;
00062 
00063         // construction. Since this is really a POD type, destruction,
00064         // copy, and assignment are handled by the compiler.
00065         LLCategory();
00066         explicit LLCategory(U32 value) { init(value); }
00067 
00068         // methods
00069         void init(U32 value);
00070         U32 getU32() const;
00071         S32 getSubCategoryCount() const;
00072 
00073         // This method will return a category that is the nth
00074         // subcategory. If you're already at the bottom of the hierarchy,
00075         // then the method will return a copy of this.
00076         LLCategory getSubCategory(U8 n) const;
00077 
00078         // This method will return the name of the leaf category type
00079         const char* lookupName() const;
00080 
00081         // This method will return the full hierarchy name in an easily
00082         // interpreted (TOP)|(SUB1)|(SUB2) format. *NOTE: not implemented
00083         // because we don't have anything but top level categories at the
00084         // moment.
00085         //const char* lookupFullName() const;
00086 
00087         // message serialization
00088         void packMessage(LLMessageSystem* msg) const;
00089         void unpackMessage(LLMessageSystem* msg, const char* block);
00090         void unpackMultiMessage(LLMessageSystem* msg, const char* block,
00091                                                         S32 block_num);
00092 protected:
00093         enum
00094         {
00095                 CATEGORY_TOP = 0,
00096                 CATEGORY_DEPTH = 4,
00097         };
00098 
00099         U8 mData[CATEGORY_DEPTH];
00100 };
00101 
00102 
00103 #endif // LL_LLCATEGORY_H

Generated on Thu Jul 1 06:08:21 2010 for Second Life Viewer by  doxygen 1.4.7