Property.cpp 616 B

123456789101112131415161718192021222324252627282930313233
  1. #include "../../Include/RmlUi/Core/Property.h"
  2. #include "../../Include/RmlUi/Core/PropertyDefinition.h"
  3. namespace Rml {
  4. Property::Property() : unit(Unit::UNKNOWN), specificity(-1)
  5. {
  6. definition = nullptr;
  7. parser_index = -1;
  8. }
  9. String Property::ToString() const
  10. {
  11. if (!definition)
  12. return value.Get<String>() + Rml::ToString(unit);
  13. String string;
  14. definition->GetValue(string, *this);
  15. return string;
  16. }
  17. NumericValue Property::GetNumericValue() const
  18. {
  19. NumericValue result;
  20. if (Any(unit & Unit::NUMERIC))
  21. {
  22. if (value.GetInto(result.number))
  23. result.unit = unit;
  24. }
  25. return result;
  26. }
  27. } // namespace Rml