// Copyright 2013 Google Inc. All Rights Reserved. #ifndef CDM_BASE_PROPERTIES_H_ #define CDM_BASE_PROPERTIES_H_ #include #include #include "lock.h" #include "wv_cdm_types.h" namespace wvcdm { typedef std::map CdmBooleanPropertiesMap; struct CdmBooleanProperties { std::string name; bool value; }; // This class saves information about features and properties enabled // for a given platform. At initialization it reads in properties from // property_configuration.h. That file specifies features selected for each // platform. Core CDM can then query enabled features though the GetProperty // method and tailor its behaviour in a non-platform specific way. // // Additional features can be added at runtime as long as the key names do // not clash. Also, only boolean properties are supported at this time, though // it should be trivial to in support for other datatypes. class Properties { public: static Properties* GetInstance(); // value argument is only set if the property was found (true is returned) bool GetProperty(std::string& key, bool& value); private: Properties(); ~Properties() {} void SetProperty(std::string& key, bool value); static Properties* instance_; static Lock properties_lock_; CdmBooleanPropertiesMap boolean_properties_; CORE_DISALLOW_COPY_AND_ASSIGN(Properties); }; } // namespace wvcdm #endif // CDM_BASE_PROPERTIES_H_