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 95 of file string_piece.hh.


Member Typedef Documentation

typedef const char* StringPiece::const_iterator

Definition at line 182 of file string_piece.hh.

typedef const char& StringPiece::const_reference

Definition at line 179 of file string_piece.hh.

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

Definition at line 184 of file string_piece.hh.

typedef ptrdiff_t StringPiece::difference_type

Definition at line 180 of file string_piece.hh.

typedef const char* StringPiece::iterator

Definition at line 183 of file string_piece.hh.

typedef const char* StringPiece::pointer

Definition at line 177 of file string_piece.hh.

typedef const char& StringPiece::reference

Definition at line 178 of file string_piece.hh.

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

Definition at line 185 of file string_piece.hh.

typedef size_t StringPiece::size_type

Definition at line 97 of file string_piece.hh.

Definition at line 176 of file string_piece.hh.


Constructor & Destructor Documentation

StringPiece::StringPiece (  )  [inline]

Definition at line 107 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 108 of file string_piece.hh.

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

Definition at line 110 of file string_piece.hh.

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

Definition at line 112 of file string_piece.hh.


Member Function Documentation

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

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

iterator StringPiece::begin (  )  const [inline]

Definition at line 186 of file string_piece.hh.

size_type StringPiece::capacity (  )  const [inline]

Definition at line 196 of file string_piece.hh.

void StringPiece::clear (  )  [inline]

Definition at line 124 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]

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

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

Definition at line 14 of file string_piece.cc.

Referenced by MosesTraining::Syntax::ScoreStsg::RuleGroup::AddRule(), and MosesTraining::Syntax::ScoreStsg::RuleGroup::SetNewSource().

Here is the caller graph for this function:

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

bool StringPiece::empty (  )  const [inline]

Definition at line 122 of file string_piece.hh.

Referenced by as_string(), Moses::InternalTree::GetUnbinarizedChildren(), lm::vocab::IsTag(), and main().

Here is the caller graph for this function:

iterator StringPiece::end (  )  const [inline]

Definition at line 187 of file string_piece.hh.

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

Definition at line 170 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 29 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 18 of file string_piece.cc.

References npos.

Referenced by Moses::Phrase::CreateFromString(), 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 116 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 94 of file string_piece.cc.

References npos.

Referenced by Moses::RuleTableLoaderStandard::Load(), Moses::Syntax::T2S::RuleTrieLoader::Load(), Moses::Syntax::S2T::RuleTrieLoader::Load(), and Trim().

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 206 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 75 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 171 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 147 of file string_piece.cc.

References npos.

Referenced by Trim().

Here is the caller graph for this function:

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

Definition at line 212 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 128 of file string_piece.cc.

References npos.

size_type StringPiece::length (  )  const [inline]

Definition at line 121 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 195 of file string_piece.hh.

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

Definition at line 135 of file string_piece.hh.

const_reverse_iterator StringPiece::rbegin (  )  const [inline]

Definition at line 188 of file string_piece.hh.

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

Definition at line 137 of file string_piece.hh.

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

Definition at line 142 of file string_piece.hh.

Referenced by main().

Here is the caller graph for this function:

const_reverse_iterator StringPiece::rend (  )  const [inline]

Definition at line 191 of file string_piece.hh.

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

Definition at line 47 of file string_piece.cc.

References npos.

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

Definition at line 37 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 130 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 126 of file string_piece.hh.

References str.

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

Definition at line 125 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 164 of file string_piece.hh.

References wordmemcmp().

Referenced by starts_with().

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 184 of file string_piece.cc.

References StringPiece().

Referenced by Moses::Phrase::CreateFromString(), MosesTraining::Syntax::TreeFragmentTokenizer::operator++(), Moses::Syntax::F2S::TreeFragmentTokenizer::operator++(), and Trim().

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 220 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 Thu Jul 6 00:32:01 2017 for Moses by  doxygen 1.5.9