void device_image_interface::determine_open_plan(int is_create, UINT32 *open_plan) { int i = 0; /* emit flags */ if (!is_create && is_readable() && is_writeable()) open_plan[i++] = OPEN_FLAG_READ | OPEN_FLAG_WRITE; if (!is_create && !is_readable() && is_writeable()) open_plan[i++] = OPEN_FLAG_WRITE; if (!is_create && is_readable()) open_plan[i++] = OPEN_FLAG_READ; if (is_writeable() && is_creatable()) open_plan[i++] = OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE; open_plan[i] = 0; }
std::vector<UINT32> device_image_interface::determine_open_plan(bool is_create) { std::vector<UINT32> open_plan; // emit flags into a vector if (!is_create && is_readable() && is_writeable()) open_plan.push_back(OPEN_FLAG_READ | OPEN_FLAG_WRITE); if (!is_create && !is_readable() && is_writeable()) open_plan.push_back(OPEN_FLAG_WRITE); if (!is_create && is_readable()) open_plan.push_back(OPEN_FLAG_READ); if (is_create && is_writeable() && is_creatable()) open_plan.push_back(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); return open_plan; }