Annotation of parser3/src/main/pa_stylesheet_connection.C, revision 1.6
1.1 paf 1: /** @file
2: Parser: Stylesheet connection implementation.
3:
1.6 ! misha 4: Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com)
1.1 paf 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
1.6 ! misha 10: static const char * const IDENT_STYLESHEET_CONNECTION_C="$Date: 2006/04/09 13:38:47 $";
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: }
1.4 paf 27: if(xmlHaveGenericErrors())
28: throw XmlException(new String(ffile_spec, String::L_TAINTED));
1.1 paf 29: if(!nstylesheet)
30: throw Exception("file.missing",
31: new String(ffile_spec, String::L_TAINTED),
32: "stylesheet failed to load");
33:
34: xsltFreeStylesheet(fstylesheet);
35: fstylesheet=nstylesheet;
36: prev_disk_time=new_disk_time;
37: }
38:
1.6 ! misha 39: static void update_max_mtime(HashStringValue::key_type stat_file_spec_cstr, bool /*value*/, time_t* max) {
1.1 paf 40: size_t size;
41: time_t atime, mtime, ctime;
42: file_stat(*new String(stat_file_spec_cstr, String::L_AS_IS),
43: size,
44: atime, mtime, ctime,
45: true/*exception on error*/);
46:
47: if(mtime>*max)
48: *max=mtime;
49: }
50:
51: time_t Stylesheet_connection::get_disk_time() {
52: assert(dependencies);
53:
54: time_t result=0;
1.5 paf 55: dependencies->for_each<time_t*>(update_max_mtime, &result);
1.1 paf 56: return result;
57: }
1.2 paf 58:
59: #endif
E-mail: