diff options
| author | Brian Potchik <brian@vector35.com> | 2025-03-06 19:54:50 -0500 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2025-03-06 19:54:50 -0500 |
| commit | ef97d4703cfd08a4ccc3c00dac7cf84877875245 (patch) | |
| tree | d8687be219e325cd619ada7acfaf694a6627af1c /workflow.cpp | |
| parent | 5192206454838298978583761915446906174711 (diff) | |
Add API to insert Activities after a specified Activity.
Diffstat (limited to 'workflow.cpp')
| -rw-r--r-- | workflow.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/workflow.cpp b/workflow.cpp index 135c029f..3e43707e 100644 --- a/workflow.cpp +++ b/workflow.cpp @@ -415,6 +415,35 @@ bool Workflow::Insert(const string& activity, const vector<string>& activities) } +bool Workflow::InsertAfter(const string& activity, const string& newActivity) +{ + char* buffer[1]; + buffer[0] = BNAllocString(newActivity.c_str()); + + bool result = BNWorkflowInsertAfter(m_object, activity.c_str(), (const char**)buffer, 1); + BNFreeString(buffer[0]); + return result; +} + + +bool Workflow::InsertAfter(const string& activity, const vector<string>& activities) +{ + char** buffer = new char*[activities.size()]; + if (!buffer) + return false; + + for (size_t i = 0; i < activities.size(); i++) + buffer[i] = BNAllocString(activities[i].c_str()); + + bool result = BNWorkflowInsertAfter(m_object, activity.c_str(), (const char**)buffer, activities.size()); + + for (size_t i = 0; i < activities.size(); i++) + BNFreeString(buffer[i]); + delete[] buffer; + return result; +} + + bool Workflow::Remove(const string& activity) { return BNWorkflowRemove(m_object, activity.c_str()); |
