29 const std::string& prototype,
30 const std::string& body,
50 s <<
" Method implementation:\n"
99 s.throw_unexpected_attribute(attr.
name());
104 }
catch (std::exception& e) {
111 }
catch (std::exception& ex) {
123 }
catch (std::exception& ex) {
124 Oks::error_msg(
"OksMethod::OksMethod()") << ex.what() << std::endl;
180 std::list<OksMethodImplementation*>::const_iterator i1 =
p_implementations->begin();
181 std::list<OksMethodImplementation*>::const_iterator i2 = m.p_implementations->begin();
184 if (!(*(*i1) == *(*i2)))
194 s <<
"Method name: \"" << m.p_name
197 << m.p_description <<
"\"\n";
199 if (m.p_implementations) {
200 s <<
" implementations:\n";
202 for (std::list<OksMethodImplementation*>::const_iterator i = m.p_implementations->begin();
203 i != m.p_implementations->end();
207 s <<
" there are no implementation(s)\n";
259 s.throw_unexpected_attribute(attr.
name());
264 }
catch (std::exception& e) {
272 }
catch (std::exception& ex) {
281 const char* tag_start = s.get_tag_start();
287 else if (!strcmp(tag_start,
"method-implementation")) {
294 std::ostringstream text;
295 text <<
"Unexpected tag \'" << tag_start <<
"\' inside method \'" <<
p_name <<
"\'\n";
296 throw std::runtime_error(text.str().c_str());
301 }
catch (std::exception& e) {
324 }
catch (std::exception& ex) {
331 std::ostringstream text;
332 text <<
"Class \"" <<
p_class->
get_name() <<
"\" already has direct method \"" << new_name <<
'\"';
362 if (language == (*i)->get_language())
373 std::ostringstream text;
374 text <<
"Cannot add implementation on language \"" << language <<
"\" since it already exists.";
400 std::ostringstream text;
401 text <<
"Cannot remove implementation on language \"" << language <<
"\" since it does not exist.";
439 std::ostringstream text;
440 text <<
"cannot rename \"" <<
p_method->
p_name <<
"\" method implementation to language \"" << s
442 "since the method already has implementation with such language.";
448 }
catch (std::exception& ex) {
470 }
catch (std::exception& ex) {
OksMethod * find_method(const std::string &name) const noexcept
Find method (search in this and base classes).
void registrate_class_change(ChangeType, const void *, bool=true)
const std::string & get_name() const noexcept
void lock_file(const char *)
OksMethod * find_direct_method(const std::string &name) const noexcept
Find direct method.
@ ChangeMethodDescription
@ ChangeMethodImplementation
OKS method implementation class.
const std::string & get_body() const noexcept
OksMethodImplementation(const std::string &language, const std::string &prototype, const std::string &body, OksMethod *p=nullptr)
OKS method implementation constructor.
friend std::ostream & operator<<(std::ostream &, const OksMethodImplementation &)
const std::string & get_language() const noexcept
void set_prototype(const std::string &prototype)
Set method implementation prototype.
const std::string & get_prototype() const noexcept
void set_language(const std::string &language)
Set method implementation language.
bool operator==(const class OksMethodImplementation &) const
static const char prototype_xml_attr[]
void save(OksXmlOutputStream &) const
static const char language_xml_attr[]
void set_body(const std::string &body)
Set method implementation body.
static const char body_xml_attr[]
static const char method_impl_xml_tag[]
void set_name(const std::string &name)
Set method name.
static const char name_xml_attr[]
static const char description_xml_attr[]
static const char method_xml_tag[]
void set_description(const std::string &description)
Set method description.
friend std::ostream & operator<<(std::ostream &, const OksMethod &)
std::list< OksMethodImplementation * > * p_implementations
void add_implementation(const std::string &language, const std::string &prototype, const std::string &body)
Add method implementation.
void remove_implementation(const std::string &language)
Remove method implementation.
bool operator==(const class OksMethod &) const
friend class OksMethodImplementation
OksMethodImplementation * find_implementation(const std::string &language) const
Find method implementation.
void save(OksXmlOutputStream &) const
std::string p_description
OksMethod(const std::string &name, OksClass *p=nullptr)
OKS method constructor.
static std::ostream & error_msg(const char *)
virtual const char * what() const noexcept
bool cmp_str8(const char *s1, const char s2[9])
bool cmp_str1(const char *s1, const char s2[2])
bool cmp_str4(const char *s1, const char s2[5])
bool cmp_str9(const char *s1, const char s2[10])
void validate_not_empty(const std::string &value, const char *name)
bool cmp_str11(const char *s1, const char s2[12])
bool cmp_str7(const char *s1, const char s2[8])