neongm

Untitled

Mar 17th, 2021
698
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.75 KB | None | 0 0
  1. void update_data() {
  2.             vector_listbox->Items->Clear(); // clearing the elements
  3.             list_listbox->Items->Clear();
  4.  
  5.             if (GL_SHOW_FULL_ARRAYS) // ensure if we want to see full version (takes longer to render)
  6.             {
  7.                 if (GL_VECTOR.size() == 0) vector_listbox->Items->Insert(vector_listbox->Items->Count, "empty");       // for vector full
  8.                 else for (auto el : GL_VECTOR)  vector_listbox->Items->Insert(vector_listbox->Items->Count, cs(el));
  9.  
  10.                 if (GL_LIST.size() == 0) list_listbox->Items->Insert(list_listbox->Items->Count, "empty");             // for list full
  11.                 else for (auto el : GL_LIST)  list_listbox->Items->Insert(list_listbox->Items->Count, cs(el));
  12.             }
  13.             else // if we using partial representation of arrays
  14.             {
  15.                 if (GL_VECTOR.size() == 0) vector_listbox->Items->Insert(vector_listbox->Items->Count, "empty");             // for vector
  16.                 else {
  17.                     for (size_t i = 0; i < GL_SHOWN_LENGTH - 2; i++)
  18.                         vector_listbox->Items->Insert(vector_listbox->Items->Count, cs(s(i) + ": " + s(GL_VECTOR.at(i))));
  19.                     vector_listbox->Items->Insert(vector_listbox->Items->Count, "...");
  20.                     vector_listbox->Items->Insert(vector_listbox->Items->Count, cs(s(GL_VECTOR.size() - 1) + ": " + s(GL_VECTOR.back())));
  21.                 }
  22.  
  23.                 if (GL_LIST.size() == 0) list_listbox->Items->Insert(list_listbox->Items->Count, "empty");             // for list
  24.                 else {
  25.                     auto it = GL_LIST.begin();
  26.                     for (size_t i = 0; i < GL_SHOWN_LENGTH - 2; i++)
  27.                         list_listbox->Items->Insert(list_listbox->Items->Count, cs(s(i) + ": " + s(*it++)));
  28.                     list_listbox->Items->Insert(list_listbox->Items->Count, "...");
  29.                     list_listbox->Items->Insert(list_listbox->Items->Count, cs(s(GL_LIST.size() - 1) + ": " + s(GL_LIST.back())));
  30.                 }
  31.             }
  32.             dh("data updated");
  33.         }
Advertisement
Add Comment
Please, Sign In to add comment