1 #ifndef CHARACTER_SET_ROSTER_H 2 #define CHARACTER_SET_ROSTER_H 3 4 #include <SupportDefs.h> 5 #include <Messenger.h> 6 7 namespace BPrivate { 8 9 /** 10 * @file BCharacterSetRoster.h 11 * @author Andrew Bachmann 12 * @brief Defines BCharacterSetRoster 13 * 14 * @see BCharacterSet.h 15 **/ 16 17 class BCharacterSet; 18 19 class BCharacterSetRoster { 20 /** 21 * @class BCharacterSetRoster 22 * @brief An object for finding or enumerating character sets 23 **/ 24 public: 25 /** 26 * @brief initialize the roster to the first character set 27 **/ 28 BCharacterSetRoster(); 29 virtual ~BCharacterSetRoster(); 30 31 /** 32 * @brief get the next available character set 33 * @return B_NO_ERROR if it's valid, B_BAD_VALUE if it is not 34 **/ 35 status_t GetNextCharacterSet(BCharacterSet * charset); 36 /** 37 * @brief resets the iterator to the first character set 38 * @return B_NO_ERROR if it's valid, B_BAD_VALUE if it is not 39 **/ 40 status_t RewindCharacterSets(); 41 42 /** 43 * @brief register BMessenger to receive notifications of character set events 44 * @return B_NO_ERROR if watching was okay, B_BAD_VALUE if poorly formed BMessenger 45 **/ 46 static status_t StartWatching(BMessenger target); 47 /** 48 * @brief stop sending notifications to BMessenger 49 * @return B_NO_ERROR if stopping went okay, B_BAD_VALUE if poorly formed BMessenger 50 **/ 51 static status_t StopWatching(BMessenger target); 52 53 /** 54 * @brief return the character set with the given font id, or NULL if none exists 55 * This function executes in constant time. 56 * @return the character set with the given font id, or NULL if none exists 57 **/ 58 static const BCharacterSet * GetCharacterSetByFontID(uint32 id); 59 /** 60 * @brief return the character set with the given conversion id, or NULL if none exists 61 * This function executes in constant time. 62 * @return the character set with the given conversion id, or NULL if none exists 63 **/ 64 static const BCharacterSet * GetCharacterSetByConversionID(uint32 id); 65 /** 66 * @brief return the character set with the given MIB enum, or NULL if none exists 67 * This function executes in constant time. 68 * @return the character set with the given MIB enum, or NULL if none exists 69 **/ 70 static const BCharacterSet * GetCharacterSetByMIBenum(uint32 MIBenum); 71 72 /** 73 * @brief return the character set with the given print name, or NULL if none exists 74 * This function executes in linear time. 75 * @return the character set with the given print name, or NULL if none exists 76 **/ 77 static const BCharacterSet * FindCharacterSetByPrintName(const char * name); 78 /** 79 * @brief return the character set with the given name, or NULL if none exists 80 * This function will match aliases as well. 81 * This function executes in linear time. 82 * @return the character set with the given name, or NULL if none exists 83 **/ 84 static const BCharacterSet * FindCharacterSetByName(const char * name); 85 private: 86 uint32 index; //! the state variable for iteration 87 }; 88 89 } 90 91 #endif // CHARACTER_SET_ROSTER_H 92