| 459 | } |
| 460 | |
| 461 | Attribute_ID FindOrAddAttribute |
| 462 | ( |
| 463 | GraphContext *gc, // graph context to add the attribute |
| 464 | const char *attribute, // attribute name |
| 465 | bool log // should operation be logged in the undo-log |
| 466 | ) { |
| 467 | ASSERT(gc != NULL); |
| 468 | ASSERT(attribute != NULL); |
| 469 | |
| 470 | bool created; |
| 471 | Attribute_ID attr_id = GraphContext_FindOrAddAttribute(gc, attribute, |
| 472 | &created); |
| 473 | |
| 474 | // in case there was an append, the latest id should be tracked |
| 475 | if(created == true && log == true) { |
| 476 | UndoLog undo_log = QueryCtx_GetUndoLog(); |
| 477 | UndoLog_AddAttribute(undo_log, attr_id); |
| 478 | EffectsBuffer *eb = QueryCtx_GetEffectsBuffer(); |
| 479 | EffectsBuffer_AddNewAttributeEffect(eb, attribute); |
| 480 | } |
| 481 | |
| 482 | return attr_id; |
| 483 | } |
| 484 |
no test coverage detected