8 #include "apiargument.h"
9 #include "apisignature.h"
12 #include <nap/event.h>
13 #include <utility/uniqueptrvectoriterator.h>
14 #include <mathutils.h>
62 APIEvent(
const std::string& name,
const std::string&
id);
71 APIEvent(std::string&& name, std::string&&
id);
76 const std::string&
getName()
const {
return mName; }
81 const std::string&
getID()
const {
return mID; }
90 template<
typename T,
typename... Args>
91 APIArgument* addArgument(
const std::string& name, Args&&... args);
98 APIArgument* addArgument(std::unique_ptr<APIBaseValue> value);
103 int getCount()
const {
return static_cast<int>(mArguments.size()); }
126 const APIArgument* getArgumentByName(std::string&& name)
const;
132 APIArgument* getArgumentByName(std::string&& name);
186 template<
typename T,
typename... Args>
192 std::unique_ptr<T> value = std::make_unique<T>(name, std::forward<Args>(args)...);
198 std::unique_ptr<APIArgument> argument = std::make_unique<APIArgument>(std::move(value));
200 mArguments.emplace_back(std::move(argument));
201 return mArguments.back().get();
208 const T* return_p =
nullptr;
209 if (this->get_type().is_derived_from<T>())
210 return_p =
reinterpret_cast<const T*
>(
this);
211 assert(return_p !=
nullptr);
219 T* cast_event = rtti_cast<T>(
this);
220 assert(cast_event !=
nullptr);
Definition: uniqueptrvectoriterator.h:70
Definition: apisignature.h:20
std::string NAPAPI generateUUID()
const std::string & getName() const
Definition: apievent.h:76
const ArgumentConstIterator getArguments() const
Definition: apievent.h:108
std::vector< std::unique_ptr< APIArgument > > APIArgumentList
Definition: apievent.h:18
int getCount() const
Definition: apievent.h:103
const std::string & getID() const
Definition: apievent.h:81
std::unique_ptr< nap::APIEvent > APIEventPtr
Definition: apievent.h:179
APIArgument & operator[](std::size_t idx)
Definition: apievent.h:165
Definition: templateapp.h:17
APIArgument * addArgument(const std::string &name, Args &&... args)
Definition: apievent.h:187
Definition: apiargument.h:22
Definition: apivalue.h:21
const T & to() const
Definition: apievent.h:206
const APIArgument & operator[](std::size_t idx) const
Definition: apievent.h:171
Definition: apievent.h:37