[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: Yet another idea
- To: uu@total-knowledge.com
- Subject: Re: Yet another idea
- From: "Alexey Parshin" <alexeyp@gmail.com>
- Date: Tue, 1 Jul 2008 16:54:07 +1000
- Delivered-to: mailing list uu@total-knowledge.com
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=J6cIa3SBCwjSk89AY9wQnUclnDCdk6YN/OtOCvJezKs=; b=Bkc12W7CRcGw9lFit82gIVU1Zg+hXaGomndxpUWqKaLuXvOfFfotrMOH3fXjO2tvIm zlWgzb66W4O0GxzUH1GA13UIvMdewWxku07QzUVc5ToF+mEuKh/G1H1r9UTidIxA4eXG z3bEwZw1AfEGwxZaa/pBAMfw6bu7z2bQytdbE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Vqyv6cjuGAR6y8DbP3jR5Px5Eng5FGC7hZjt8ef3EkgI6gDqgSnC9SQ0Cj/o+XG0gJ 0QxECld6xwPHsm0EqwadYS3FsxqvbFL1vvdGDAEOxLXCCxM2N0usvtobbAGzImU7+SC3 sXJt+IsCkGZ/ttnJUVHH1UsuOyttUiubEO9to=
- In-reply-to: <4869CAD5.6050605@total-knowledge.com>
- Mailing-list: contact uu-help@total-knowledge.com; run by ezmlm
- References: <a75bc3cf0806301656n29b16505l37ab6dd8ecdb4c26@mail.gmail.com> <4869CAD5.6050605@total-knowledge.com>
I'm seeing a bit differently. The implementation should use not the
members of the class but fields in the underlying query. And the
parser should just once per loop, converting a template into a vector
of pairs of text an following field index, so the template:
<A href='HomeServlet?id={uv_id}'> {uv_name} </A>
is parsed (once, before the loop) into vector of pairs:
{ "<A href='HomeServlet?id=", 0 },
{ "'> ", 1 },
{ "</A>", -1}
The following loop would work really fast cause it doesn't parse anything.
Alexey
1 июля 2008 г. 16:12 пользователь Ilya A. Volynets-Evenbakh
<ilya@total-knowledge.com> написал:
> In other words, what you are suggesting, is writing wrapper class for each
> possible UMO collection, that would allow easy printing of enumerations
> of such objects?
>
> That may be a good idea, although parsing such templates will be
> time consuming, I'm afraid. Another obvious problem is maintaining
> such wrappers, whenever object structure changes (e.g. a new field
> is added to UMO and needs to be exposed to list generators).
>
> Ilya.
>
> Alexey Parshin wrote:
>>
>> Илья,
>>
>> Я тут подумал над тем, как бы избавиться от C++ циклов в .csp, в пользу
>> чего-нибудь более прозрачного, и вот что придумал. Почему бы нам, вместо
>> циклов, не предоставить генерацию по шаблону.
>>
>> Вместо:
>>
>> for (vector<CTopic>::iterator itor = topics.begin(); itor != topic.end();
>> itor++)
>> out << "<A href='TopicServlet?topic_id=" << (*itor)->id << ">" <<
>> itor->title << "'</A>";
>>
>> сделаем более простое и прозрачное:
>>
>> topics.forEach("<A href='TopicServlet?topic_id={id}> {title} </A>");
>>
>> --
>> Alexey Parshin,
>> http://www.sptk.net
>
>
--
Alexey Parshin,
http://www.sptk.net