This patch allows Project::AddToExtension() to select nodes by attributes and clone existing nodes.
The normal behaviour does not change. The API changed to return a result (-1 on fail, 0 on success)
example xml code:
<debugger3> <remote_debugging> <options conn_type="0"> <sub_conn baudrate="4400" /> </options> <options conn_type="4" /> </remote_debugging> </debugger3>
usage example:
Set the attribute "baudrate" of the subnode sub_conn to "32000".
All nodes have to exist:
debugger3/remote_debugging/options:conn_type=0/sub_conn:baudrate=32000
result:
<debugger3> <remote_debugging> <options conn_type="0"> <sub_conn baudrate="32000" /> </options> <options conn_type="4" /> </remote_debugging> </debugger3>
If one node or attribute does not exist add a "+" before the node/attribute name:
debugger3/remote_debugging/options:conn_type=0/sub_conn:+interface=COM1
result:
<debugger3> <remote_debugging> <options conn_type="0"> <sub_conn remote="lala" interface="COM1" /> </options> <options conn_type="4" /> </remote_debugging> </debugger3>
If you want to clone a subnode append a # before the node name (only the node name gets cloned, not the node
debugger3/remote_debugging/options:conn_type=0/#sub_conn:+interface=COM2
result:
<debugger3> <remote_debugging> <options conn_type="0"> <sub_conn remote="lala" interface="COM1" /> <sub_conn interface="COM2" /> </options> <options conn_type="4" /> </remote_debugging> </debugger3>
I can not add a test code because there is no possibility to read XML code from squirrel
There is a additional feature: The project gets marked as changed when you change something, because else it would not be possible to save the project after the xml got changed...
Is #512 duplicate of this ticket?
it is a part of ticket #512. Ticket #512 consists of modifying the parameters of the debugger plugin. As i mentoined in the forum thread the debugger overwrites the xml saveings on project save, so this needs to be fixed also. This part allows to modify the different settings on the xml part (for ex. modifying settings for every target, what was not possible with the old implementation). Missing is the part where the debugger settings get overwritten by the debugger plugin. I still whait for some response on this in the forum thread: http://forums.codeblocks.org/index.php/topic,16852.msg149433.html#msg149433
Why have you changed the function to return int instead of make it return bool?
There should be more return codes:, i forget them in this patch
0 -> All ok
-1 -> We have not found the node and we don't force the add , so this fails
-2 -> The right Attribute has not been found and we are not allowed to add it. We fail
-3 -> Something wrong happened...
X -> It is possible to extend the function without changing the api...
I also fixed some code formating errors in this patch..
Oh, this is unacceptable. Use an enum.
C++11 provides strong typed enums that have a type which marks how much memory will be occupied (uint32_t should be enough as storage)!
any naming convention for the enum?
Not sure. Look in the wiki http://wiki.codeblocks.org/index.php/Coding_style
I think [r11857] makes this patch obsolete. What do you think?
Related
Commit: [r11857]
implemented in [r11857] by fuscated
Related
Commit: [r11857]