Add new PROTECTED property attribute

This commit is contained in:
James Turner
2018-02-04 16:42:33 +00:00
parent bc63381fb0
commit ed5372f439
3 changed files with 7 additions and 3 deletions

View File

@@ -827,7 +827,7 @@ SGPropertyNode::trace_read () const
* Last used attribute
* Update as needed when enum Attribute is changed
*/
const int SGPropertyNode::LAST_USED_ATTRIBUTE = PRESERVE;
const int SGPropertyNode::LAST_USED_ATTRIBUTE = PROTECTED;
/**
* Default constructor: always creates a root node.

View File

@@ -814,7 +814,8 @@ public:
TRACE_READ = 16,
TRACE_WRITE = 32,
USERARCHIVE = 64,
PRESERVE = 128
PRESERVE = 128,
PROTECTED = 1 << 8,
// beware: if you add another attribute here,
// also update value of "LAST_USED_ATTRIBUTE".
};
@@ -1854,7 +1855,7 @@ private:
mutable std::string _buffer;
simgear::props::Type _type;
bool _tied;
int _attr;
int _attr = NO_ATTR;
// The right kind of pointer...
union {

View File

@@ -251,6 +251,9 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts)
setFlag(mode, SGPropertyNode::USERARCHIVE, val, location);
else if( att_name == "preserve" )
setFlag(mode, SGPropertyNode::PRESERVE, val, location);
// note we intentionally don't handle PROTECTED here, it's
// designed to be only set from compiled code, not loaded
// dynamically.
// Check for an alias.
else if( att_name == "alias" )