globals.h

来自「一个symbian 冒险游戏代码」· C头文件 代码 · 共 64 行

H
64
字号
#ifndef _LANG_GLOBALS_H
#define _LANG_GLOBALS_H


#include <lang/MemoryPool.h>
#include <lang/GlobalStorage.h>


namespace lang
{


/** 
 * Globals in lang library.
 */
class Globals
{
public:
	/** User debug flags. */
	int					debug;

	/** String pool used by the String class implementation. */
	lang::MemoryPool	stringPool;

	/** Temporary buffer used by the String::c_str() implementation. */
	char				cstrBuffer[2000];

	/** Temporary buffer index used by the String::c_str() implementation. */
	int					cstrBufferIndex;

	Globals();
	~Globals();

	/**
	 * Initializes the globals.
	 */
	static void			init();

	/**
	 * Releases the resources allocated to the globals.
	 */
	static void			cleanup();

	/**
	 * Returns the globals.
	 */
	static Globals&		get();
};


inline Globals& Globals::get()
{
	lang::GlobalStorage& gs = lang::GlobalStorage::get(); 
	if ( !gs.langGlobals )
		init();
	return *gs.langGlobals;
}


} // lang


#endif // _LANG_GLOBALS_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?