xapian-core  1.4.20
Namespaces | Macros | Functions | Variables
stringutils.h File Reference

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

#include <xapian/constinfo.h>
#include <algorithm>
#include <string>
#include <cstring>
+ Include dependency graph for stringutils.h:

Go to the source code of this file.

Namespaces

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

Macros

#define STRINGIZE_(X)   #X
 Helper macro for STRINGIZE - the nested call is required because of how

works in macros.

More...
 
#define STRINGIZE(X)   STRINGIZE_(X)
 The STRINGIZE macro converts its parameter into a string constant. More...
 
#define CONST_STRLEN(S)   (sizeof(S"") - 1)
 Returns the length of a string constant. More...
 

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_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_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)
 
char C_tolower (char ch)
 
char C_toupper (char ch)
 
int hex_digit (char ch)
 

Variables

const unsigned char Xapian::Internal::HEX_MASK = 0x0f
 
const unsigned char Xapian::Internal::IS_UPPER = 0x10
 
const unsigned char Xapian::Internal::IS_ALPHA = 0x20
 
const unsigned char Xapian::Internal::IS_DIGIT = 0x40
 
const unsigned char Xapian::Internal::IS_SPACE = 0x80
 

Detailed Description

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

Definition in file stringutils.h.

Macro Definition Documentation

◆ CONST_STRLEN

#define CONST_STRLEN (   S)    (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 ChertDatabaseReplicator::apply_changeset_from_conn(), GlassDatabaseReplicator::apply_changeset_from_conn(), FDTracker::check(), GlassChanges::check(), GlassDatabase::get_changeset_revisions(), ChertDatabase::get_changeset_revisions(), main(), and GlassDatabaseReplicator::process_changeset_chunk_blocks().

◆ STRINGIZE

#define STRINGIZE (   X)    STRINGIZE_(X)

◆ STRINGIZE_

#define STRINGIZE_ (   X)    #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

◆ C_isalnum()

bool C_isalnum ( char  ch)
inline

◆ C_isalpha()

bool C_isalpha ( char  ch)
inline

Definition at line 155 of file stringutils.h.

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

Referenced by C_isnotalpha(), and test_chartype1().

◆ C_isdigit()

bool C_isdigit ( char  ch)
inline

Definition at line 134 of file stringutils.h.

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

Referenced by C_isnotdigit(), and test_chartype1().

◆ C_islower()

bool C_islower ( char  ch)
inline

Definition at line 150 of file stringutils.h.

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

Referenced by C_isnotlower(), and test_chartype1().

◆ C_isnotalnum()

bool C_isnotalnum ( char  ch)
inline

Definition at line 175 of file stringutils.h.

References C_isalnum().

Referenced by test_chartype1().

◆ C_isnotalpha()

bool C_isnotalpha ( char  ch)
inline

Definition at line 174 of file stringutils.h.

References C_isalpha().

Referenced by test_chartype1().

◆ C_isnotdigit()

bool C_isnotdigit ( char  ch)
inline

Definition at line 170 of file stringutils.h.

References C_isdigit().

Referenced by test_chartype1().

◆ C_isnotlower()

bool C_isnotlower ( char  ch)
inline

Definition at line 173 of file stringutils.h.

References C_islower().

Referenced by test_chartype1().

◆ C_isnotspace()

bool C_isnotspace ( char  ch)
inline

Definition at line 176 of file stringutils.h.

References C_isspace().

Referenced by get_paragraph(), FileIndexer::index_to(), make_tg_db(), and test_chartype1().

◆ C_isnotupper()

bool C_isnotupper ( char  ch)
inline

Definition at line 172 of file stringutils.h.

References C_isupper().

Referenced by test_chartype1().

◆ C_isnotxdigit()

bool C_isnotxdigit ( char  ch)
inline

Definition at line 171 of file stringutils.h.

References C_isxdigit().

Referenced by test_chartype1().

◆ C_isspace()

bool C_isspace ( char  ch)
inline

◆ C_isupper()

bool C_isupper ( char  ch)
inline

Definition at line 145 of file stringutils.h.

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

Referenced by C_isnotupper(), and test_chartype1().

◆ C_isxdigit()

bool C_isxdigit ( char  ch)
inline

◆ C_tab_()

unsigned char C_tab_ ( char  ch)
inline

◆ C_tolower()

char C_tolower ( char  ch)
inline

Definition at line 178 of file stringutils.h.

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

Referenced by check_db_table(), munge_term(), and HostFieldProcessor::operator()().

◆ C_toupper()

char C_toupper ( char  ch)
inline

Definition at line 183 of file stringutils.h.

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

Referenced by Xapian::QueryParser::Internal::parse_query().

◆ common_prefix_length()

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

◆ endswith() [1/4]

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

◆ endswith() [2/4]

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

Definition at line 76 of file stringutils.h.

◆ endswith() [3/4]

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

Definition at line 82 of file stringutils.h.

References endswith().

◆ endswith() [4/4]

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

Definition at line 88 of file stringutils.h.

References endswith().

◆ hex_digit()

int hex_digit ( char  ch)
inline

Definition at line 188 of file stringutils.h.

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

Referenced by munge_term(), Uuid::parse(), test_chartype1(), and unescape().

◆ startswith() [1/4]

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

◆ startswith() [2/4]

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

Definition at line 52 of file stringutils.h.

◆ startswith() [3/4]

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

Definition at line 58 of file stringutils.h.

References startswith().

◆ startswith() [4/4]

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

Definition at line 64 of file stringutils.h.

References startswith().