PageRenderTime 22ms CodeModel.GetById 11ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/llcallbackmap.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 58 lines | 24 code | 8 blank | 26 comment | 0 complexity | 59999f9d8cab2b9ad38f083a3f70d66f MD5 | raw file
 1/** 
 2 * @file llcallbackmap.h
 3 * @brief LLCallbackMap base class
 4 *
 5 * $LicenseInfo:firstyear=2006&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#ifndef LLCALLBACKMAP_H
28#define LLCALLBACKMAP_H
29
30#include <map>
31#include <string>
32#include <boost/function.hpp>
33
34class LLCallbackMap
35{
36public:
37	// callback definition.
38	typedef boost::function<void* (void* data)> callback_t;
39	
40	typedef std::map<std::string, LLCallbackMap> map_t;
41	typedef map_t::iterator map_iter_t;
42	typedef map_t::const_iterator map_const_iter_t;
43	
44	template <class T>
45	static void* buildPanel(void* data)
46	{
47		T* panel = new T();
48		return (void*)panel;
49	}
50	
51	LLCallbackMap() : mCallback(NULL), mData(NULL) { }
52	LLCallbackMap(callback_t callback, void* data = NULL) : mCallback(callback), mData(data) { }
53
54	callback_t	mCallback;
55	void*		mData;
56};
57
58#endif // LLCALLBACKMAP_H