//===- RewriteRope.h - Rope specialized for rewriter ------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines the RewriteRope class, which is a powerful string class. // //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_REWRITEROPE_H #define LLVM_ADT_REWRITEROPE_H #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringRef.h" #include <cassert> #include <cstddef> #include <iterator> #include <utility> namespace llvm { //===--------------------------------------------------------------------===// // RopeRefCountString Class //===--------------------------------------------------------------------===// /// RopeRefCountString - This struct is allocated with 'new char[]' from the /// heap, and represents a reference counted chunk of string data. When its /// ref count drops to zero, it is delete[]'d. This is primarily managed /// through the RopePiece class below. struct RopeRefCountString { … }; //===--------------------------------------------------------------------===// // RopePiece Class //===--------------------------------------------------------------------===// /// RopePiece - This class represents a view into a RopeRefCountString object. /// This allows references to string data to be efficiently chopped up and /// moved around without having to push around the string data itself. /// /// For example, we could have a 1M RopePiece and want to insert something /// into the middle of it. To do this, we split it into two RopePiece objects /// that both refer to the same underlying RopeRefCountString (just with /// different offsets) which is a nice constant time operation. struct RopePiece { … }; //===--------------------------------------------------------------------===// // RopePieceBTreeIterator Class //===--------------------------------------------------------------------===// /// RopePieceBTreeIterator - This class provides read-only forward iteration /// over bytes that are in a RopePieceBTree. This first iterates over bytes /// in a RopePiece, then iterates over RopePiece's in a RopePieceBTreeLeaf, /// then iterates over RopePieceBTreeLeaf's in a RopePieceBTree. class RopePieceBTreeIterator { … }; //===--------------------------------------------------------------------===// // RopePieceBTree Class //===--------------------------------------------------------------------===// class RopePieceBTree { … }; //===--------------------------------------------------------------------===// // RewriteRope Class //===--------------------------------------------------------------------===// /// RewriteRope - A powerful string class. This class supports extremely /// efficient insertions and deletions into the middle of it, even for /// ridiculously long strings. class RewriteRope { … }; } // namespace llvm #endif // LLVM_ADT_REWRITEROPE_H