--- parser3/src/include/pa_stylesheet_connection.h 2020/12/11 14:03:09 1.46 +++ parser3/src/include/pa_stylesheet_connection.h 2023/09/26 20:49:07 1.49 @@ -1,14 +1,14 @@ /** @file Parser: Stylesheet connection decl. - Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ #ifndef PA_STYLESHEET_CONNECTION_H #define PA_STYLESHEET_CONNECTION_H -#define IDENT_PA_STYLESHEET_CONNECTION_H "$Id: pa_stylesheet_connection.h,v 1.46 2020/12/11 14:03:09 moko Exp $" +#define IDENT_PA_STYLESHEET_CONNECTION_H "$Id: pa_stylesheet_connection.h,v 1.49 2023/09/26 20:49:07 moko Exp $" #include "libxslt/xslt.h" #include "libxslt/xsltInternals.h" @@ -21,7 +21,7 @@ // defines -/** Connection with stylesheet: +/** Connection with stylesheet: remembers time and can figure out that it needs recompilation */ class Stylesheet_connection: public PA_Object { @@ -44,13 +44,13 @@ public: dependencies(0), time_used(0), prev_disk_time(0), - used(0) + used(0) {} - + String::Body file_spec() { return ffile_spec; } bool uncachable() { - return !dependencies/*means they were external*/; + return !dependencies /*means they were external*/; } bool expired(time_t older_dies) { @@ -58,17 +58,17 @@ public: } time_t get_time_used() { return time_used; } - void disconnect() { - xsltFreeStylesheet(fstylesheet); fstylesheet=0; + void disconnect() { + fstylesheet=0; } bool connected() { return fstylesheet!=0; } - xsltStylesheet *stylesheet() { + xsltStylesheet *stylesheet() { time_t new_disk_time=0; if(uncachable() || (new_disk_time=get_new_disk_time())) load(new_disk_time); - return fstylesheet; + return fstylesheet; } private: @@ -89,10 +89,12 @@ private: private: // connection usage methods int used; + void use() { time_used=time(0); // they started to use at this time used++; } + void unuse() { used--; if(!used)