/***************************************************************************

    supportware
    Copyright (C) 2001-2007 by c.holzheuer
    c.holzheuer@sourceworx.org

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

***************************************************************************/


#ifndef DDWEBREDIRECTMAP_H
#define DDWEBREDIRECTMAP_H

#include <ddstringrow.h>
#include <ddthreadmutex.h>
#include <ddmaprow.h>
#include <ddwebrequest.h>


/// ddwebaliasmap: Liste mit aliaslinks: Alias: /fresh/ntldr_fehlt.html  Link: /faqsthread/869
/**
	ddwebaliasmap: Liste mit aliaslinks: Alias: /fresh/ntldr_fehlt.html  Link: /faqsthread/869,
	Also quasi ein neuer name, der alte name ist nicht mehr sichtbar.
*/

class ddwebaliasmap : public ddbaseobject
{

public:

	ddwebaliasmap()
	{
	}

	virtual ~ddwebaliasmap()
	{
	}
	
	void from_string( const ddstring& src );	
	ddstring to_string() const;

	bool prepare_request_redirect( ddwebrequest& request );	
	
	inline bool is_alias( const ddstring& path ) const
	{
		return _old2new.contains_key( path );
	}
	
	inline ddstring& get_alias( const ddstring& path )
	{
		return _old2new[ path ];
	}

	inline ddstringmap& get_aliases()
	{
		return _new2old;
	}
	
	void add_entry( const ddstring& alias, const ddstring& link );
	void drop_entry( const ddstring& alias );
	
protected:

	ddstringmap _new2old;
	ddstringmap _old2new;

};


/***************************************************************************

    supportware
    Copyright (C) 2001-2007 by c.holzheuer
    c.holzheuer@sourceworx.org

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

***************************************************************************/


/// ddwebredirectmap: Liste mit redirects: z.B.: Alter Link: /articlethread/17  Neues Ziel: /faqsthread/869
/**
	ddwebredirectmap: Liste mit redirects: z.B.: Alter Link: /articlethread/17  Neues Ziel: /faqsthread/869	
*/

class ddwebredirectmap : public ddstringmap
{

public:

	ddwebredirectmap()
	{
	}

	virtual ~ddwebredirectmap()
	{
	}
	
	void from_string( const ddstring& src );	
	ddstring to_string() const;



};


#endif
