/*
	$Id: resource_manager.h,v 1.2 2003/08/22 20:26:21 grumbel Exp $

	------------------------------------------------------------------------
	ClanLib, the platform independent game SDK.

	This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
	version 2. See COPYING for details.

	For a total list of contributers see CREDITS.

	------------------------------------------------------------------------
*/

#ifndef RESOURCE_MANAGER_H_
#define RESOURCE_MANAGER_H_


#include <vector>
#include "resource_manager.h"
#include "resourceoptions.h"
#include "resource_tokenizer.h"

#define default_scriptfile_id "_script_section"

class ResourceTree;

class ResourceManager
{
public:
	ResourceManager(std::vector<char>& buffer, ResourceTree* t);

	~ResourceManager();

private:
	void parse();

	void parse_include(ResourceTokenizer &lexer);
	
	void parse_section_body(
		std::string token,
		ResourceTokenizer &lexer,
		std::string prefix);

	//: Returns the filename part of a pathname. Eg. returns "filename.tga" if given string "/blabla/filename.tga".
	static std::string get_filename(const std::string &pathname);

	//: Returns the path part of a pathname. Eg. returns "/blabla/" if given string "/blabla/filename.tga".
	static std::string get_path(const std::string &pathname);

	std::vector<char> config_file_data;

	ResourceTree* tree;
};

#endif
