Hide implementation details.

This commit is contained in:
plfiorini 2010-05-28 17:11:16 +00:00
parent 5b41b18007
commit af48b464ef
4 changed files with 40 additions and 24 deletions

View File

@ -22,6 +22,7 @@ public:
const char* Path() const; const char* Path() const;
CayaProtocol* Protocol() const; CayaProtocol* Protocol() const;
const char* Signature() const; const char* Signature() const;
const char* FriendlySignature() const; const char* FriendlySignature() const;
BBitmap* Icon() const; BBitmap* Icon() const;

View File

@ -62,24 +62,17 @@ ProtocolManager::Get()
} }
ProtocolAddOns uint32
ProtocolManager::Protocols() ProtocolManager::CountProtocolAddOns() const
{ {
return fAddOnMap.Values(); return fAddOnMap.CountItems();
} }
ProtocolMap CayaProtocolAddOn*
ProtocolManager::ProtocolInstances() const ProtocolManager::ProtocolAddOnAt(uint32 i) const
{ {
return fProtocolMap; return fAddOnMap.ValueAt(i);
}
CayaProtocol*
ProtocolManager::ProtocolInstance(bigtime_t identifier)
{
return fProtocolMap.ValueFor(identifier);
} }
@ -90,6 +83,27 @@ ProtocolManager::ProtocolAddOn(const char* signature)
} }
uint32
ProtocolManager::CountProtocolInstances() const
{
return fProtocolMap.CountItems();
}
CayaProtocol*
ProtocolManager::ProtocolInstanceAt(uint32 i) const
{
return fProtocolMap.ValueAt(i);
}
CayaProtocol*
ProtocolManager::ProtocolInstance(bigtime_t identifier)
{
return fProtocolMap.ValueFor(identifier);
}
void void
ProtocolManager::AddAccount(CayaProtocolAddOn* addOn, const char* account, ProtocolManager::AddAccount(CayaProtocolAddOn* addOn, const char* account,
BHandler* target) BHandler* target)

View File

@ -18,27 +18,28 @@ class BBitmap;
class BDirectory; class BDirectory;
class BHandler; class BHandler;
typedef List<CayaProtocolAddOn*> ProtocolAddOns;
typedef KeyMap<BString, CayaProtocolAddOn*> AddOnMap;
typedef KeyMap<bigtime_t, CayaProtocol*> ProtocolMap;
class ProtocolManager { class ProtocolManager {
public: public:
void Init(BDirectory dir, BHandler* target); void Init(BDirectory dir, BHandler* target);
static ProtocolManager* Get(); static ProtocolManager* Get();
ProtocolAddOns Protocols(); uint32 CountProtocolAddOns() const;
ProtocolMap ProtocolInstances() const; CayaProtocolAddOn* ProtocolAddOnAt(uint32 i) const;
CayaProtocol* ProtocolInstance(bigtime_t identifier);
CayaProtocolAddOn* ProtocolAddOn(const char* signature); CayaProtocolAddOn* ProtocolAddOn(const char* signature);
uint32 CountProtocolInstances() const;
CayaProtocol* ProtocolInstanceAt(uint32 i) const;
CayaProtocol* ProtocolInstance(bigtime_t identifier);
void AddAccount(CayaProtocolAddOn* addOn, void AddAccount(CayaProtocolAddOn* addOn,
const char* account, const char* account,
BHandler* target); BHandler* target);
private: private:
typedef KeyMap<BString, CayaProtocolAddOn*> AddOnMap;
typedef KeyMap<bigtime_t, CayaProtocol*> ProtocolMap;
ProtocolManager(); ProtocolManager();
void _GetAccounts(CayaProtocolAddOn* addOn, void _GetAccounts(CayaProtocolAddOn* addOn,
BHandler* target); BHandler* target);

View File

@ -52,11 +52,11 @@ PreferencesAccounts::PreferencesAccounts()
BScrollView* scrollView = new BScrollView("scrollView", fListView, BScrollView* scrollView = new BScrollView("scrollView", fListView,
B_WILL_DRAW, false, true); B_WILL_DRAW, false, true);
ProtocolAddOns addOns = ProtocolManager::Get()->Protocols(); ProtocolManager* pm = ProtocolManager::Get();
fProtosMenu = new BPopUpMenu(NULL, true); fProtosMenu = new BPopUpMenu(NULL, true);
for (uint32 i = 0; i < addOns.CountItems(); i++) { for (uint32 i = 0; i < pm->CountProtocolAddOns(); i++) {
CayaProtocolAddOn* addOn = addOns.ItemAt(i); CayaProtocolAddOn* addOn = pm->ProtocolAddOnAt(i);
ProtocolSettings* settings = new ProtocolSettings(addOn); ProtocolSettings* settings = new ProtocolSettings(addOn);
// Add accounts to list view // Add accounts to list view