First blood
This commit is contained in:
1 parent
04f270f322
commit
5720f8322b
250 files changed
+33215
No files matched your search
@@ -0,0 +1,56 @@
|
||||
#ifndef SMART_VALUE_MANAGER_H_INCLUDED
|
||||
#define SMART_VALUE_MANAGER_H_INCLUDED
|
||||
|
||||
#include "include/Utils/Utils.h"
|
||||
|
||||
#pragma warning(disable: 4503) //ololo, DisctionariesMap expands into looong boolshit
|
||||
|
||||
namespace SE
|
||||
{
|
||||
|
||||
typedef boost::variant<
|
||||
std::shared_ptr<TBindableVar<int>>,
|
||||
std::shared_ptr<TBindableVar<float>>,
|
||||
std::shared_ptr<TBindableVar<bool>>,
|
||||
std::shared_ptr<TBindableVar<std::string>>,
|
||||
std::shared_ptr<TBindableVar<vec2>>,
|
||||
std::shared_ptr<TBindableVar<vec3>>,
|
||||
std::shared_ptr<TBindableVar<vec4>>> TSmartValue;
|
||||
|
||||
|
||||
class TSmartValueManager : public TSerializeInterface
|
||||
{
|
||||
protected:
|
||||
|
||||
std::map<std::string, std::map<std::string, TSmartValue>> DisctionariesMap;
|
||||
|
||||
public:
|
||||
|
||||
TSmartValue& GetSmartValue(const std::string& dictName, const std::string& valueName);
|
||||
|
||||
template<typename TYPENAME>
|
||||
TYPENAME GetImmediateValue(const std::string& dictName, const std::string& valueName)
|
||||
{
|
||||
return (*boost::get<std::shared_ptr<TBindableVar<TYPENAME>>>(GetSmartValue(dictName, valueName)))();
|
||||
}
|
||||
|
||||
template<typename TYPENAME>
|
||||
void SetImmediateValue(const std::string& dictName, const std::string& valueName, TYPENAME value)
|
||||
{
|
||||
*boost::get<std::shared_ptr<TBindableVar<TYPENAME>>>(GetSmartValue(dictName, valueName)) = value;
|
||||
}
|
||||
|
||||
template<typename TYPENAME>
|
||||
boost::signal<void(const TYPENAME&)>& GetSignal(const std::string& dictName, const std::string& valueName)
|
||||
{
|
||||
return boost::get<std::shared_ptr<TBindableVar<TYPENAME>>>(GetSmartValue(dictName, valueName))->OnVarChanged;
|
||||
}
|
||||
|
||||
virtual void Serialize(boost::property_tree::ptree& propertyTree);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} //namespace SE
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user