Annotation of parser3/src/classes/file.C, revision 1.3

1.1       paf         1: /*
                      2:        Parser
                      3:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
                      4:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
                      5: 
1.3     ! paf         6:        $Id: file.C,v 1.2 2001/03/19 20:46:35 paf Exp $
1.1       paf         7: */
                      8: 
                      9: #include "pa_request.h"
                     10: #include "_file.h"
                     11: #include "pa_vfile.h"
                     12: 
                     13: // global var
                     14: 
1.3     ! paf        15: VStateless_class *file_class;
1.1       paf        16: 
                     17: // methods
                     18: 
                     19: static void _save(Request& r, const String& method_name, Array *params) {
                     20:        //\Pool& pool=r.pool();
                     21:        Value *vfile_name=static_cast<Value *>(params->get(0));
                     22:        // forcing
1.2       paf        23:        // ^save{this body type}
                     24:        r.fail_if_junction_(false, *vfile_name, method_name, "file name must be junction");
1.1       paf        25: 
1.2       paf        26:        {
                     27:                Temp_lang temp_lang(r, String::Untaint_lang::FILE);
                     28:                static_cast<VFile *>(r.self)->save(
                     29:                        r.absolute(r.process(*vfile_name).as_string().cstr()));
                     30:        }
1.1       paf        31: }
                     32: 
                     33: // initialize
                     34: 
1.3     ! paf        35: void initialize_file_class(Pool& pool, VStateless_class& vclass) {
1.1       paf        36:        // ^save[file-name]
                     37:        vclass.add_native_method("save", _save, 1, 1);
                     38: }

E-mail: