LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
llvm::SmallString< InternalLen > Class Template Reference

#include <SmallString.h>

Inheritance diagram for llvm::SmallString< InternalLen >:
Inheritance graph
[legend]
Collaboration diagram for llvm::SmallString< InternalLen >:
Collaboration graph
[legend]

Public Member Functions

 SmallString ()
 Default ctor - Initialize to empty. More...
 
 SmallString (StringRef S)
 Initialize from a StringRef. More...
 
template<typename ItTy >
 SmallString (ItTy S, ItTy E)
 Initialize with a range. More...
 
 SmallString (const SmallString &RHS)
 Copy ctor. More...
 
String Assignment
void assign (size_t NumElts, char Elt)
 Assign from a repeated element. More...
 
template<typename in_iter >
void assign (in_iter S, in_iter E)
 Assign from an iterator pair. More...
 
void assign (StringRef RHS)
 Assign from a StringRef. More...
 
void assign (const SmallVectorImpl< char > &RHS)
 Assign from a SmallVector. More...
 
String Concatenation
template<typename in_iter >
void append (in_iter S, in_iter E)
 Append from an iterator pair. More...
 
void append (size_t NumInputs, char Elt)
 
void append (StringRef RHS)
 Append from a StringRef. More...
 
void append (const SmallVectorImpl< char > &RHS)
 Append from a SmallVector. More...
 
String Comparison
bool equals (StringRef RHS) const
 
bool equals_lower (StringRef RHS) const
 Check for string equality, ignoring case. More...
 
int compare (StringRef RHS) const
 
int compare_lower (StringRef RHS) const
 compare_lower - Compare two strings, ignoring case. More...
 
int compare_numeric (StringRef RHS) const
 
String Predicates
bool startswith (StringRef Prefix) const
 startswith - Check if this string starts with the given Prefix. More...
 
bool endswith (StringRef Suffix) const
 endswith - Check if this string ends with the given Suffix. More...
 
String Searching
size_t find (char C, size_t From=0) const
 
size_t find (StringRef Str, size_t From=0) const
 
size_t rfind (char C, size_t From=StringRef::npos) const
 
size_t rfind (StringRef Str) const
 
size_t find_first_of (char C, size_t From=0) const
 
size_t find_first_of (StringRef Chars, size_t From=0) const
 
size_t find_first_not_of (char C, size_t From=0) const
 
size_t find_first_not_of (StringRef Chars, size_t From=0) const
 
size_t find_last_of (char C, size_t From=StringRef::npos) const
 
size_t find_last_of (StringRef Chars, size_t From=StringRef::npos) const
 
Helpful Algorithms
size_t count (char C) const
 Return the number of occurrences of C in the string. More...
 
size_t count (StringRef Str) const
 
Substring Operations
StringRef substr (size_t Start, size_t N=StringRef::npos) const
 
StringRef slice (size_t Start, size_t End) const
 
StringRef str () const
 Explicit conversion to StringRef. More...
 
const char * c_str ()
 
 operator StringRef () const
 Implicit conversion to StringRef. More...
 
const SmallStringoperator= (StringRef RHS)
 
SmallStringoperator+= (StringRef RHS)
 
SmallStringoperator+= (char C)
 
- Public Member Functions inherited from llvm::SmallVector< char, InternalLen >
 SmallVector ()
 
 SmallVector (unsigned Size, const char &Value=char())
 
 SmallVector (ItTy S, ItTy E)
 
 SmallVector (const SmallVector &RHS)
 
const SmallVectoroperator= (const SmallVector &RHS)
 
- Public Member Functions inherited from llvm::SmallVectorImpl< char >
 ~SmallVectorImpl ()
 
void clear ()
 
void resize (unsigned N)
 
void resize (unsigned N, const char &NV)
 
void reserve (unsigned N)
 
charLLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val ()
 
void swap (SmallVectorImpl &RHS)
 
void append (in_iter in_start, in_iter in_end)
 
void append (size_type NumInputs, const char &Elt)
 
void assign (unsigned NumElts, const char &Elt)
 
iterator erase (iterator I)
 
iterator erase (iterator S, iterator E)
 
iterator insert (iterator I, const char &Elt)
 
iterator insert (iterator I, size_type NumToInsert, const char &Elt)
 
iterator insert (iterator I, ItTy From, ItTy To)
 
SmallVectorImploperator= (const SmallVectorImpl &RHS)
 
bool operator== (const SmallVectorImpl &RHS) const
 
bool operator!= (const SmallVectorImpl &RHS) const
 
bool operator< (const SmallVectorImpl &RHS) const
 
void set_size (unsigned N)
 
- Public Member Functions inherited from llvm::SmallVectorTemplateBase< T, isPodLike >
void push_back (const T &Elt)
 
void pop_back ()
 
- Public Member Functions inherited from llvm::SmallVectorTemplateCommon< T >
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
size_type size () const
 
size_type max_size () const
 
size_t capacity () const
 
pointer data ()
 data - Return a pointer to the vector's buffer, even if empty(). More...
 
const_pointer data () const
 data - Return a pointer to the vector's buffer, even if empty(). More...
 
reference operator[] (unsigned idx)
 
const_reference operator[] (unsigned idx) const
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
- Public Member Functions inherited from llvm::SmallVectorBase
size_t size_in_bytes () const
 size_in_bytes - This returns size()*sizeof(T). More...
 
size_t capacity_in_bytes () const
 capacity_in_bytes - This returns capacity()*sizeof(T). More...
 
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty () const
 

Additional Inherited Members

- Public Types inherited from llvm::SmallVectorImpl< char >
typedef SuperClass::iterator iterator
 
typedef SuperClass::size_type size_type
 
- Public Types inherited from llvm::SmallVectorTemplateCommon< T >
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 
typedef T value_type
 
typedef Titerator
 
typedef const Tconst_iterator
 
typedef std::reverse_iterator
< const_iterator
const_reverse_iterator
 
typedef std::reverse_iterator
< iterator
reverse_iterator
 
typedef Treference
 
typedef const Tconst_reference
 
typedef Tpointer
 
typedef const Tconst_pointer
 
- Protected Member Functions inherited from llvm::SmallVectorImpl< char >
 SmallVectorImpl (unsigned N)
 
- Protected Member Functions inherited from llvm::SmallVectorTemplateBase< T, isPodLike >
 SmallVectorTemplateBase (size_t Size)
 
void grow (size_t MinSize=0)
 
- Protected Member Functions inherited from llvm::SmallVectorTemplateCommon< T >
 SmallVectorTemplateCommon (size_t Size)
 
void grow_pod (size_t MinSizeInBytes, size_t TSize)
 
bool isSmall () const
 
void resetToSmall ()
 resetToSmall - Put this vector in a state of being small. More...
 
void setEnd (T *P)
 
iterator capacity_ptr ()
 
const_iterator capacity_ptr () const
 
- Protected Member Functions inherited from llvm::SmallVectorBase
 SmallVectorBase (void *FirstEl, size_t Size)
 
void grow_pod (void *FirstEl, size_t MinSizeInBytes, size_t TSize)
 
- Static Protected Member Functions inherited from llvm::SmallVectorTemplateBase< T, isPodLike >
static void destroy_range (T *S, T *E)
 
template<typename It1 , typename It2 >
static It2 move (It1 I, It1 E, It2 Dest)
 
template<typename It1 , typename It2 >
static It2 move_backward (It1 I, It1 E, It2 Dest)
 
template<typename It1 , typename It2 >
static void uninitialized_move (It1 I, It1 E, It2 Dest)
 
template<typename It1 , typename It2 >
static void uninitialized_copy (It1 I, It1 E, It2 Dest)
 
- Protected Attributes inherited from llvm::SmallVectorBase
void * BeginX
 
void * EndX
 
void * CapacityX
 

Detailed Description

template<unsigned InternalLen>
class llvm::SmallString< InternalLen >

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better as a string (e.g. operator+ etc).

Definition at line 25 of file SmallString.h.

Constructor & Destructor Documentation

template<unsigned InternalLen>
llvm::SmallString< InternalLen >::SmallString ( )
inline

Default ctor - Initialize to empty.

Definition at line 28 of file SmallString.h.

template<unsigned InternalLen>
llvm::SmallString< InternalLen >::SmallString ( StringRef  S)
inline

Initialize from a StringRef.

Definition at line 31 of file SmallString.h.

template<unsigned InternalLen>
template<typename ItTy >
llvm::SmallString< InternalLen >::SmallString ( ItTy  S,
ItTy  E 
)
inline

Initialize with a range.

Definition at line 35 of file SmallString.h.

template<unsigned InternalLen>
llvm::SmallString< InternalLen >::SmallString ( const SmallString< InternalLen > &  RHS)
inline

Copy ctor.

Definition at line 38 of file SmallString.h.

Member Function Documentation

template<unsigned InternalLen>
template<typename in_iter >
void llvm::SmallString< InternalLen >::append ( in_iter  S,
in_iter  E 
)
inline
template<unsigned InternalLen>
void llvm::SmallString< InternalLen >::append ( size_t  NumInputs,
char  Elt 
)
inline

Definition at line 81 of file SmallString.h.

template<unsigned InternalLen>
void llvm::SmallString< InternalLen >::append ( StringRef  RHS)
inline

Append from a StringRef.

Definition at line 87 of file SmallString.h.

template<unsigned InternalLen>
void llvm::SmallString< InternalLen >::append ( const SmallVectorImpl< char > &  RHS)
inline

Append from a SmallVector.

Definition at line 92 of file SmallString.h.

template<unsigned InternalLen>
void llvm::SmallString< InternalLen >::assign ( size_t  NumElts,
char  Elt 
)
inline

Assign from a repeated element.

Definition at line 48 of file SmallString.h.

template<unsigned InternalLen>
template<typename in_iter >
void llvm::SmallString< InternalLen >::assign ( in_iter  S,
in_iter  E 
)
inline

Assign from an iterator pair.

Definition at line 54 of file SmallString.h.

template<unsigned InternalLen>
void llvm::SmallString< InternalLen >::assign ( StringRef  RHS)
inline

Assign from a StringRef.

Definition at line 60 of file SmallString.h.

template<unsigned InternalLen>
void llvm::SmallString< InternalLen >::assign ( const SmallVectorImpl< char > &  RHS)
inline

Assign from a SmallVector.

Definition at line 66 of file SmallString.h.

template<unsigned InternalLen>
const char* llvm::SmallString< InternalLen >::c_str ( )
inline
template<unsigned InternalLen>
int llvm::SmallString< InternalLen >::compare ( StringRef  RHS) const
inline

Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less than, equal to, or greater than the RHS.

Definition at line 113 of file SmallString.h.

template<unsigned InternalLen>
int llvm::SmallString< InternalLen >::compare_lower ( StringRef  RHS) const
inline

compare_lower - Compare two strings, ignoring case.

Definition at line 118 of file SmallString.h.

template<unsigned InternalLen>
int llvm::SmallString< InternalLen >::compare_numeric ( StringRef  RHS) const
inline

compare_numeric - Compare two strings, treating sequences of digits as numbers.

Definition at line 124 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::count ( char  C) const
inline

Return the number of occurrences of C in the string.

Definition at line 226 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::count ( StringRef  Str) const
inline

Return the number of non-overlapped occurrences of Str in the string.

Definition at line 232 of file SmallString.h.

template<unsigned InternalLen>
bool llvm::SmallString< InternalLen >::endswith ( StringRef  Suffix) const
inline

endswith - Check if this string ends with the given Suffix.

Definition at line 138 of file SmallString.h.

template<unsigned InternalLen>
bool llvm::SmallString< InternalLen >::equals ( StringRef  RHS) const
inline

Check for string equality. This is more efficient than compare() when the relative ordering of inequal strings isn't needed.

Definition at line 102 of file SmallString.h.

Referenced by llvm::DILineInfo::operator==().

template<unsigned InternalLen>
bool llvm::SmallString< InternalLen >::equals_lower ( StringRef  RHS) const
inline

Check for string equality, ignoring case.

Definition at line 107 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::find ( char  C,
size_t  From = 0 
) const
inline

find - Search for the first character C in the string.

Returns
- The index of the first occurrence of C, or npos if not found.

Definition at line 150 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::find ( StringRef  Str,
size_t  From = 0 
) const
inline

Search for the first string Str in the string.

Returns
The index of the first occurrence of Str, or npos if not found.

Definition at line 158 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::find_first_not_of ( char  C,
size_t  From = 0 
) const
inline

Find the first character in the string that is not C or npos if not found.

Definition at line 194 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::find_first_not_of ( StringRef  Chars,
size_t  From = 0 
) const
inline

Find the first character in the string that is not in the string Chars, or npos if not found.

Complexity: O(size() + Chars.size())

Definition at line 202 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::find_first_of ( char  C,
size_t  From = 0 
) const
inline

Find the first character in the string that is C, or npos if not found. Same as find.

Definition at line 180 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::find_first_of ( StringRef  Chars,
size_t  From = 0 
) const
inline

Find the first character in the string that is in Chars, or npos if not found.

Complexity: O(size() + Chars.size())

Definition at line 188 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::find_last_of ( char  C,
size_t  From = StringRef::npos 
) const
inline

Find the last character in the string that is C, or npos if not found.

Definition at line 208 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::find_last_of ( StringRef  Chars,
size_t  From = StringRef::npos 
) const
inline

Find the last character in the string that is in C, or npos if not found.

Complexity: O(size() + Chars.size())

Definition at line 216 of file SmallString.h.

template<unsigned InternalLen>
llvm::SmallString< InternalLen >::operator StringRef ( ) const
inline

Implicit conversion to StringRef.

Definition at line 280 of file SmallString.h.

template<unsigned InternalLen>
SmallString& llvm::SmallString< InternalLen >::operator+= ( StringRef  RHS)
inline

Definition at line 288 of file SmallString.h.

template<unsigned InternalLen>
SmallString& llvm::SmallString< InternalLen >::operator+= ( char  C)
inline

Definition at line 292 of file SmallString.h.

template<unsigned InternalLen>
const SmallString& llvm::SmallString< InternalLen >::operator= ( StringRef  RHS)
inline

Definition at line 283 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::rfind ( char  C,
size_t  From = StringRef::npos 
) const
inline

Search for the last character C in the string.

Returns
The index of the last occurrence of C, or npos if not found.

Definition at line 166 of file SmallString.h.

template<unsigned InternalLen>
size_t llvm::SmallString< InternalLen >::rfind ( StringRef  Str) const
inline

Search for the last string Str in the string.

Returns
The index of the last occurrence of Str, or npos if not found.

Definition at line 174 of file SmallString.h.

template<unsigned InternalLen>
StringRef llvm::SmallString< InternalLen >::slice ( size_t  Start,
size_t  End 
) const
inline

Return a reference to the substring from [Start, End).

Parameters
StartThe index of the starting character in the substring; if the index is npos or greater than the length of the string then the empty substring will be returned.
EndThe index following the last character to include in the substring. If this is npos, or less than Start, or exceeds the number of characters remaining in the string, the string suffix (starting with Start) will be returned.

Definition at line 263 of file SmallString.h.

template<unsigned InternalLen>
bool llvm::SmallString< InternalLen >::startswith ( StringRef  Prefix) const
inline

startswith - Check if this string starts with the given Prefix.

Definition at line 133 of file SmallString.h.

Referenced by GetSymbolFromOperand().

template<unsigned InternalLen>
StringRef llvm::SmallString< InternalLen >::str ( ) const
inline

Explicit conversion to StringRef.

Definition at line 270 of file SmallString.h.

Referenced by llvm::SmallString< 256 >::compare(), llvm::SmallString< 256 >::compare_lower(), llvm::SmallString< 256 >::compare_numeric(), llvm::SmallString< 256 >::count(), CrashHandler(), llvm::createGraphFilename(), llvm::APInt::dump(), emitComments(), llvm::StringToOffsetTable::EmitString(), llvm::SmallString< 256 >::endswith(), llvm::SmallString< 256 >::equals(), llvm::SmallString< 256 >::equals_lower(), llvm::SmallString< 256 >::find(), llvm::SmallString< 256 >::find_first_not_of(), llvm::SmallString< 256 >::find_first_of(), llvm::SmallString< 256 >::find_last_of(), llvm::MSP430MCInstLower::GetConstantPoolIndexSymbol(), llvm::AsmPrinter::GetExternalSymbolSymbol(), llvm::DWARFDebugLine::LineTable::getFileNameByIndex(), getFileNameForCompileUnit(), llvm::getFnSpecificMDNode(), llvm::jitprofiling::FilenameCache::getFullPath(), llvm::MachineFunction::getJTISymbol(), llvm::MSP430MCInstLower::GetJumpTableSymbol(), llvm::MCContext::getMachOSection(), llvm::MCContext::GetOrCreateSymbol(), llvm::getOrInsertFnSpecificMDNode(), llvm::TargetLoweringObjectFile::getSymbol(), GetSymbolFromOperand(), llvm::AsmPrinter::GetSymbolWithGlobalValueBase(), llvm::LockFileManager::LockFileManager(), llvm::MCContext::LookupSymbol(), llvm::opt::ArgList::MakeArgString(), llvm::SmallString< 256 >::operator StringRef(), llvm::APInt::print(), llvm::SmallString< 256 >::rfind(), llvm::TargetLoweringObjectFileELF::SelectSectionForGlobal(), llvm::TargetLoweringObjectFileCOFF::SelectSectionForGlobal(), llvm::Triple::setArchName(), llvm::FileRemover::setFile(), llvm::SmallString< 256 >::slice(), llvm::SmallString< 256 >::startswith(), llvm::SmallString< 256 >::substr(), llvm::APInt::toString(), llvm::LockFileManager::waitForUnlock(), llvm::WriteConstantInternal(), writeFragment(), llvm::MachObjectWriter::WriteObject(), llvm::FileRemover::~FileRemover(), and llvm::LockFileManager::~LockFileManager().

template<unsigned InternalLen>
StringRef llvm::SmallString< InternalLen >::substr ( size_t  Start,
size_t  N = StringRef::npos 
) const
inline

Return a reference to the substring from [Start, Start + N).

Parameters
StartThe index of the starting character in the substring; if the index is npos or greater than the length of the string then the empty substring will be returned.
NThe number of characters to included in the substring. If N exceeds the number of characters remaining in the string, the string suffix (starting with Start) will be returned.

Definition at line 249 of file SmallString.h.


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