I've now modified the property-manager interface to use const char *
instead of std::string throughout the public interface (string is
still used internally for a few special purposes). I don't expect
that people will see any big performance improvements yet, both
because the property code doesn't use a big proportion of CPU time
anyway and because I have not yet put in a new hashing function for
path-based lookups.
I've fixed everything I could find in the code base (engine sound
isn't working, but it wasn't working before my mods either), but there
are a couple of changes people should note for writing new code
against the property manager:
1. Using == with a node name or a string value will not report a
compile error, but it will usually fail. The easiest quick patch
is to change constructions like
if (node->getName() == "foo") ...
if (node->getStringValue() == "bar") ...
to
if (string(node->getName()) == "foo") ...
if (string(node->getStringValue()) == "bar") ..
or, if you're going to be using the name or value a lot,
string name = node->getName();
if (name == "foo") ...
else if (name == "foo2") ...
else if (name == "foo3") ...
2. When looking up a property by name, you cannot simply pass an
std::string any more; instead, you'll have to use the c_ctr()
method. This used to work:
string name = "foo";
node->setStringValue(name);
Now, you'll have to use
string name = "foo";
node->setStringValue(name.c_str());
That's pretty much it.
All the best,
David
--
David Megginson
[EMAIL PROTECTED]
_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel