common/stringutils.h File Reference

Various handy helpers which std::string really should provide. More...

#include <xapian/visibility.h>
#include <algorithm>
#include <string>
#include <cstring>

Include dependency graph for stringutils.h:

Go to the source code of this file.


Namespaces

namespace  Xapian
 The Xapian namespace contains public interfaces for the Xapian library.
namespace  Xapian::Internal

Defines

#define STRINGIZE_(X)   #X
 Helper macro for STRINGIZE - the nested call is required because of how # works in macros.
#define STRINGIZE(X)   STRINGIZE_(X)
 The STRINGIZE macro converts its parameter into a string constant.
#define CONST_STRLEN(S)   (sizeof(S"") - 1)
 Returns the length of a string constant.

Functions

bool startswith (const std::string &s, char pfx)
bool startswith (const std::string &s, const char *pfx, size_t len)
bool startswith (const std::string &s, const char *pfx)
bool startswith (const std::string &s, const std::string &pfx)
bool endswith (const std::string &s, char sfx)
bool endswith (const std::string &s, const char *sfx, size_t len)
bool endswith (const std::string &s, const char *sfx)
bool endswith (const std::string &s, const std::string &sfx)
std::string::size_type common_prefix_length (const std::string &a, const std::string &b)
unsigned char C_tab_ (char ch)
bool C_isdigit (char ch)
bool C_isxdigit (char ch)
bool C_islcxdigit (char ch)
bool C_isupper (char ch)
bool C_islower (char ch)
bool C_isalpha (char ch)
bool C_isalnum (char ch)
bool C_isspace (char ch)
bool C_issign (char ch)
bool C_isupdig (char ch)
bool C_isnotdigit (char ch)
bool C_isnotxdigit (char ch)
bool C_isnotupper (char ch)
bool C_isnotlower (char ch)
bool C_isnotalpha (char ch)
bool C_isnotalnum (char ch)
bool C_isnotspace (char ch)
bool C_isnotsign (char ch)
char C_tolower (char ch)
char C_toupper (char ch)

Variables

const unsigned char Xapian::Internal::IS_DIGIT = 0x01
const unsigned char Xapian::Internal::IS_LOWER = 0x02
const unsigned char Xapian::Internal::IS_UPPER = 0x04
const unsigned char Xapian::Internal::IS_HEX = 0x08
const unsigned char Xapian::Internal::IS_SIGN = 0x10
const unsigned char Xapian::Internal::IS_SPACE = 0x20


Detailed Description

Various handy helpers which std::string really should provide.

Definition in file stringutils.h.


Define Documentation

#define CONST_STRLEN (  )     (sizeof(S"") - 1)

Returns the length of a string constant.

We rely on concatenation of string literals to produce an error if this macro is applied to something other than a string literal.

Definition at line 43 of file stringutils.h.

Referenced by FlintDatabaseReplicator::apply_changeset_from_conn(), ChertDatabaseReplicator::apply_changeset_from_conn(), FlintVersion::ensure_uuid(), FlintDatabase::get_changeset_revisions(), ChertDatabase::get_changeset_revisions(), BrassDatabase::get_changeset_revisions(), get_svnbranch(), and FlintVersion::read_and_check().

#define STRINGIZE (  )     STRINGIZE_(X)

#define STRINGIZE_ (  )     #X

Helper macro for STRINGIZE - the nested call is required because of how # works in macros.

Definition at line 33 of file stringutils.h.


Function Documentation

bool C_isalnum ( char  ch  )  [inline]

bool C_isalpha ( char  ch  )  [inline]

Definition at line 162 of file stringutils.h.

References C_tab_(), Xapian::Internal::IS_LOWER, and Xapian::Internal::IS_UPPER.

Referenced by C_isnotalpha(), and U_isalpha().

bool C_isdigit ( char  ch  )  [inline]

Definition at line 137 of file stringutils.h.

References C_tab_(), and Xapian::Internal::IS_DIGIT.

Referenced by C_isnotdigit(), munge_term(), and U_isdigit().

bool C_islcxdigit ( char  ch  )  [inline]

Definition at line 147 of file stringutils.h.

References C_tab_(), Xapian::Internal::IS_HEX, and Xapian::Internal::IS_UPPER.

bool C_islower ( char  ch  )  [inline]

Definition at line 157 of file stringutils.h.

References C_tab_(), and Xapian::Internal::IS_LOWER.

Referenced by C_isnotlower().

bool C_isnotalnum ( char  ch  )  [inline]

Definition at line 192 of file stringutils.h.

References C_isalnum().

bool C_isnotalpha ( char  ch  )  [inline]

Definition at line 191 of file stringutils.h.

References C_isalpha().

bool C_isnotdigit ( char  ch  )  [inline]

Definition at line 187 of file stringutils.h.

References C_isdigit().

bool C_isnotlower ( char  ch  )  [inline]

Definition at line 190 of file stringutils.h.

References C_islower().

bool C_isnotsign ( char  ch  )  [inline]

Definition at line 194 of file stringutils.h.

References C_issign().

bool C_isnotspace ( char  ch  )  [inline]

Definition at line 193 of file stringutils.h.

References C_isspace().

Referenced by get_paragraph(), and FileIndexer::next().

bool C_isnotupper ( char  ch  )  [inline]

Definition at line 189 of file stringutils.h.

References C_isupper().

bool C_isnotxdigit ( char  ch  )  [inline]

Definition at line 188 of file stringutils.h.

References C_isxdigit().

bool C_issign ( char  ch  )  [inline]

Definition at line 177 of file stringutils.h.

References C_tab_(), and Xapian::Internal::IS_SIGN.

Referenced by C_isnotsign().

bool C_isspace ( char  ch  )  [inline]

Definition at line 172 of file stringutils.h.

References C_tab_(), and Xapian::Internal::IS_SPACE.

Referenced by C_isnotspace(), FileIndexer::next(), and stdout_to_string().

bool C_isupdig ( char  ch  )  [inline]

Definition at line 182 of file stringutils.h.

References C_tab_(), Xapian::Internal::IS_DIGIT, and Xapian::Internal::IS_UPPER.

bool C_isupper ( char  ch  )  [inline]

Definition at line 152 of file stringutils.h.

References C_tab_(), and Xapian::Internal::IS_UPPER.

Referenced by C_isnotupper(), Xapian::U_isupper(), and U_isupper().

bool C_isxdigit ( char  ch  )  [inline]

Definition at line 142 of file stringutils.h.

References C_tab_(), and Xapian::Internal::IS_HEX.

Referenced by C_isnotxdigit(), and munge_term().

unsigned char C_tab_ ( char  ch  )  [inline]

char C_tolower ( char  ch  )  [inline]

Definition at line 196 of file stringutils.h.

References Xapian::Internal::lo_tab.

Referenced by munge_term().

char C_toupper ( char  ch  )  [inline]

Definition at line 201 of file stringutils.h.

References Xapian::Internal::up_tab.

std::string::size_type common_prefix_length ( const std::string &  a,
const std::string &  b 
) [inline]

bool endswith ( const std::string &  s,
const std::string &  sfx 
) [inline]

Definition at line 88 of file stringutils.h.

References endswith().

bool endswith ( const std::string &  s,
const char *  sfx 
) [inline]

Definition at line 82 of file stringutils.h.

References endswith().

bool endswith ( const std::string &  s,
const char *  sfx,
size_t  len 
) [inline]

Definition at line 76 of file stringutils.h.

bool endswith ( const std::string &  s,
char  sfx 
) [inline]

bool startswith ( const std::string &  s,
const std::string &  pfx 
) [inline]

Definition at line 64 of file stringutils.h.

References startswith().

bool startswith ( const std::string &  s,
const char *  pfx 
) [inline]

Definition at line 58 of file stringutils.h.

References startswith().

bool startswith ( const std::string &  s,
const char *  pfx,
size_t  len 
) [inline]

Definition at line 52 of file stringutils.h.

bool startswith ( const std::string &  s,
char  pfx 
) [inline]


Documentation for Xapian (version 1.2.13).
Generated on 9 Jan 2013 by Doxygen 1.5.9.