File:  [parser3project] / parser3 / src / include / pa_stylesheet_manager.h
Revision 1.15.2.5.2.2: download - view: text, annotated - select for diffs - revision graph
Fri Mar 21 13:42:29 2003 UTC (23 years, 3 months ago) by paf
introducing StringBody [C++ CORD wrapper]

/** @file
	Parser: Stylesheet manager decl.

	Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)
	Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)

	global sql driver manager, must be thread-safe
*/

#ifndef PA_STYLESHEET_MANAGER_H
#define PA_STYLESHEET_MANAGER_H

static const char* IDENT_STYLESHEET_MANAGER_H="$Date: 2003/03/21 13:42:29 $";


#include "pa_hash.h"
#include "pa_table.h"
#include "pa_cache_managers.h"
#include "pa_stack.h"

// forwards

class Stylesheet_connection;
DECLARE_OBJECT_PTR(Stylesheet_connection);

/** XSLT stylesheet driver manager
		maintains 
		stylesheet cache expiring unused stylesheets
*/
class Stylesheet_manager: public Cache_manager {
	friend class Stylesheet_connection;
public:

	Stylesheet_manager();
	override ~Stylesheet_manager();
	/** 
		check for disk update of "{file_spec}" or "{file_spec}.stamp",
		if not updated return cached version[if any] otherwise load/compile/return
	*/
	Stylesheet_connectionPtr get_connection(const String& file_spec);

private: // cache

	Stylesheet_connectionPtr get_connection_from_cache(const String& file_spec);
	void put_connection_to_cache(const String& file_spec, Stylesheet_connectionPtr connection);
private:
	time_t prev_expiration_pass_time;

private: // for stylesheet

	/// caches connection
	void close_connection(const String& file_spec, Stylesheet_connection& connection);

public:
	typedef Hash<String* , object_ptr<Stack<Stylesheet_connectionPtr> > > connection_cache_type;
private:
	connection_cache_type connection_cache;

public: // Cache_manager

	override Value* get_status(const String* source);
	override void maybe_expire_cache();

};

/// global
extern Stylesheet_manager stylesheet_manager;

#endif

E-mail: