Annotation of parser3/src/main/pa_stylesheet_connection.C, revision 1.2
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:
1.2 ! paf 8: #include "pa_config_includes.h"
! 9: #ifdef XML
! 10: static const char * const IDENT_STYLESHEET_CONNECTION_C="$Date: 2004/03/25 14:46:19 $";
1.1 paf 11:
12: #include "pa_stylesheet_connection.h"
13: #include "pa_xml_exception.h"
14:
15: void Stylesheet_connection::load(time_t new_disk_time) {
16: xsltStylesheet *nstylesheet;
17: {
18: pa_xmlStartMonitoringDependencies();
19: {
20: int saved=xmlDoValidityCheckingDefaultValue;//
21: xmlDoValidityCheckingDefaultValue=0;//
22: nstylesheet=xsltParseStylesheetFile(BAD_CAST ffile_spec.cstr());
23: xmlDoValidityCheckingDefaultValue = saved;//
24: }
25: dependencies=pa_xmlGetDependencies();
26: }
27: if(xmlHaveGenericErrors()) {
28: GdomeException exc=0;
29: throw XmlException(new String(ffile_spec, String::L_TAINTED), exc);
30: }
31: if(!nstylesheet)
32: throw Exception("file.missing",
33: new String(ffile_spec, String::L_TAINTED),
34: "stylesheet failed to load");
35:
36: xsltFreeStylesheet(fstylesheet);
37: fstylesheet=nstylesheet;
38: prev_disk_time=new_disk_time;
39: }
40:
41: static void update_max_mtime(const String::Body stat_file_spec_cstr, bool /*value*/, time_t* max) {
42: size_t size;
43: time_t atime, mtime, ctime;
44: file_stat(*new String(stat_file_spec_cstr, String::L_AS_IS),
45: size,
46: atime, mtime, ctime,
47: true/*exception on error*/);
48:
49: if(mtime>*max)
50: *max=mtime;
51: }
52:
53: time_t Stylesheet_connection::get_disk_time() {
54: assert(dependencies);
55:
56: time_t result=0;
57: dependencies->for_each(update_max_mtime, &result);
58: return result;
59: }
1.2 ! paf 60:
! 61: #endif
E-mail: