common/utils.h File Reference

#include <xapian/visibility.h>
#include <string>
#include <stdlib.h>
#include <sys/types.h>
#include "safesysstat.h"
#include "safeunistd.h"

Include dependency graph for utils.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

Functions

string om_tostring (const string &s)
 Convert a string to a string!
string om_tostring (int a)
 Convert an integer to a string.
string om_tostring (unsigned int a)
 Convert an unsigned integer to a string.
string om_tostring (long int a)
 Convert a long integer to a string.
string om_tostring (unsigned long int a)
 Convert an unsigned long integer to a string.
string om_tostring (double a)
 Convert a double to a string.
string om_tostring (bool a)
 Convert a bool to a string.
string om_tostring (const void *a)
 Convert a pointer to a string.
bool file_exists (const string &fname)
 Return true if the file fname exists.
bool dir_exists (const string &dirname)
 Return true if the directory dirname exists.
int atoi (const string &s)
 Allow atoi to work directly on C++ strings.
int unlink (const string &filename)
 Allow unlink to work directly on C++ strings.
int system (const string &command)
 Allow system to work directly on C++ strings.
int mkdir (const string &filename, mode_t mode)
 Allow mkdir to work directly on C++ strings.
int stat (const string &filename, struct stat *buf)
 Allow stat to work directly on C++ strings.
bool Xapian::Internal::within_DBL_EPSILON (double a, double b)


Function Documentation

string om_tostring ( const string &  s  )  [inline]

Convert a string to a string!

Definition at line 37 of file utils.h.

string om_tostring ( int  a  ) 

Convert an integer to a string.

Definition at line 53 of file utils.cc.

References CONVERT_TO_STRING.

string om_tostring ( unsigned int  a  ) 

Convert an unsigned integer to a string.

Definition at line 59 of file utils.cc.

References CONVERT_TO_STRING.

string om_tostring ( long int  a  ) 

Convert a long integer to a string.

Definition at line 65 of file utils.cc.

References CONVERT_TO_STRING.

string om_tostring ( unsigned long int  a  ) 

Convert an unsigned long integer to a string.

Definition at line 71 of file utils.cc.

References CONVERT_TO_STRING.

string om_tostring ( double  a  ) 

Convert a double to a string.

Definition at line 88 of file utils.cc.

References CONVERT_TO_STRING.

string om_tostring ( bool  a  ) 

Convert a bool to a string.

Definition at line 100 of file utils.cc.

string om_tostring ( const void *  a  ) 

Convert a pointer to a string.

Definition at line 94 of file utils.cc.

References CONVERT_TO_STRING.

bool file_exists ( const string &  fname  ) 

Return true if the file fname exists.

Definition at line 108 of file utils.cc.

References S_ISREG, and stat().

Referenced by FlintTable::exists(), Btree::exists(), test_driver::get_srcdir(), main(), QuartzDatabase::QuartzDatabase(), test_insertdelete1(), test_sequent1(), and Xapian::WritableDatabase::WritableDatabase().

bool dir_exists ( const string &  dirname  ) 

Return true if the directory dirname exists.

Definition at line 118 of file utils.cc.

References S_ISDIR, and stat().

Referenced by main().

int atoi ( const string &  s  )  [inline]

Allow atoi to work directly on C++ strings.

Definition at line 83 of file utils.h.

Referenced by decode_xxy(), FlintWritableDatabase::FlintWritableDatabase(), main(), Xapian::open_stub(), QuartzWritableDatabase::QuartzWritableDatabase(), ReportTable(), and test_termgen1().

int unlink ( const string &  filename  )  [inline]

Allow unlink to work directly on C++ strings.

Definition at line 86 of file utils.h.

Referenced by Btree::commit(), FlintTable::commit(), DEFINE_TESTCASE(), QuartzDatabase::get_database_write_lock(), multimerge_postlists(), test_driver::parse_command_line(), QuartzDatabase::release_database_write_lock(), sys_unlink(), sys_unlink_if_exists(), and unlink_table().

int system ( const string &  command  )  [inline]

Allow system to work directly on C++ strings.

Definition at line 89 of file utils.h.

Referenced by cp_R(), DEFINE_TESTCASE(), and rm_rf().

int mkdir ( const string &  filename,
mode_t  mode 
) [inline]

Allow mkdir to work directly on C++ strings.

Definition at line 99 of file utils.h.

Referenced by cp_R(), DEFINE_TESTCASE(), FlintDatabase::FlintDatabase(), main(), make_dir(), makedir(), QuartzDatabase::QuartzDatabase(), test_qp_spell1(), test_qp_spell2(), test_qp_stem_scale1(), test_qp_synonym1(), test_qp_synonym2(), test_qp_synonym3(), and test_tg_spell1().

int stat ( const string &  filename,
struct stat *  buf 
) [inline]

Allow stat to work directly on C++ strings.

Definition at line 104 of file utils.h.

Referenced by DEFINE_TESTCASE(), dir_exists(), file_exists(), FlintDatabase::FlintDatabase(), QuartzDatabase::get_database_write_lock(), get_filesize(), main(), QuartzDatabase::QuartzDatabase(), removedir(), rm_rf(), and unserialise_stats().


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