Skylark: SkylarkPack docs

git-svn-id: svn://ultimatepp.org/upp/trunk@5345 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-09-10 18:26:57 +00:00
parent 9f773135a6
commit ca29ffccc0
3 changed files with 84 additions and 34 deletions

View file

@ -9,28 +9,66 @@ topic "Handler functions and macros";
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
[b42;2 $$9,9#13035079074754324216151401829390:normal]
[{_}%EN-US
[ {{10000@(113.42.0) [s0; [*@7;4 Handler functions and macros]]}}&]
[s3;%- &]
[s5;:RegisterHandler`(void`(`*`)`(Http`&http`)`,const char`*`,const char`*`):%- [@(0.0.255) v
[{_}
[ {{10000@(113.42.0) [s0;%% [*@7;4 HandlerId]]}}&]
[s3; &]
[s1;:HandlerId`:`:struct: [@(0.0.255)3 struct][3 _][*3 HandlerId]&]
[s2;%% This simple concrete type is able to store both function to
pointer or pack instance method id to be used as URL link base.
Can be created from pointer to handler or as result of THISLINK
or LINK macros.&]
[s0;%% &]
[ {{10000@(113.42.0) [s0;%% [*@7;4 Handler functions and macros]]}}&]
[s3; &]
[s5;:RegisterHandler`(void`(`*`)`(Http`&http`)`,const char`*`,const char`*`): [@(0.0.255) v
oid]_[* RegisterHandler]([@(0.0.255) void]_(`*[*@3 handler])(Http[@(0.0.255) `&]_http),
[@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 p
ath])&]
[s2; Registers handler function [%-*@3 handler] with the name [%-*@3 id]
[s2;%% Registers handler function [%-*@3 handler] with the name [%-*@3 id]
(id is usually the same as the name of function) that is supposed
to handle [%-*@3 path] pattern.&]
[s3;%% &]
[s4; &]
[s5;:SKYLARK`(name`, path`): [* SKYLARK]([*@3 name], [*@3 path])&]
[s2;%% Defines the handler function [%-*@3 name] (body follows the
macro) supposed to handle [%-*@3 path] pattern.&]
[s3; &]
[s4;%- &]
[s5;:SKYLARK`(name`, path`):%- [* SKYLARK]([*@3 name], [*@3 path])&]
[s2; Defines the handler function [%-*@3 name] (body follows the macro)
supposed to handle [%-*@3 path] pattern.&]
[s3; &]
[s4;%- &]
[s5;:MakeLink`(void`(`*`)`(Http`&`)`,const Vector`<Value`>`&`):%- [_^String^ String]_[* M
akeLink]([@(0.0.255) void]_(`*[*@3 handler])(Http[@(0.0.255) `&]),
[@(0.0.255) const]_Vector<Value>`&_[*@3 arg])&]
[s2; Based on [%-*@3 handler] function pointer and [%-*@3 arg] list of
arguments, creates URL would get handled by this [%-*@3 handler]
with specified arguments.&]
[s3; &]
[s0; ]]
[s4; &]
[s5;:MakeLink`(const HandlerId`&`,const Vector`<Value`>`&`): [_^String^ String]_[* MakeLi
nk]([@(0.0.255) const]_[_^HandlerId^ HandlerId][@(0.0.255) `&]_[*@3 id],
[@(0.0.255) const]_[_^Vector^ Vector]<[_^Value^ Value]>`&_[*@3 arg])&]
[s2;%% Based on [%-*@3 handler] and [%-*@3 arg] list of arguments, creates
URL would get handled by this [%-*@3 handler] with specified arguments.&]
[s3;%% &]
[s4;%% &]
[s5;:SkylarkPack`:`:struct: struct_[* SkylarkPack]&]
[s2;%% This is the base class of pack classed, which can be used
to group and parametrize a set of handlers.&]
[s3;%% &]
[s4; &]
[s5;:SKYLARK`_USE`(cls`, id`, path`): [* SKYLARK`_USE]([*@3 cls], [*@3 id],
[*@3 path])&]
[s2;%% Creates an instance of pack [%-*@3 cls] as global variable [%-*@3 id]
with [%-*@3 path] prefix.&]
[s3;%% &]
[s4; &]
[s5;:SKYLARK`_METHOD`(method`, path`): [* SKYLARK`_METHOD]([*@3 method],
[*@3 path])&]
[s2;%% Registers a pack handler [%-*@3 method] to handler [%-*@3 path]
pattern (this is combined with path prefix of SKYLARK`_USE).
Intended to be used in Use method of pack.&]
[s3;%% &]
[s4; &]
[s5;:THISLINK`(method`): [* THISLINK]([*@3 method])&]
[s2;%% Returns HandlerId of [%-*@3 method] `- to be used within pack
class.&]
[s3;%% &]
[s4; &]
[s5;:LINK`(instance`, method`): [* LINK]([*@3 instance], [*@3 method])&]
[s2;%% Returns HandlerId of specific [%-*@3 instance] [%-*@3 method].&]
[s3;%% &]
[s4; &]
[s5;:SKYLARK`_MEMBER`(member`, path`): [* SKYLARK`_MEMBER]([*@3 member],
[*@3 path])&]
[s2;%% Registers member variable subpack (in Use method).&]
[s0;%% ]]

View file

@ -253,29 +253,29 @@ header of response, ][%-*@3 code][%- the response code.] Returns
`*this.&]
[s3; &]
[s4; &]
[s5;:Http`:`:Redirect`(void`(`*`)`(Http`&`)`,const Vector`<Value`>`&`):%- [_^Http^ Http
][@(0.0.255) `&]_[* Redirect]([@(0.0.255) void]_(`*[*@3 handler])([_^Http^ Http][@(0.0.255) `&
]), [@(0.0.255) const]_Vector<Value>`&_[*@3 arg])&]
[s5;:Http`:`:Redirect`(const HandlerId`&`,const Vector`<Value`>`&`):%- [_^Http^ Http][@(0.0.255) `&
]_[* Redirect]([@(0.0.255) const]_[_^HandlerId^ HandlerId][@(0.0.255) `&]_[*@3 handler],
[@(0.0.255) const]_[_^Vector^ Vector]<[_^Value^ Value]>`&_[*@3 arg])&]
[s2; Sets the redirection response to [%-*@3 handler] with a set of
url arguments [%-*@3 arg]. Returns `*this.&]
[s3; &]
[s4; &]
[s5;:Http`:`:Redirect`(void`(`*`)`(Http`&`)`):%- [_^Http^ Http][@(0.0.255) `&]_[* Redirect](
[@(0.0.255) void]_(`*[*@3 handler])([_^Http^ Http][@(0.0.255) `&]))&]
[s4;%- &]
[s5;:Http`:`:Redirect`(const HandlerId`&`):%- [_^Http^ Http][@(0.0.255) `&]_[* Redirect]([@(0.0.255) c
onst]_[_^HandlerId^ HandlerId][@(0.0.255) `&]_[*@3 handler])&]
[s2; Sets the redirection response to [%-*@3 handler]. Returns `*this.&]
[s3; &]
[s4; &]
[s5;:Http`:`:Redirect`(void`(`*`)`(Http`&`)`,const Value`&`):%- [_^Http^ Http][@(0.0.255) `&
]_[* Redirect]([@(0.0.255) void]_(`*[*@3 handler])([_^Http^ Http][@(0.0.255) `&]),
[@(0.0.255) const]_Value[@(0.0.255) `&]_[*@3 arg1])&]
[s4;%- &]
[s5;:Http`:`:Redirect`(const HandlerId`&`,const Value`&`):%- [_^Http^ Http][@(0.0.255) `&
]_[* Redirect]([@(0.0.255) const]_[_^HandlerId^ HandlerId][@(0.0.255) `&]_[*@3 handler],
[@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 v1])&]
[s2; Sets the redirection response to [%-*@3 handler] with one url
argument. Returns `*this.&]
[s3; &]
[s4; &]
[s5;:Http`:`:Redirect`(void`(`*`)`(Http`&`)`,const Value`&`,const Value`&`):%- [_^Http^ H
ttp][@(0.0.255) `&]_[* Redirect]([@(0.0.255) void]_(`*[*@3 handler])([_^Http^ Http][@(0.0.255) `&
]), [@(0.0.255) const]_Value[@(0.0.255) `&]_[*@3 arg1], [@(0.0.255) const]_Value[@(0.0.255) `&
]_[*@3 arg2])&]
[s4;%- &]
[s5;:Http`:`:Redirect`(const HandlerId`&`,const Value`&`,const Value`&`):%- [_^Http^ Ht
tp][@(0.0.255) `&]_[* Redirect]([@(0.0.255) const]_[_^HandlerId^ HandlerId][@(0.0.255) `&]_
[*@3 handler], [@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 v1],
[@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 v2])&]
[s2; Sets the redirection response to [%-*@3 handler] with two url
arguments. Returns `*this.&]
[s3; &]

View file

@ -38,6 +38,9 @@ space. Returns `*this.&]
to shared variable space. Returns `*this.&]
[s3;%% &]
[s4; &]
[s5;:Renderer`:`:operator`(`)`(const char`*`,const HandlerId`&`): [_^Renderer^ Renderer
][@(0.0.255) `&]_[* operator()]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id],
[@(0.0.255) const]_[_^HandlerId^ HandlerId][@(0.0.255) `&]_[*@3 handler])&]
[s5;:Renderer`:`:operator`(`)`(const char`*`,void`(`*`)`(Http`&`)`): [_^Renderer^ Rende
rer][@(0.0.255) `&]_[* operator()]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id],
[@(0.0.255) void]_(`*[*@3 handler])(Http[@(0.0.255) `&]))&]
@ -46,6 +49,10 @@ of variable will be actual URL to [%-*@3 handler] (with no URL
parameters). Returns `*this.&]
[s3;%% &]
[s4; &]
[s5;:Renderer`:`:operator`(`)`(const char`*`,const HandlerId`&`,const Value`&`): [_^Renderer^ R
enderer][@(0.0.255) `&]_[* operator()]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id],
[@(0.0.255) const]_[_^HandlerId^ HandlerId][@(0.0.255) `&]_[*@3 handler],
[@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 arg1])&]
[s5;:Renderer`:`:operator`(`)`(const char`*`,void`(`*`)`(Http`&`)`,const Value`&`): [_^Renderer^ R
enderer][@(0.0.255) `&]_[* operator()]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id],
[@(0.0.255) void]_(`*[*@3 handler])(Http[@(0.0.255) `&]), [@(0.0.255) const]_Value[@(0.0.255) `&
@ -56,6 +63,11 @@ to appropriate place (defined by handler URL pattern) as URL
parameter. Returns `*this.&]
[s3;%% &]
[s4; &]
[s5;:Renderer`:`:operator`(`)`(const char`*`,const HandlerId`&`,const Value`&`,const Value`&`): [_^Renderer^ R
enderer][@(0.0.255) `&]_[* operator()]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id],
[@(0.0.255) const]_[_^HandlerId^ HandlerId][@(0.0.255) `&]_[*@3 handler],
[@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 arg1], [@(0.0.255) const]_[_^Value^ V
alue][@(0.0.255) `&]_[*@3 arg2])&]
[s5;:Renderer`:`:operator`(`)`(const char`*`,void`(`*`)`(Http`&`)`,const Value`&`,const Value`&`): [_^Renderer^ R
enderer][@(0.0.255) `&]_[* operator()]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id],
[@(0.0.255) void]_(`*[*@3 handler])(Http[@(0.0.255) `&]), [@(0.0.255) const]_Value[@(0.0.255) `&