PropertyTree.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef ANKI_MISC_PROPERTY_TREE_H
  2. #define ANKI_MISC_PROPERTY_TREE_H
  3. #include <boost/optional.hpp>
  4. #include <boost/property_tree/ptree_fwd.hpp>
  5. #include "anki/math/Math.h"
  6. namespace anki {
  7. namespace PropertyTree {
  8. /// Get a bool from a ptree or throw exception if not found or incorrect.
  9. /// Get something like this: @code<tag>true</tag>@endcode
  10. /// @param[in] pt The ptree
  11. /// @param[in] tag The name of tha tag
  12. extern bool getBool(const boost::property_tree::ptree& pt, const char* tag);
  13. /// Optionaly get a bool from a ptree and throw exception incorrect.
  14. /// Get something like this: @code<tag>true</tag>@endcode
  15. /// @param[in] pt The ptree
  16. /// @param[in] tag The name of tha tag
  17. extern boost::optional<bool> getBoolOptional(
  18. const boost::property_tree::ptree& pt, const char* tag);
  19. /// Get a @code<float>0.0</float>@endcode
  20. extern float getFloat(const boost::property_tree::ptree& pt);
  21. /// Get a @code<vec2><x>0.0</x><y>0.0</y></vec2>@endcode
  22. extern Vec2 getVec2(const boost::property_tree::ptree& pt);
  23. /// Get a @code<vec3><x>0.0</x><y>0.0</y><z>0.0</z></vec3>@endcode
  24. extern Vec3 getVec3(const boost::property_tree::ptree& pt);
  25. /// Get a @code<vec4><x>0.0</x><y>0.0</y><z>0.0</z><w>0.0</w></vec4>@endcode
  26. extern Vec4 getVec4(const boost::property_tree::ptree& pt);
  27. } // end namespace
  28. } // end namespace
  29. #endif