| 88 | } |
| 89 | |
| 90 | void Namespace::Remove(const String& field) |
| 91 | { |
| 92 | ObjectLock olock(this); |
| 93 | |
| 94 | if (m_Frozen) { |
| 95 | BOOST_THROW_EXCEPTION(ScriptError("Namespace is read-only and must not be modified.")); |
| 96 | } |
| 97 | |
| 98 | std::unique_lock<decltype(m_DataMutex)> dlock (m_DataMutex); |
| 99 | |
| 100 | auto it = m_Data.find(field); |
| 101 | |
| 102 | if (it == m_Data.end()) { |
| 103 | return; |
| 104 | } |
| 105 | |
| 106 | if (it->second.Const) { |
| 107 | BOOST_THROW_EXCEPTION(ScriptError("Constants must not be removed.")); |
| 108 | } |
| 109 | |
| 110 | m_Data.erase(it); |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Freeze the namespace, preventing further updates. |
nothing calls this directly
no test coverage detected