Ninja
Public Member Functions | Public Attributes
StringPiece Struct Reference

StringPiece represents a slice of a string whose memory is managed externally. More...

#include <string_piece.h>

List of all members.

Public Member Functions

string AsString () const
 Convert the slice into a full-fledged std::string, copying the data into a new string.
bool operator!= (const StringPiece &other) const
bool operator== (const StringPiece &other) const
 StringPiece ()
 StringPiece (const string &str)
 The constructors intentionally allow for implicit conversions.
 StringPiece (const char *str)
 StringPiece (const char *str, size_t len)

Public Attributes

size_t len_
const char * str_

Detailed Description

StringPiece represents a slice of a string whose memory is managed externally.

It is useful for reducing the number of std::strings we need to allocate.

Definition at line 27 of file string_piece.h.


Constructor & Destructor Documentation

Definition at line 28 of file string_piece.h.

StringPiece::StringPiece ( const string &  str) [inline]

The constructors intentionally allow for implicit conversions.

Definition at line 31 of file string_piece.h.

StringPiece::StringPiece ( const char *  str) [inline]

Definition at line 32 of file string_piece.h.

StringPiece::StringPiece ( const char *  str,
size_t  len 
) [inline]

Definition at line 34 of file string_piece.h.


Member Function Documentation

string StringPiece::AsString ( ) const [inline]

Convert the slice into a full-fledged std::string, copying the data into a new string.

Definition at line 45 of file string_piece.h.

Referenced by IncludesNormalize::AbsPath(), State::AddDefault(), State::AddOut(), EvalString::AddSpecial(), EvalString::AddText(), Lexer::Error(), State::GetNode(), ImplicitDepLoader::LoadDepFile(), and IncludesNormalize::Normalize().

bool StringPiece::operator!= ( const StringPiece other) const [inline]

Definition at line 39 of file string_piece.h.

bool StringPiece::operator== ( const StringPiece other) const [inline]

Definition at line 36 of file string_piece.h.

References len_, and str_.


Member Data Documentation

const char* StringPiece::str_

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