⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elst2.h

📁 一OCR的相关资料。.希望对研究OCR的朋友有所帮助.
💻 H
📖 第 1 页 / 共 3 页
字号:
    STILL_LINKED.error ("ELIST2_ITERATOR::add_after_stay_put", ABORT, NULL);  #endif  if (list->empty ()) {    new_element->next = new_element;    new_element->prev = new_element;    list->last = new_element;    prev = next = new_element;    ex_current_was_last = FALSE;    current = NULL;  }  else {    new_element->next = next;    next->prev = new_element;    if (current) {               //not extracted      new_element->prev = current;      current->next = new_element;      if (prev == current)        prev = new_element;      if (current == list->last)        list->last = new_element;    }    else {                       //current extracted      new_element->prev = prev;      prev->next = new_element;      if (ex_current_was_last) {        list->last = new_element;        ex_current_was_last = FALSE;      }    }    next = new_element;  }}/*********************************************************************** *							ELIST2_ITERATOR::add_before_then_move * *  Add a new element to the list before the current element and move the *  iterator to the new element. **********************************************************************/inline void ELIST2_ITERATOR::add_before_then_move(  // element to add                                                  ELIST2_LINK *new_element) {  #ifdef _DEBUG  if (!this)    NULL_OBJECT.error ("ELIST2_ITERATOR::add_before_then_move", ABORT, NULL);  if (!list)    NO_LIST.error ("ELIST2_ITERATOR::add_before_then_move", ABORT, NULL);  if (!new_element)    BAD_PARAMETER.error ("ELIST2_ITERATOR::add_before_then_move", ABORT,      "new_element is NULL");  if (new_element->next)    STILL_LINKED.error ("ELIST2_ITERATOR::add_before_then_move", ABORT, NULL);  #endif  if (list->empty ()) {    new_element->next = new_element;    new_element->prev = new_element;    list->last = new_element;    prev = next = new_element;  }  else {    prev->next = new_element;    new_element->prev = prev;    if (current) {               //not extracted      new_element->next = current;      current->prev = new_element;      next = current;    }    else {                       //current extracted      new_element->next = next;      next->prev = new_element;      if (ex_current_was_last)        list->last = new_element;      if (ex_current_was_cycle_pt)        cycle_pt = new_element;    }  }  current = new_element;}/*********************************************************************** *							ELIST2_ITERATOR::add_before_stay_put * *  Add a new element to the list before the current element but dont move the *  iterator to the new element. **********************************************************************/inline void ELIST2_ITERATOR::add_before_stay_put(  // element to add                                                 ELIST2_LINK *new_element) {  #ifdef _DEBUG  if (!this)    NULL_OBJECT.error ("ELIST2_ITERATOR::add_before_stay_put", ABORT, NULL);  if (!list)    NO_LIST.error ("ELIST2_ITERATOR::add_before_stay_put", ABORT, NULL);  if (!new_element)    BAD_PARAMETER.error ("ELIST2_ITERATOR::add_before_stay_put", ABORT,      "new_element is NULL");  if (new_element->next)    STILL_LINKED.error ("ELIST2_ITERATOR::add_before_stay_put", ABORT, NULL);  #endif  if (list->empty ()) {    new_element->next = new_element;    new_element->prev = new_element;    list->last = new_element;    prev = next = new_element;    ex_current_was_last = TRUE;    current = NULL;  }  else {    prev->next = new_element;    new_element->prev = prev;    if (current) {               //not extracted      new_element->next = current;      current->prev = new_element;      if (next == current)        next = new_element;    }    else {                       //current extracted      new_element->next = next;      next->prev = new_element;      if (ex_current_was_last)        list->last = new_element;    }    prev = new_element;  }}/*********************************************************************** *							ELIST2_ITERATOR::add_list_after * *  Insert another list to this list after the current element but dont move the *  iterator. **********************************************************************/inline void ELIST2_ITERATOR::add_list_after(ELIST2 *list_to_add) {  #ifdef _DEBUG  if (!this)    NULL_OBJECT.error ("ELIST2_ITERATOR::add_list_after", ABORT, NULL);  if (!list)    NO_LIST.error ("ELIST2_ITERATOR::add_list_after", ABORT, NULL);  if (!list_to_add)    BAD_PARAMETER.error ("ELIST2_ITERATOR::add_list_after", ABORT,      "list_to_add is NULL");  #endif  if (!list_to_add->empty ()) {    if (list->empty ()) {      list->last = list_to_add->last;      prev = list->last;      next = list->First ();      ex_current_was_last = TRUE;      current = NULL;    }    else {      if (current) {             //not extracted        current->next = list_to_add->First ();        current->next->prev = current;        if (current == list->last)          list->last = list_to_add->last;        list_to_add->last->next = next;        next->prev = list_to_add->last;        next = current->next;      }      else {                     //current extracted        prev->next = list_to_add->First ();        prev->next->prev = prev;        if (ex_current_was_last) {          list->last = list_to_add->last;          ex_current_was_last = FALSE;        }        list_to_add->last->next = next;        next->prev = list_to_add->last;        next = prev->next;      }    }    list_to_add->last = NULL;  }}/*********************************************************************** *							ELIST2_ITERATOR::add_list_before * *  Insert another list to this list before the current element. Move the *  iterator to the start of the inserted elements *  iterator. **********************************************************************/inline void ELIST2_ITERATOR::add_list_before(ELIST2 *list_to_add) {  #ifdef _DEBUG  if (!this)    NULL_OBJECT.error ("ELIST2_ITERATOR::add_list_before", ABORT, NULL);  if (!list)    NO_LIST.error ("ELIST2_ITERATOR::add_list_before", ABORT, NULL);  if (!list_to_add)    BAD_PARAMETER.error ("ELIST2_ITERATOR::add_list_before", ABORT,      "list_to_add is NULL");  #endif  if (!list_to_add->empty ()) {    if (list->empty ()) {      list->last = list_to_add->last;      prev = list->last;      current = list->First ();      next = current->next;      ex_current_was_last = FALSE;    }    else {      prev->next = list_to_add->First ();      prev->next->prev = prev;      if (current) {             //not extracted        list_to_add->last->next = current;        current->prev = list_to_add->last;      }      else {                     //current extracted        list_to_add->last->next = next;        next->prev = list_to_add->last;        if (ex_current_was_last)          list->last = list_to_add->last;        if (ex_current_was_cycle_pt)          cycle_pt = prev->next;      }      current = prev->next;      next = current->next;    }    list_to_add->last = NULL;  }}/*********************************************************************** *							ELIST2_ITERATOR::extract * *  Do extraction by removing current from the list, returning it to the *  caller, but NOT updating the iterator.  (So that any calling loop can do *  this.)   The iterator's current points to NULL.  If the extracted element *  is to be deleted, this is the callers responsibility. **********************************************************************/inline ELIST2_LINK *ELIST2_ITERATOR::extract() {  ELIST2_LINK *extracted_link;  #ifdef _DEBUG  if (!this)    NULL_OBJECT.error ("ELIST2_ITERATOR::extract", ABORT, NULL);  if (!list)    NO_LIST.error ("ELIST2_ITERATOR::extract", ABORT, NULL);  if (!current)                  //list empty or                                 //element extracted    NULL_CURRENT.error ("ELIST2_ITERATOR::extract",      ABORT, NULL);  #endif  if (list->singleton ())        //special case where                                 //we do need to    prev = next = list->last = NULL;  //change the iterator  else {    prev->next = next;           //remove from list    next->prev = prev;    if (current == list->last) {      list->last = prev;      ex_current_was_last = TRUE;    }    else      ex_current_was_last = FALSE;    ex_current_was_cycle_pt = (current == cycle_pt) ? TRUE : FALSE;  }  extracted_link = current;  extracted_link->next = NULL;   //for safety  extracted_link->prev = NULL;   //for safety  current = NULL;  return extracted_link;}/*********************************************************************** *							ELIST2_ITERATOR::move_to_first() * *  Move current so that it is set to the start of the list. *  Return data just in case anyone wants it. **********************************************************************/inline ELIST2_LINK *ELIST2_ITERATOR::move_to_first() {  #ifdef _DEBUG  if (!this)    NULL_OBJECT.error ("ELIST2_ITERATOR::move_to_first", ABORT, NULL);  if (!list)    NO_LIST.error ("ELIST2_ITERATOR::move_to_first", ABORT, NULL);  #endif  current = list->First ();  prev = list->last;  next = current ? current->next : NULL;  return current;}/*********************************************************************** *							ELIST2_ITERATOR::move_to_last() * *  Move current so that it is set to the end of the list. *  Return data just in case anyone wants it. **********************************************************************/inline ELIST2_LINK *ELIST2_ITERATOR::move_to_last() {  #ifdef _DEBUG  if (!this)    NULL_OBJECT.error ("ELIST2_ITERATOR::move_to_last", ABORT, NULL);  if (!list)    NO_LIST.error ("ELIST2_ITERATOR::move_to_last", ABORT, NULL);  #endif  current = list->last;  prev = current ? current->prev : NULL;  next = current ? current->next : NULL;  return current;}/*********************************************************************** *							ELIST2_ITERATOR::mark_cycle_pt() * *  Remember the current location so that we can tell whether we've returned *  to this point later. * *  If the current point is deleted either now, or in the future, the cycle *  point will be set to the next item which is set to current.  This could be *  by a forward, add_after_then_move or add_after_then_move. **********************************************************************/inline void ELIST2_ITERATOR::mark_cycle_pt() {  #ifdef _DEBUG  if (!this)    NULL_OBJECT.error ("ELIST2_ITERATOR::mark_cycle_pt", ABORT, NULL);  if (!list)    NO_LIST.error ("ELIST2_ITERATOR::mark_cycle_pt", ABORT, NULL);  #endif  if (current)    cycle_pt = current;  else    ex_current_was_cycle_pt = TRUE;  started_cycling = FALSE;}/*********************************************************************** *							ELIST2_ITERATOR::at_first() * *  Are we at the start of the list? * **********************************************************************/inline BOOL8 ELIST2_ITERATOR::at_first() {  #ifdef _DEBUG  if (!this)    NULL_OBJECT.error ("ELIST2_ITERATOR::at_first", ABORT, NULL);  if (!list)    NO_LIST.error ("ELIST2_ITERATOR::at_first", ABORT, NULL);  #endif                                 //we're at a deleted  return ((list->empty ()) || (current == list->First ()) || ((current == NULL) &&    (prev == list->last) &&      //NON-last pt between    !ex_current_was_last));      //first and last}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -