PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LLCALLBACKMAP_H
  27. #define LLCALLBACKMAP_H
  28. #include <map>
  29. #include <string>
  30. #include <boost/function.hpp>
  31. class LLCallbackMap
  32. {
  33. public:
  34. // callback definition.
  35. typedef boost::function<void* (void* data)> callback_t;
  36. typedef std::map<std::string, LLCallbackMap> map_t;
  37. typedef map_t::iterator map_iter_t;
  38. typedef map_t::const_iterator map_const_iter_t;
  39. template <class T>
  40. static void* buildPanel(void* data)
  41. {
  42. T* panel = new T();
  43. return (void*)panel;
  44. }
  45. LLCallbackMap() : mCallback(NULL), mData(NULL) { }
  46. LLCallbackMap(callback_t callback, void* data = NULL) : mCallback(callback), mData(data) { }
  47. callback_t mCallback;
  48. void* mData;
  49. };
  50. #endif // LLCALLBACKMAP_H