diff --git a/src/ccutil/list.h b/src/ccutil/list.h deleted file mode 100644 index e5e6e2e8..00000000 --- a/src/ccutil/list.h +++ /dev/null @@ -1,68 +0,0 @@ -/********************************************************************** - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** http://www.apache.org/licenses/LICENSE-2.0 - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - * - **********************************************************************/ - -#ifndef LIST_ITERATOR_H -#define LIST_ITERATOR_H - -#include - -namespace tesseract { - -template -struct X_ITER : ITERATOR { - X_ITER() = default; - template - X_ITER(U *list) : ITERATOR(list) {} - - CLASSNAME *data() { - return static_cast(ITERATOR::data()); - } - CLASSNAME *data_relative(int8_t offset) { - return static_cast(ITERATOR::data_relative(offset)); - } - CLASSNAME *forward() { - return static_cast(ITERATOR::forward()); - } - CLASSNAME *extract() { - return static_cast(ITERATOR::extract()); - } -}; - -template -struct X_LIST : CONTAINER { - X_LIST() = default; - X_LIST(const X_LIST &) = delete; - X_LIST &operator=(const X_LIST &) = delete; - ~X_LIST() { - clear(); - } - - /* delete elements */ - void clear() { - CONTAINER::internal_clear([](void *link) {delete reinterpret_cast(link);}); - } - - /* Become a deep copy of src_list */ - template - void deep_copy(const U *src_list, CLASSNAME *(*copier)(const CLASSNAME *)) { - X_ITER from_it(const_cast(src_list)); - X_ITER to_it(this); - - for (from_it.mark_cycle_pt(); !from_it.cycled_list(); from_it.forward()) - to_it.add_after_then_move((*copier)(from_it.data())); - } -}; - -} // namespace tesseract - -#endif