From ca29ffccc02e327ec15db406d5c50a4d39bf5262 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 10 Sep 2012 18:26:57 +0000 Subject: [PATCH] Skylark: SkylarkPack docs git-svn-id: svn://ultimatepp.org/upp/trunk@5345 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Skylark/src.tpp/Handler$en-us.tpp | 76 +++++++++++++++++------ uppsrc/Skylark/src.tpp/Http$en-us.tpp | 30 ++++----- uppsrc/Skylark/src.tpp/Renderer$en-us.tpp | 12 ++++ 3 files changed, 84 insertions(+), 34 deletions(-) diff --git a/uppsrc/Skylark/src.tpp/Handler$en-us.tpp b/uppsrc/Skylark/src.tpp/Handler$en-us.tpp index 550c65c4a..5042fbb4e 100644 --- a/uppsrc/Skylark/src.tpp/Handler$en-us.tpp +++ b/uppsrc/Skylark/src.tpp/Handler$en-us.tpp @@ -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``&`):%- [_^String^ String]_[* M -akeLink]([@(0.0.255) void]_(`*[*@3 handler])(Http[@(0.0.255) `&]), -[@(0.0.255) const]_Vector`&_[*@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; ]] \ No newline at end of file +[s4; &] +[s5;:MakeLink`(const HandlerId`&`,const Vector``&`): [_^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;%% ]] \ No newline at end of file diff --git a/uppsrc/Skylark/src.tpp/Http$en-us.tpp b/uppsrc/Skylark/src.tpp/Http$en-us.tpp index a93fc598b..35a3b809a 100644 --- a/uppsrc/Skylark/src.tpp/Http$en-us.tpp +++ b/uppsrc/Skylark/src.tpp/Http$en-us.tpp @@ -253,29 +253,29 @@ header of response, ][%-*@3 code][%- the response code.] Returns `*this.&] [s3; &] [s4; &] -[s5;:Http`:`:Redirect`(void`(`*`)`(Http`&`)`,const Vector``&`):%- [_^Http^ Http -][@(0.0.255) `&]_[* Redirect]([@(0.0.255) void]_(`*[*@3 handler])([_^Http^ Http][@(0.0.255) `& -]), [@(0.0.255) const]_Vector`&_[*@3 arg])&] +[s5;:Http`:`:Redirect`(const HandlerId`&`,const Vector``&`):%- [_^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; &] diff --git a/uppsrc/Skylark/src.tpp/Renderer$en-us.tpp b/uppsrc/Skylark/src.tpp/Renderer$en-us.tpp index e06ed3412..cab3285c0 100644 --- a/uppsrc/Skylark/src.tpp/Renderer$en-us.tpp +++ b/uppsrc/Skylark/src.tpp/Renderer$en-us.tpp @@ -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) `&