common/stringutils.h File Reference

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

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

Include dependency graph for stringutils.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Xapian
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)
bool C_isdigit (char ch)
bool C_isxdigit (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 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.

#define STRINGIZE (  )     STRINGIZE_(X)

The STRINGIZE macro converts its parameter into a string constant.

Definition at line 36 of file stringutils.h.

Referenced by Btree::add(), FlintWritableDatabase::add_document_(), Item_wr_::form_key(), FlintVersion::read_and_check(), RemoteDatabase::RemoteDatabase(), FlintWritableDatabase::replace_document(), Btree::split_root(), and FlintTable::split_root().

#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.


Function Documentation

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

Definition at line 46 of file stringutils.h.

Referenced by TermGroup::as_group(), test_driver::get_srcdir(), FlintMetadataTermList::get_termname(), main(), QuartzAllTermsList::next(), InMemoryAllTermsList::next(), FlintSynonymTermList::next(), FlintSpellingWordsList::next(), FlintMetadataTermList::next(), FlintAllTermsList::next(), QuartzMetaFile::open(), QuartzAllTermsList::QuartzAllTermsList(), QuartzAllTermsList::skip_to(), InMemoryAllTermsList::skip_to(), FlintSynonymTermList::skip_to(), FlintSpellingWordsList::skip_to(), FlintAllTermsList::skip_to(), and 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,
const char *  pfx 
) [inline]

Definition at line 58 of file stringutils.h.

References startswith().

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

Definition at line 64 of file stringutils.h.

References startswith().

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

Definition at line 70 of file stringutils.h.

Referenced by endswith(), test_driver::get_srcdir(), main(), and FileIndexer::next_file().

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,
const char *  sfx 
) [inline]

Definition at line 82 of file stringutils.h.

References endswith().

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

Definition at line 88 of file stringutils.h.

References endswith().

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

Definition at line 94 of file stringutils.h.

Referenced by FlintTermListTable::set_termlist().

bool C_isdigit ( char  ch  )  [inline]

Definition at line 132 of file stringutils.h.

References Xapian::Internal::IS_DIGIT, and Xapian::Internal::is_tab.

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

bool C_isxdigit ( char  ch  )  [inline]

Definition at line 137 of file stringutils.h.

References Xapian::Internal::IS_HEX, and Xapian::Internal::is_tab.

Referenced by C_isnotxdigit(), and munge_term().

bool C_isupper ( char  ch  )  [inline]

Definition at line 142 of file stringutils.h.

References Xapian::Internal::is_tab, and Xapian::Internal::IS_UPPER.

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

bool C_islower ( char  ch  )  [inline]

Definition at line 147 of file stringutils.h.

References Xapian::Internal::IS_LOWER, and Xapian::Internal::is_tab.

Referenced by C_isnotlower().

bool C_isalpha ( char  ch  )  [inline]

Definition at line 152 of file stringutils.h.

References Xapian::Internal::IS_LOWER, Xapian::Internal::is_tab, and Xapian::Internal::IS_UPPER.

Referenced by C_isnotalpha(), and U_isalpha().

bool C_isalnum ( char  ch  )  [inline]

Definition at line 157 of file stringutils.h.

References Xapian::Internal::IS_DIGIT, Xapian::Internal::IS_LOWER, Xapian::Internal::is_tab, and Xapian::Internal::IS_UPPER.

Referenced by append_filename_argument(), C_isnotalnum(), and munge_term().

bool C_isspace ( char  ch  )  [inline]

Definition at line 162 of file stringutils.h.

References Xapian::Internal::IS_SPACE, and Xapian::Internal::is_tab.

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

bool C_issign ( char  ch  )  [inline]

Definition at line 167 of file stringutils.h.

References Xapian::Internal::IS_SIGN, and Xapian::Internal::is_tab.

Referenced by C_isnotsign().

bool C_isupdig ( char  ch  )  [inline]

Definition at line 172 of file stringutils.h.

References Xapian::Internal::IS_DIGIT, Xapian::Internal::is_tab, and Xapian::Internal::IS_UPPER.

bool C_isnotdigit ( char  ch  )  [inline]

Definition at line 177 of file stringutils.h.

References C_isdigit().

bool C_isnotxdigit ( char  ch  )  [inline]

Definition at line 178 of file stringutils.h.

References C_isxdigit().

bool C_isnotupper ( char  ch  )  [inline]

Definition at line 179 of file stringutils.h.

References C_isupper().

bool C_isnotlower ( char  ch  )  [inline]

Definition at line 180 of file stringutils.h.

References C_islower().

bool C_isnotalpha ( char  ch  )  [inline]

Definition at line 181 of file stringutils.h.

References C_isalpha().

bool C_isnotalnum ( char  ch  )  [inline]

Definition at line 182 of file stringutils.h.

References C_isalnum().

bool C_isnotspace ( char  ch  )  [inline]

Definition at line 183 of file stringutils.h.

References C_isspace().

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

bool C_isnotsign ( char  ch  )  [inline]

Definition at line 184 of file stringutils.h.

References C_issign().

char C_tolower ( char  ch  )  [inline]

Definition at line 186 of file stringutils.h.

References Xapian::Internal::lo_tab.

Referenced by munge_term().

char C_toupper ( char  ch  )  [inline]

Definition at line 191 of file stringutils.h.

References Xapian::Internal::up_tab.


Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.