Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void update_data() {
- vector_listbox->Items->Clear(); // clearing the elements
- list_listbox->Items->Clear();
- if (GL_SHOW_FULL_ARRAYS) // ensure if we want to see full version (takes longer to render)
- {
- if (GL_VECTOR.size() == 0) vector_listbox->Items->Insert(vector_listbox->Items->Count, "empty"); // for vector full
- else for (auto el : GL_VECTOR) vector_listbox->Items->Insert(vector_listbox->Items->Count, cs(el));
- if (GL_LIST.size() == 0) list_listbox->Items->Insert(list_listbox->Items->Count, "empty"); // for list full
- else for (auto el : GL_LIST) list_listbox->Items->Insert(list_listbox->Items->Count, cs(el));
- }
- else // if we using partial representation of arrays
- {
- if (GL_VECTOR.size() == 0) vector_listbox->Items->Insert(vector_listbox->Items->Count, "empty"); // for vector
- else {
- for (size_t i = 0; i < GL_SHOWN_LENGTH - 2; i++)
- vector_listbox->Items->Insert(vector_listbox->Items->Count, cs(s(i) + ": " + s(GL_VECTOR.at(i))));
- vector_listbox->Items->Insert(vector_listbox->Items->Count, "...");
- vector_listbox->Items->Insert(vector_listbox->Items->Count, cs(s(GL_VECTOR.size() - 1) + ": " + s(GL_VECTOR.back())));
- }
- if (GL_LIST.size() == 0) list_listbox->Items->Insert(list_listbox->Items->Count, "empty"); // for list
- else {
- auto it = GL_LIST.begin();
- for (size_t i = 0; i < GL_SHOWN_LENGTH - 2; i++)
- list_listbox->Items->Insert(list_listbox->Items->Count, cs(s(i) + ": " + s(*it++)));
- list_listbox->Items->Insert(list_listbox->Items->Count, "...");
- list_listbox->Items->Insert(list_listbox->Items->Count, cs(s(GL_LIST.size() - 1) + ": " + s(GL_LIST.back())));
- }
- }
- dh("data updated");
- }
Advertisement
Add Comment
Please, Sign In to add comment