UserActions Class Reference

data handling for group / action management More...

#include <useractions.h>

Collaboration diagram for UserActions:
Collaboration graph
[legend]

Public Types

enum  ActionType {
  ActNone = 1, ActHighlight = 2, ActNotifLogin = 4, ActIgnoreChat = 8,
  ActIgnorePM = 16, ActAutokick = 32, ActNotifBattle = 64, ActNotifStatus = 128,
  ActLast = ActNotifStatus
}

Public Member Functions

 UserActions ()
 ~UserActions ()
bool DoActionOnUser (const ActionType action, const wxString &name)
wxArrayString GetGroupNames () const
void AddUserToGroup (const wxString &group, const wxString &name)
void AddGroup (const wxString &name)
void DeleteGroup (const wxString &name)
void RemoveUser (const wxString &name)
void ChangeAction (const wxString &group, const ActionType action, bool add=true)
ActionType GetGroupAction (const wxString &group) const
wxString GetGroupOfUser (const wxString &user) const
void SetGroupColor (const wxString &group, const wxColour &color)
wxColour GetGroupColor (const wxString &group) const
bool IsKnown (const wxString &name, bool outputWarning=false) const

Static Public Attributes

static const int m_numActions = sizeof(m_actionNames) / sizeof(wxString)

Protected Types

typedef std::map< wxString,
wxArrayString > 
GroupMap
typedef std::map< wxString,
ActionType
GroupActionMap
typedef std::map< ActionType,
wxArrayString > 
ActionGroupsMap
typedef std::map< ActionType,
wxArrayString > 
ActionPeopleMap
typedef std::map< wxString,
wxString
PeopleGroupMap
 nickname --> group map (we don't allow users to be in more than one group

Protected Member Functions

void Init ()
void UpdateUI ()

Protected Attributes

GroupMap m_groupMap
 groupname --> array of people in the group
GroupActionMap m_groupActions
 groupname --> ActionType for that group
ActionGroupsMap m_actionsGroups
 ActionType --> array of groups with that actiontype.
ActionPeopleMap m_actionsPeople
 ActionType --> array of people with that actiontype.
PeopleGroupMap m_peopleGroup
wxArrayString m_knownUsers
 list all known users in groups
wxArrayString m_groupNames

Detailed Description

data handling for group / action management

one single static instance is exposed as a global
by forcing a write to settings handler on every change data consistency is ensured
to keep runtime overhead as small as possible for the often called query funcs, all data is structured in multiple maps and wherever possible sortedArrays (binary search instead of linear!) are used
the price is that on every change operation (very rare compared to queries) maps need to be cleared/reloaded
currently Gui updates are handled old fashoined way by hangling around classes, this should be improved to dynamic events

Definition at line 35 of file useractions.h.


Member Typedef Documentation

typedef std::map<ActionType,wxArrayString> UserActions::ActionGroupsMap [protected]

Definition at line 75 of file useractions.h.

typedef std::map<ActionType,wxArrayString> UserActions::ActionPeopleMap [protected]

Definition at line 78 of file useractions.h.

typedef std::map<wxString,ActionType> UserActions::GroupActionMap [protected]

Definition at line 72 of file useractions.h.

typedef std::map<wxString,wxArrayString> UserActions::GroupMap [protected]

Definition at line 69 of file useractions.h.

typedef std::map<wxString,wxString> UserActions::PeopleGroupMap [protected]

nickname --> group map (we don't allow users to be in more than one group

Definition at line 82 of file useractions.h.


Member Enumeration Documentation

Enumerator:
ActNone 
ActHighlight 
ActNotifLogin 
ActIgnoreChat 
ActIgnorePM 
ActAutokick 
ActNotifBattle 
ActNotifStatus 
ActLast 

update this when adding new actions.

Definition at line 41 of file useractions.h.


Constructor & Destructor Documentation

UserActions::UserActions (  ) 

Definition at line 28 of file useractions.cpp.

UserActions::~UserActions (  ) 

Definition at line 33 of file useractions.cpp.


Member Function Documentation

void UserActions::AddGroup ( const wxString name  ) 

Definition at line 135 of file useractions.cpp.

void UserActions::AddUserToGroup ( const wxString group,
const wxString name 
)

Definition at line 118 of file useractions.cpp.

void UserActions::ChangeAction ( const wxString group,
const ActionType  action,
bool  add = true 
)

Definition at line 142 of file useractions.cpp.

void UserActions::DeleteGroup ( const wxString name  ) 

Definition at line 128 of file useractions.cpp.

bool UserActions::DoActionOnUser ( const ActionType  action,
const wxString name 
)

Definition at line 38 of file useractions.cpp.

UserActions::ActionType UserActions::GetGroupAction ( const wxString group  )  const

Definition at line 151 of file useractions.cpp.

wxColour UserActions::GetGroupColor ( const wxString group  )  const

Definition at line 170 of file useractions.cpp.

wxArrayString UserActions::GetGroupNames (  )  const

Definition at line 113 of file useractions.cpp.

wxString UserActions::GetGroupOfUser ( const wxString user  )  const

Definition at line 157 of file useractions.cpp.

void UserActions::Init (  )  [protected]

Definition at line 51 of file useractions.cpp.

bool UserActions::IsKnown ( const wxString name,
bool  outputWarning = false 
) const

Definition at line 175 of file useractions.cpp.

void UserActions::RemoveUser ( const wxString name  ) 

Definition at line 186 of file useractions.cpp.

void UserActions::SetGroupColor ( const wxString group,
const wxColour &  color 
)

Definition at line 163 of file useractions.cpp.

void UserActions::UpdateUI (  )  [protected]

Definition at line 95 of file useractions.cpp.


Field Documentation

ActionType --> array of groups with that actiontype.

Definition at line 77 of file useractions.h.

ActionType --> array of people with that actiontype.

Definition at line 80 of file useractions.h.

groupname --> ActionType for that group

Definition at line 74 of file useractions.h.

groupname --> array of people in the group

Definition at line 71 of file useractions.h.

wxArrayString UserActions::m_groupNames [protected]

Definition at line 91 of file useractions.h.

wxArrayString UserActions::m_knownUsers [protected]

list all known users in groups

Definition at line 85 of file useractions.h.

const int UserActions::m_numActions = sizeof(m_actionNames) / sizeof(wxString) [static]

Definition at line 53 of file useractions.h.

Definition at line 83 of file useractions.h.


The documentation for this class was generated from the following files:

Generated on Thu Dec 29 00:11:49 2011 for SpringLobby by doxygen 1.6.3