StringPiece Class Reference

#include <string_piece.hh>

List of all members.

Public Types

typedef size_t size_type
typedef char value_type
typedef const char * pointer
typedef const char & reference
typedef const char & const_reference
typedef ptrdiff_t difference_type
typedef const char * const_iterator
typedef const char * iterator
typedef std::reverse_iterator
< const_iterator
const_reverse_iterator
typedef std::reverse_iterator
< iterator
reverse_iterator

Public Member Functions

 StringPiece ()
 StringPiece (const char *str)
 StringPiece (const std::string &str)
 StringPiece (const char *offset, size_type len)
const char * data () const
size_type size () const
size_type length () const
bool empty () const
void clear ()
void set (const char *data, size_type len)
void set (const char *str)
void set (const void *data, size_type len)
char operator[] (size_type i) const
void remove_prefix (size_type n)
void remove_suffix (size_type n)
int compare (const StringPiece &x) const
std::string as_string () const
void CopyToString (std::string *target) const
void AppendToString (std::string *target) const
bool starts_with (const StringPiece &x) const
bool ends_with (const StringPiece &x) const
iterator begin () const
iterator end () const
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
size_type max_size () const
size_type capacity () const
size_type copy (char *buf, size_type n, size_type pos=0) const
size_type find (const StringPiece &s, size_type pos=0) const
size_type find (char c, size_type pos=0) const
size_type rfind (const StringPiece &s, size_type pos=npos) const
size_type rfind (char c, size_type pos=npos) const
size_type find_first_of (const StringPiece &s, size_type pos=0) const
size_type find_first_of (char c, size_type pos=0) const
size_type find_first_not_of (const StringPiece &s, size_type pos=0) const
size_type find_first_not_of (char c, size_type pos=0) const
size_type find_last_of (const StringPiece &s, size_type pos=npos) const
size_type find_last_of (char c, size_type pos=npos) const
size_type find_last_not_of (const StringPiece &s, size_type pos=npos) const
size_type find_last_not_of (char c, size_type pos=npos) const
StringPiece substr (size_type pos, size_type n=npos) const

Static Public Member Functions

static int wordmemcmp (const char *p, const char *p2, size_type N)

Static Public Attributes

static const size_type npos = size_type(-1)


Detailed Description

Definition at line 89 of file string_piece.hh.


Member Typedef Documentation

typedef const char* StringPiece::const_iterator

Definition at line 176 of file string_piece.hh.

typedef const char& StringPiece::const_reference

Definition at line 173 of file string_piece.hh.

typedef std::reverse_iterator<const_iterator> StringPiece::const_reverse_iterator

Definition at line 178 of file string_piece.hh.

typedef ptrdiff_t StringPiece::difference_type

Definition at line 174 of file string_piece.hh.

typedef const char* StringPiece::iterator

Definition at line 177 of file string_piece.hh.

typedef const char* StringPiece::pointer

Definition at line 171 of file string_piece.hh.

typedef const char& StringPiece::reference

Definition at line 172 of file string_piece.hh.

typedef std::reverse_iterator<iterator> StringPiece::reverse_iterator

Definition at line 179 of file string_piece.hh.

typedef size_t StringPiece::size_type

Definition at line 91 of file string_piece.hh.

Definition at line 170 of file string_piece.hh.


Constructor & Destructor Documentation

StringPiece::StringPiece (  )  [inline]

Definition at line 101 of file string_piece.hh.

Referenced by substr().

Here is the caller graph for this function:

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

Definition at line 102 of file string_piece.hh.

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

Definition at line 104 of file string_piece.hh.

StringPiece::StringPiece ( const char *  offset,
size_type  len 
) [inline]

Definition at line 106 of file string_piece.hh.


Member Function Documentation

void StringPiece::AppendToString ( std::string *  target  )  const

std::string StringPiece::as_string (  )  const [inline]

Definition at line 149 of file string_piece.hh.

References data(), empty(), and size().

Referenced by Moses::LanguageModelIRST::GetLmID(), GrabOrDie(), main(), Moses::TargetPhrase::SetSparseScore(), and split_line().

Here is the call graph for this function:

Here is the caller graph for this function:

iterator StringPiece::begin (  )  const [inline]

Definition at line 180 of file string_piece.hh.

size_type StringPiece::capacity (  )  const [inline]

Definition at line 190 of file string_piece.hh.

void StringPiece::clear (  )  [inline]

Definition at line 118 of file string_piece.hh.

References NULL.

Referenced by split_line().

Here is the caller graph for this function:

int StringPiece::compare ( const StringPiece x  )  const [inline]

Definition at line 140 of file string_piece.hh.

References wordmemcmp().

Referenced by Moses::TargetNgramFeature::EvaluateChart(), ModelScoreMonotonicity::getType(), ModelScoreMSD::getType(), ModelScoreLR::getType(), ModelScoreMSLR::getType(), ModelScore::getType(), and main().

Here is the call graph for this function:

Here is the caller graph for this function:

size_type StringPiece::copy ( char *  buf,
size_type  n,
size_type  pos = 0 
) const

void StringPiece::CopyToString ( std::string *  target  )  const

Definition at line 15 of file string_piece.cc.

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

bool StringPiece::empty (  )  const [inline]

Definition at line 116 of file string_piece.hh.

Referenced by as_string(), and lm::vocab::IsTag().

Here is the caller graph for this function:

iterator StringPiece::end (  )  const [inline]

Definition at line 181 of file string_piece.hh.

bool StringPiece::ends_with ( const StringPiece x  )  const [inline]

Definition at line 164 of file string_piece.hh.

References wordmemcmp().

Here is the call graph for this function:

size_type StringPiece::find ( char  c,
size_type  pos = 0 
) const

Definition at line 30 of file string_piece.cc.

References find(), and npos.

Here is the call graph for this function:

size_type StringPiece::find ( const StringPiece s,
size_type  pos = 0 
) const

Definition at line 19 of file string_piece.cc.

References npos.

Referenced by Moses::Phrase::CreateFromString(), Moses::WordTranslationFeature::Evaluate(), find(), and find_first_of().

Here is the caller graph for this function:

size_type StringPiece::find_first_not_of ( char  c,
size_type  pos = 0 
) const

Definition at line 117 of file string_piece.cc.

References npos.

size_type StringPiece::find_first_not_of ( const StringPiece s,
size_type  pos = 0 
) const

Definition at line 95 of file string_piece.cc.

References npos.

Referenced by Moses::RuleTableLoaderStandard::Load().

Here is the caller graph for this function:

size_type StringPiece::find_first_of ( char  c,
size_type  pos = 0 
) const [inline]

Definition at line 200 of file string_piece.hh.

References find().

Here is the call graph for this function:

size_type StringPiece::find_first_of ( const StringPiece s,
size_type  pos = 0 
) const

Definition at line 76 of file string_piece.cc.

References npos.

Referenced by Moses::ChartParserUnknown::Process(), and Moses::TranslationOptionCollection::ProcessOneUnknownWord().

Here is the caller graph for this function:

size_type StringPiece::find_last_not_of ( char  c,
size_type  pos = npos 
) const

Definition at line 172 of file string_piece.cc.

References npos.

size_type StringPiece::find_last_not_of ( const StringPiece s,
size_type  pos = npos 
) const

Definition at line 148 of file string_piece.cc.

References npos.

size_type StringPiece::find_last_of ( char  c,
size_type  pos = npos 
) const [inline]

Definition at line 206 of file string_piece.hh.

References rfind().

Here is the call graph for this function:

size_type StringPiece::find_last_of ( const StringPiece s,
size_type  pos = npos 
) const

Definition at line 129 of file string_piece.cc.

References npos.

size_type StringPiece::length (  )  const [inline]

Definition at line 115 of file string_piece.hh.

Referenced by hash_value(), lm::ngram::detail::HashForVocab(), and lm::MultipleOutputBuffer::SingleAddNGram().

Here is the caller graph for this function:

size_type StringPiece::max_size (  )  const [inline]

Definition at line 189 of file string_piece.hh.

char StringPiece::operator[] ( size_type  i  )  const [inline]

Definition at line 129 of file string_piece.hh.

const_reverse_iterator StringPiece::rbegin (  )  const [inline]

Definition at line 182 of file string_piece.hh.

void StringPiece::remove_prefix ( size_type  n  )  [inline]

Definition at line 131 of file string_piece.hh.

void StringPiece::remove_suffix ( size_type  n  )  [inline]

Definition at line 136 of file string_piece.hh.

const_reverse_iterator StringPiece::rend (  )  const [inline]

Definition at line 185 of file string_piece.hh.

size_type StringPiece::rfind ( char  c,
size_type  pos = npos 
) const

Definition at line 48 of file string_piece.cc.

References npos.

size_type StringPiece::rfind ( const StringPiece s,
size_type  pos = npos 
) const

Definition at line 38 of file string_piece.cc.

References npos.

Referenced by find_last_of().

Here is the caller graph for this function:

void StringPiece::set ( const void *  data,
size_type  len 
) [inline]

Definition at line 124 of file string_piece.hh.

References data().

Here is the call graph for this function:

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

Definition at line 120 of file string_piece.hh.

void StringPiece::set ( const char *  data,
size_type  len 
) [inline]

Definition at line 119 of file string_piece.hh.

References data().

Here is the call graph for this function:

size_type StringPiece::size (  )  const [inline]

bool StringPiece::starts_with ( const StringPiece x  )  const [inline]

Definition at line 158 of file string_piece.hh.

References wordmemcmp().

Referenced by lm::ReadARPACounts().

Here is the call graph for this function:

Here is the caller graph for this function:

StringPiece StringPiece::substr ( size_type  pos,
size_type  n = npos 
) const

Definition at line 185 of file string_piece.cc.

References StringPiece().

Referenced by Moses::Phrase::CreateFromString().

Here is the call graph for this function:

Here is the caller graph for this function:

static int StringPiece::wordmemcmp ( const char *  p,
const char *  p2,
size_type  N 
) [inline, static]

Definition at line 214 of file string_piece.hh.

Referenced by compare(), ends_with(), and starts_with().

Here is the caller graph for this function:


Member Data Documentation

const size_type StringPiece::npos = size_type(-1) [static]


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

Generated on Fri Apr 18 00:30:52 2014 for Moses by  doxygen 1.5.9