UniverseUniversity


Home Projects Jobs Clientele Contact

uu


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Yet another idea



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


Authoright © Total Knowledge: 2001-2008