--- parser3/src/classes/file.C 2001/03/28 14:07:14 1.11 +++ parser3/src/classes/file.C 2001/04/03 08:23:05 1.17 @@ -1,9 +1,11 @@ -/* - Parser +/** @file + Parser: @b file parser class. + Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexander Petrosyan (http://design.ru/paf) - $Id: file.C,v 1.11 2001/03/28 14:07:14 paf Exp $ + $Id: file.C,v 1.17 2001/04/03 08:23:05 paf Exp $ */ #include "pa_request.h" @@ -21,7 +23,6 @@ VStateless_class *file_class; // methods -/// @test mkdirs static void _save(Request& r, const String& method_name, Array *params) { Pool& pool=r.pool(); Value& vfile_name=*static_cast(params->get(0)); @@ -80,7 +81,7 @@ static void _find(Request& r, const Stri String test_name(pool); for(int j=0; jsize()==1?lfile_name.cstr() @@ -128,11 +128,12 @@ static void _load(Request& r, const Stri if(r.mime_types->locate(0, sext)) if(!(mime_type=r.mime_types->item(1))) PTHROW(0, 0, - r.mime_types->origin_string(), - "MIME-TYPE table column elements must not be empty"); + r.mime_types->origin_string(), + "MIME-TYPE table column elements must not be empty"); } } } + if(!mime_type) mime_type=new(pool) String(pool, "application/octet-stream"); @@ -143,17 +144,17 @@ static void _load(Request& r, const Stri void initialize_file_class(Pool& pool, VStateless_class& vclass) { // ^save[file-name] - vclass.add_native_method("save", _save, 1, 1); + vclass.add_native_method("save", Method::CT_DYNAMIC, _save, 1, 1); // ^delete[file-name] - vclass.add_native_method("delete", _delete, 1, 1); + vclass.add_native_method("delete", Method::CT_STATIC, _delete, 1, 1); // ^find[file-name] // ^find[file-name]{when-not-found} - vclass.add_native_method("find", _find, 1, 2); + vclass.add_native_method("find", Method::CT_STATIC, _find, 1, 2); // ^load[disk-name] // ^load[disk-name;user-name] // ^load[disk-name;user-name;mime-type] - vclass.add_native_method("load", _load, 1, 3); + vclass.add_native_method("load", Method::CT_DYNAMIC, _load, 1, 3); }