/** @page ClassExample1 Example of creating simple class (with methods only)
To create the class of your own, consisting only of methods[like, for "random" class],
one need to put to classes/ directory module in C++ language with .C file name extension,
in which...
1. Define a descendant of Methoded, declaring Methoded::used_directly as true.
2. Code methods of objects like this[ Native_code_ptr ]:
@code
static void _test(Request& r, const String& method_name, MethodParams *params) {
Pool& pool=r.pool();
...
// generate exceptions like this:
if(error_code)
throw Exception("exception class",
&method_name, // address of String, containing text/source of error
"problem %d", error_code);
// output text like this:
if(text_result)
r.write_assign_lang(*new(pool) String(pool, "тест"));
// output objects like this:
if(object_result)
r.write_no_lang(*new(pool) VInt(pool, 48));
}
@endcode
3. In constructor one must set class name and register it's methods:
@code
MExample1::MExample1(Pool& apool) : Methoded(apool, "example1") {
// ^example1:test[]
add_native_method("test", Method::CT_STATIC, _test, 0, 0);
}
@endcode
@see VStateless_class::add_native_method
4. And, finally, define constricting function, with name M{name_of_file_with_first_letter_Capital}_create:
@code
Methoded *MExample1_create(Pool& pool) {
return new(pool) MExample1(pool);
}
@endcode
5. If for class to work it need any options, they could be read from variables assigned in @conf,
by overriding Methoded::configure_admin and/or Methoded::configure_user.
User then could call that method like:
@verbatim
^example1:test[]
@endverbatim
*/
E-mail: