PageRenderTime 162ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/lldaycyclemanager.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 84 lines | 37 code | 15 blank | 32 comment | 0 complexity | 2d32a4db0168100743b234cf15cc79f1 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lldaycyclemanager.h
  3. * @brief Implementation for the LLDayCycleManager class.
  4. *
  5. * $LicenseInfo:firstyear=2011&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2011, 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 LL_LLDAYCYCLEMANAGER_H
  27. #define LL_LLDAYCYCLEMANAGER_H
  28. #include <map>
  29. #include <string>
  30. #include "llwldaycycle.h"
  31. #include "llwlparammanager.h"
  32. /**
  33. * WindLight day cycles manager class
  34. *
  35. * Provides interface for accessing, loading and saving day cycles.
  36. */
  37. class LLDayCycleManager : public LLSingleton<LLDayCycleManager>
  38. {
  39. LOG_CLASS(LLDayCycleManager);
  40. public:
  41. typedef std::list<std::string> preset_name_list_t;
  42. typedef std::map<std::string, LLWLDayCycle> dc_map_t;
  43. typedef boost::signals2::signal<void()> modify_signal_t;
  44. void getPresetNames(preset_name_list_t& names) const;
  45. void getPresetNames(preset_name_list_t& user, preset_name_list_t& sys) const;
  46. void getUserPresetNames(preset_name_list_t& user) const;
  47. bool getPreset(const std::string name, LLWLDayCycle& day_cycle) const;
  48. bool getPreset(const std::string name, LLSD& day_cycle) const;
  49. bool presetExists(const std::string name) const;
  50. bool isSystemPreset(const std::string& name) const;
  51. bool savePreset(const std::string& name, const LLSD& data);
  52. bool deletePreset(const std::string& name);
  53. /// @return true if there is a day cycle that refers to the sky preset.
  54. bool isSkyPresetReferenced(const std::string& preset_name) const;
  55. /// Emitted when a preset gets added or deleted.
  56. boost::signals2::connection setModifyCallback(const modify_signal_t::slot_type& cb);
  57. private:
  58. friend class LLSingleton<LLDayCycleManager>;
  59. /*virtual*/ void initSingleton();
  60. void loadAllPresets();
  61. void loadPresets(const std::string& dir);
  62. bool loadPreset(const std::string& path);
  63. bool addPreset(const std::string& name, const LLSD& data);
  64. static std::string getSysDir();
  65. static std::string getUserDir();
  66. dc_map_t mDayCycleMap;
  67. modify_signal_t mModifySignal;
  68. };
  69. #endif // LL_LLDAYCYCLEMANAGER_H