LLVM 22.0.0git
llvm::RopePiece Struct Reference

RopePiece - This class represents a view into a RopeRefCountString object. More...

#include "llvm/ADT/RewriteRope.h"

Public Member Functions

 RopePiece ()=default
 RopePiece (llvm::IntrusiveRefCntPtr< RopeRefCountString > Str, unsigned Start, unsigned End)
const charoperator[] (unsigned Offset) const
charoperator[] (unsigned Offset)
unsigned size () const

Public Attributes

llvm::IntrusiveRefCntPtr< RopeRefCountStringStrData
unsigned StartOffs = 0
unsigned EndOffs = 0

Detailed Description

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.

Definition at line 59 of file RewriteRope.h.

Constructor & Destructor Documentation

◆ RopePiece() [1/2]

llvm::RopePiece::RopePiece ( )
default

◆ RopePiece() [2/2]

llvm::RopePiece::RopePiece ( llvm::IntrusiveRefCntPtr< RopeRefCountString > Str,
unsigned Start,
unsigned End )
inline

Definition at line 65 of file RewriteRope.h.

References EndOffs, llvm::move(), StartOffs, and StrData.

Member Function Documentation

◆ operator[]() [1/2]

char & llvm::RopePiece::operator[] ( unsigned Offset)
inline

Definition at line 72 of file RewriteRope.h.

References llvm::Offset, StartOffs, and StrData.

◆ operator[]() [2/2]

const char & llvm::RopePiece::operator[] ( unsigned Offset) const
inline

Definition at line 69 of file RewriteRope.h.

References llvm::Offset, StartOffs, and StrData.

◆ size()

unsigned llvm::RopePiece::size ( ) const
inline

Definition at line 76 of file RewriteRope.h.

References EndOffs, and StartOffs.

Member Data Documentation

◆ EndOffs

unsigned llvm::RopePiece::EndOffs = 0

Definition at line 62 of file RewriteRope.h.

Referenced by RopePiece(), and size().

◆ StartOffs

unsigned llvm::RopePiece::StartOffs = 0

Definition at line 61 of file RewriteRope.h.

Referenced by operator[](), operator[](), RopePiece(), and size().

◆ StrData

llvm::IntrusiveRefCntPtr<RopeRefCountString> llvm::RopePiece::StrData

Definition at line 60 of file RewriteRope.h.

Referenced by operator[](), operator[](), and RopePiece().


The documentation for this struct was generated from the following file: