Browse Source

let Functions::Add() returns info whether the functions/controller has been added

master
Tomasz Sowa 3 months ago
parent
commit
aad5db9a6a
  1. 12
      winixd/functions/functions.cpp
  2. 4
      winixd/functions/functions.h

12
winixd/functions/functions.cpp

@ -197,28 +197,30 @@ void Functions::SetObjects(FunctionBase * fun)
}
void Functions::Add(FunctionBase * fun)
bool Functions::Add(FunctionBase * fun)
{
if( fun->fun.url.empty() )
{
log << log1 << "Functions: skipping a function with an empty url" << logend;
return;
return false;
}
if( Find(fun->fun.url) )
{
log << log1 << "Functions: function " << fun->fun.url << " already exists (skipped)" << logend;
return;
return false;
}
SetObjects(fun);
table[fun->fun.url] = fun;
return true;
}
void Functions::Add(FunctionBase & fun)
bool Functions::Add(FunctionBase & fun)
{
Add(&fun);
return Add(&fun);
}

4
winixd/functions/functions.h

@ -191,8 +191,8 @@ public:
void SetUser(Item & item);
void Add(FunctionBase * fun);
void Add(FunctionBase & fun);
bool Add(FunctionBase * fun);
bool Add(FunctionBase & fun);
private:

Loading…
Cancel
Save