Joshua
open source statistical hierarchical phrase-based machine translation system
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
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

Private Attributes

const char * ptr_
size_type length_

Member Typedef Documentation

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

Constructor & Destructor Documentation

StringPiece::StringPiece ( const char *  str)
StringPiece::StringPiece ( const std::string &  str)
StringPiece::StringPiece ( const char *  offset,
size_type  len 
)

Member Function Documentation

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

Here is the call graph for this function:

int StringPiece::compare ( const StringPiece x) const

Here is the call 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
const char* StringPiece::data ( ) const

Here is the caller graph for this function:

bool StringPiece::empty ( ) const

Here is the caller graph for this function:

bool StringPiece::ends_with ( const StringPiece x) const

Here is the call graph for this function:

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

Here is the caller graph for this function:

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

Here is the call graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

char StringPiece::operator[] ( size_type  i) const
size_type StringPiece::rfind ( const StringPiece s,
size_type  pos = npos 
) const

Here is the caller graph for this function:

size_type StringPiece::rfind ( char  c,
size_type  pos = npos 
) const
void StringPiece::set ( const char *  data,
size_type  len 
)

Here is the call graph for this function:

void StringPiece::set ( const char *  str)
void StringPiece::set ( const void *  data,
size_type  len 
)

Here is the call graph for this function:

Here is the caller graph for this function:

bool StringPiece::starts_with ( const StringPiece x) const

Here is the call graph for this function:

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

Here is the caller graph for this function:


Member Data Documentation

const size_type StringPiece::npos [static]
const char* StringPiece::ptr_ [private]