Code Cleanup
- All objects now use the same convention for naming members. The consistency is a good thing.
This commit is contained in:
@@ -39,26 +39,26 @@ extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Hook::Hook ()
|
||||
: event ("")
|
||||
, file ("")
|
||||
, function ("")
|
||||
: _event ("")
|
||||
, _file ("")
|
||||
, _function ("")
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Hook::Hook (const std::string& e, const std::string& f, const std::string& fn)
|
||||
: event (e)
|
||||
, file (f)
|
||||
, function (fn)
|
||||
: _event (e)
|
||||
, _file (f)
|
||||
, _function (fn)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Hook::Hook (const Hook& other)
|
||||
{
|
||||
event = other.event;
|
||||
file = other.file;
|
||||
function = other.function;
|
||||
_event = other._event;
|
||||
_file = other._file;
|
||||
_function = other._function;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -66,9 +66,9 @@ Hook& Hook::operator= (const Hook& other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
event = other.event;
|
||||
file = other.file;
|
||||
function = other.function;
|
||||
_event = other._event;
|
||||
_file = other._file;
|
||||
_function = other._function;
|
||||
}
|
||||
|
||||
return *this;
|
||||
@@ -78,18 +78,18 @@ Hook& Hook::operator= (const Hook& other)
|
||||
Hooks::Hooks ()
|
||||
{
|
||||
// New 2.x hooks.
|
||||
validTaskEvents.push_back ("on-task-add"); // Unimplemented
|
||||
validTaskEvents.push_back ("on-task-modify"); // Unimplemented
|
||||
validTaskEvents.push_back ("on-task-complete"); // Unimplemented
|
||||
validTaskEvents.push_back ("on-task-delete"); // Unimplemented
|
||||
_validTaskEvents.push_back ("on-task-add"); // Unimplemented
|
||||
_validTaskEvents.push_back ("on-task-modify"); // Unimplemented
|
||||
_validTaskEvents.push_back ("on-task-complete"); // Unimplemented
|
||||
_validTaskEvents.push_back ("on-task-delete"); // Unimplemented
|
||||
|
||||
validProgramEvents.push_back ("on-launch");
|
||||
validProgramEvents.push_back ("on-exit");
|
||||
validProgramEvents.push_back ("on-file-read"); // Unimplemented
|
||||
validProgramEvents.push_back ("on-file-write"); // Unimplemented
|
||||
validProgramEvents.push_back ("on-synch"); // Unimplemented
|
||||
validProgramEvents.push_back ("on-merge"); // Unimplemented
|
||||
validProgramEvents.push_back ("on-gc"); // Unimplemented
|
||||
_validProgramEvents.push_back ("on-launch");
|
||||
_validProgramEvents.push_back ("on-exit");
|
||||
_validProgramEvents.push_back ("on-file-read"); // Unimplemented
|
||||
_validProgramEvents.push_back ("on-file-write"); // Unimplemented
|
||||
_validProgramEvents.push_back ("on-synch"); // Unimplemented
|
||||
_validProgramEvents.push_back ("on-merge"); // Unimplemented
|
||||
_validProgramEvents.push_back ("on-gc"); // Unimplemented
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -104,7 +104,7 @@ Hooks::~Hooks ()
|
||||
void Hooks::initialize ()
|
||||
{
|
||||
#ifdef HAVE_LIBLUA
|
||||
api.initialize ();
|
||||
_api.initialize ();
|
||||
#endif
|
||||
|
||||
// Allow a master switch to turn the whole thing off.
|
||||
@@ -142,7 +142,7 @@ void Hooks::initialize ()
|
||||
{
|
||||
context.debug (std::string ("Event '") + name + "' hooked by " + file + ", function " + function);
|
||||
Hook h (name, Path::expand (file), function);
|
||||
all.push_back (h);
|
||||
_all.push_back (h);
|
||||
|
||||
(void) n.skip (',');
|
||||
}
|
||||
@@ -162,16 +162,16 @@ bool Hooks::trigger (const std::string& event)
|
||||
{
|
||||
#ifdef HAVE_LIBLUA
|
||||
std::vector <Hook>::iterator it;
|
||||
for (it = all.begin (); it != all.end (); ++it)
|
||||
for (it = _all.begin (); it != _all.end (); ++it)
|
||||
{
|
||||
if (it->event == event)
|
||||
if (it->_event == event)
|
||||
{
|
||||
Timer timer (std::string ("Hooks::trigger ") + event);
|
||||
|
||||
if (validProgramEvent (event))
|
||||
{
|
||||
context.debug (std::string ("Event ") + event + " triggered");
|
||||
if (! api.callProgramHook (it->file, it->function))
|
||||
if (! _api.callProgramHook (it->_file, it->_function))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -189,16 +189,16 @@ bool Hooks::trigger (const std::string& event, Task& task)
|
||||
{
|
||||
#ifdef HAVE_LIBLUA
|
||||
std::vector <Hook>::iterator it;
|
||||
for (it = all.begin (); it != all.end (); ++it)
|
||||
for (it = _all.begin (); it != _all.end (); ++it)
|
||||
{
|
||||
if (it->event == event)
|
||||
if (it->_event == event)
|
||||
{
|
||||
Timer timer (std::string ("Hooks::trigger ") + event);
|
||||
|
||||
if (validTaskEvent (event))
|
||||
{
|
||||
context.debug (std::string ("Event ") + event + " triggered");
|
||||
if (! api.callTaskHook (it->file, it->function, task))
|
||||
if (! _api.callTaskHook (it->_file, it->_function, task))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -213,7 +213,7 @@ bool Hooks::trigger (const std::string& event, Task& task)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Hooks::validProgramEvent (const std::string& event)
|
||||
{
|
||||
if (std::find (validProgramEvents.begin (), validProgramEvents.end (), event) != validProgramEvents.end ())
|
||||
if (std::find (_validProgramEvents.begin (), _validProgramEvents.end (), event) != _validProgramEvents.end ())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -222,7 +222,7 @@ bool Hooks::validProgramEvent (const std::string& event)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Hooks::validTaskEvent (const std::string& event)
|
||||
{
|
||||
if (std::find (validTaskEvents.begin (), validTaskEvents.end (), event) != validTaskEvents.end ())
|
||||
if (std::find (_validTaskEvents.begin (), _validTaskEvents.end (), event) != _validTaskEvents.end ())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user