Annotation of parser3/src/main/pa_stylesheet_connection.C, revision 1.1
1.1 ! paf 1: /** @file
! 2: Parser: Stylesheet connection implementation.
! 3:
! 4: Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com)
! 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
! 6: */
! 7:
! 8: static const char * const IDENT_STYLESHEET_CONNECTION_C="$Date: 2004/02/11 15:33:16 $";
! 9:
! 10: #include "pa_config_includes.h"
! 11: #include "pa_stylesheet_connection.h"
! 12: #include "pa_xml_exception.h"
! 13:
! 14: void Stylesheet_connection::load(time_t new_disk_time) {
! 15: xsltStylesheet *nstylesheet;
! 16: {
! 17: pa_xmlStartMonitoringDependencies();
! 18: {
! 19: int saved=xmlDoValidityCheckingDefaultValue;//
! 20: xmlDoValidityCheckingDefaultValue=0;//
! 21: nstylesheet=xsltParseStylesheetFile(BAD_CAST ffile_spec.cstr());
! 22: xmlDoValidityCheckingDefaultValue = saved;//
! 23: }
! 24: dependencies=pa_xmlGetDependencies();
! 25: }
! 26: if(xmlHaveGenericErrors()) {
! 27: GdomeException exc=0;
! 28: throw XmlException(new String(ffile_spec, String::L_TAINTED), exc);
! 29: }
! 30: if(!nstylesheet)
! 31: throw Exception("file.missing",
! 32: new String(ffile_spec, String::L_TAINTED),
! 33: "stylesheet failed to load");
! 34:
! 35: xsltFreeStylesheet(fstylesheet);
! 36: fstylesheet=nstylesheet;
! 37: prev_disk_time=new_disk_time;
! 38: }
! 39:
! 40: static void update_max_mtime(const String::Body stat_file_spec_cstr, bool /*value*/, time_t* max) {
! 41: size_t size;
! 42: time_t atime, mtime, ctime;
! 43: file_stat(*new String(stat_file_spec_cstr, String::L_AS_IS),
! 44: size,
! 45: atime, mtime, ctime,
! 46: true/*exception on error*/);
! 47:
! 48: if(mtime>*max)
! 49: *max=mtime;
! 50: }
! 51:
! 52: time_t Stylesheet_connection::get_disk_time() {
! 53: assert(dependencies);
! 54:
! 55: time_t result=0;
! 56: dependencies->for_each(update_max_mtime, &result);
! 57: return result;
! 58: }
E-mail: