| 654 | } |
| 655 | |
| 656 | emscripten::val ReadValue(uint32_t modelID, webifc::parsing::IfcTokenType t) |
| 657 | { |
| 658 | auto loader = manager.GetIfcLoader(modelID); |
| 659 | switch (t) |
| 660 | { |
| 661 | case webifc::parsing::IfcTokenType::STRING: |
| 662 | { |
| 663 | return emscripten::val(loader->GetDecodedStringArgument()); |
| 664 | } |
| 665 | case webifc::parsing::IfcTokenType::ENUM: |
| 666 | { |
| 667 | std::string_view s = loader->GetStringArgument(); |
| 668 | if (s == "T") |
| 669 | { |
| 670 | return emscripten::val(true); |
| 671 | } |
| 672 | if (s == "F") |
| 673 | { |
| 674 | return emscripten::val(false); |
| 675 | } |
| 676 | if (s == "U") |
| 677 | { |
| 678 | return emscripten::val::undefined(); |
| 679 | } |
| 680 | return emscripten::val(std::string(s)); |
| 681 | } |
| 682 | case webifc::parsing::IfcTokenType::REAL: |
| 683 | { |
| 684 | std::string_view s = loader->GetDoubleArgumentAsString(); |
| 685 | return emscripten::val(std::string(s)); |
| 686 | } |
| 687 | case webifc::parsing::IfcTokenType::INTEGER: |
| 688 | { |
| 689 | long d = loader->GetIntArgument(); |
| 690 | return emscripten::val(d); |
| 691 | } |
| 692 | case webifc::parsing::IfcTokenType::REF: |
| 693 | { |
| 694 | uint32_t ref = loader->GetRefArgument(); |
| 695 | return emscripten::val(ref); |
| 696 | } |
| 697 | default: |
| 698 | // use undefined to signal val parse issue |
| 699 | return emscripten::val::undefined(); |
| 700 | } |
| 701 | } |
| 702 | |
| 703 | emscripten::val GetArgs(uint32_t modelID, bool inObject = false, bool inList = false) |
| 704 | { |
no test coverage detected