|
|
| version 1.111, 2001/09/07 12:46:19 | version 1.115, 2001/09/26 10:32:25 |
|---|---|
| Line 2 | Line 2 |
| Parser: @b table parser class. | Parser: @b table parser class. |
| Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) | Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) |
| $Id$ | |
| */ | */ |
| static const char *RCSId="$Id$"; | |
| #include "classes.h" | #include "classes.h" |
| #include "pa_config_includes.h" | #include "pa_config_includes.h" |
| Line 80 static void _set(Request& r, const Strin | Line 80 static void _set(Request& r, const Strin |
| static void _load(Request& r, const String& method_name, MethodParams *params) { | static void _load(Request& r, const String& method_name, MethodParams *params) { |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| // filename is last parameter | // filename is last parameter |
| const String& filename=params->as_string(params->size()-1, | Value& vfilename=params->as_no_junction(params->size()-1, |
| "file name must not be code"); | "file name must not be code"); |
| // loading text | // loading text |
| char *data=file_read_text(pool, r.absolute(filename)); | char *data=file_read_text(pool, r.absolute(vfilename.as_string())); |
| // parse columns | // parse columns |
| Array *columns; | Array *columns; |
| Line 342 static void _menu(Request& r, const Stri | Line 342 static void _menu(Request& r, const Stri |
| table.set_current(saved_current); | table.set_current(saved_current); |
| } | } |
| static void _empty(Request& r, const String& method_name, MethodParams *params) { | |
| Pool& pool=r.pool(); | |
| Table& table=static_cast<VTable *>(r.self)->table(); | |
| r.write_no_lang(*new(pool) VBool(pool, table.size()==0)); | |
| } | |
| #ifndef DOXYGEN | #ifndef DOXYGEN |
| struct Row_info { | struct Row_info { |
| Table *table; | Table *table; |
| Line 718 MTable::MTable(Pool& apool) : Methoded(a | Line 711 MTable::MTable(Pool& apool) : Methoded(a |
| // ^table.menu{code}[delim] | // ^table.menu{code}[delim] |
| add_native_method("menu", Method::CT_DYNAMIC, _menu, 1, 2); | add_native_method("menu", Method::CT_DYNAMIC, _menu, 1, 2); |
| // ^table.empty[] | |
| add_native_method("empty", Method::CT_DYNAMIC, _empty, 0, 0); | |
| // ^table:hash[key field name] | // ^table:hash[key field name] |
| // ^table:hash[key field name][value field name;...] | // ^table:hash[key field name][value field name;...] |
| add_native_method("hash", Method::CT_DYNAMIC, _hash, 1, 1000); | add_native_method("hash", Method::CT_DYNAMIC, _hash, 1, 1000); |