------------------------------------------------------------------------------------------------ fetch a property table and the corresponding property template
| 92 | // ------------------------------------------------------------------------------------------------ |
| 93 | // fetch a property table and the corresponding property template |
| 94 | std::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc, |
| 95 | const std::string& templateName, |
| 96 | const Element &element, |
| 97 | const Scope& sc, |
| 98 | bool no_warn /*= false*/) { |
| 99 | const Element* const Properties70 = sc["Properties70"]; |
| 100 | std::shared_ptr<const PropertyTable> templateProps = std::shared_ptr<const PropertyTable>( |
| 101 | static_cast<const PropertyTable *>(nullptr)); |
| 102 | |
| 103 | if (templateName.length()) { |
| 104 | PropertyTemplateMap::const_iterator it = doc.Templates().find(templateName); |
| 105 | if(it != doc.Templates().end()) { |
| 106 | templateProps = (*it).second; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | if (!Properties70 || !Properties70->Compound()) { |
| 111 | if(!no_warn) { |
| 112 | DOMWarning("property table (Properties70) not found",&element); |
| 113 | } |
| 114 | if(templateProps) { |
| 115 | return templateProps; |
| 116 | } else { |
| 117 | return std::make_shared<const PropertyTable>(); |
| 118 | } |
| 119 | } |
| 120 | return std::make_shared<const PropertyTable>(*Properties70,templateProps); |
| 121 | } |
| 122 | |
| 123 | } // !Util |
| 124 | } // !FBX |
no test coverage detected