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

This commit is contained in:
Tomasz Sowa 2022-04-25 16:35:14 +02:00
parent 43ebbdaa33
commit aad5db9a6a
2 changed files with 9 additions and 7 deletions

View File

@ -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);
}

View File

@ -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: