common/utils.cc File Reference

#include <config.h>
#include "utils.h"
#include <stdio.h>
#include <cfloat>
#include <cmath>

Include dependency graph for utils.cc:

Go to the source code of this file.

Namespaces

namespace  Xapian
namespace  Xapian::Internal

Defines

#define BUFSIZE   100
#define CONVERT_TO_STRING(FMT)

Functions

string om_tostring (int val)
 Convert an integer to a string.
string om_tostring (unsigned int val)
 Convert an unsigned integer to a string.
string om_tostring (long int val)
 Convert a long integer to a string.
string om_tostring (unsigned long int val)
 Convert an unsigned long integer to a string.
string om_tostring (double val)
 Convert a double to a string.
string om_tostring (const void *val)
 Convert a pointer to a string.
string om_tostring (bool val)
 Convert a bool to a string.
bool file_exists (const string &fname)
 Return true if the file fname exists.
bool dir_exists (const string &fname)
 Return true if the directory dirname exists.
bool Xapian::Internal::within_DBL_EPSILON (double a, double b)


Define Documentation

#define BUFSIZE   100

Definition at line 34 of file utils.cc.

#define CONVERT_TO_STRING ( FMT   ) 

Value:

char buf[BUFSIZE];\
    buf[BUFSIZE - 1] = '\0';\
    sprintf(buf, (FMT), val);\
    if (buf[BUFSIZE - 1]) abort(); /* Uh-oh, buffer overrun */ \
    return string(buf);

Definition at line 43 of file utils.cc.

Referenced by om_tostring().


Function Documentation

string om_tostring ( int  val  ) 

Convert an integer to a string.

Definition at line 53 of file utils.cc.

Referenced by Btree::add(), QuartzDatabase::apply(), QuartzDatabase::create_and_open_tables(), DEFINE_TESTCASE(), InMemoryDatabase::delete_document(), QuartzRecordTable::delete_record(), FlintRecordTable::delete_record(), FlintTermList::FlintTermList(), Item_wr_::form_key(), format_doc_termlist(), QuartzDatabase::get_database_write_lock(), Xapian::TermGenerator::get_description(), ValueRangePostList::get_description(), ValueGePostList::get_description(), Stats::get_description(), PhrasePostList::get_description(), NearPostList::get_description(), QuartzPostList::get_description(), QuartzAllDocsPostList::get_description(), MultiPostList::get_description(), InMemoryAllDocsPostList::get_description(), InMemoryPostList::get_description(), FlintPostList::get_description(), FlintAllDocsPostList::get_description(), ContiguousAllDocsPostList::get_description(), Xapian::ValueIterator::get_description(), Xapian::Query::Internal::get_description(), Xapian::MSetIterator::get_description(), Xapian::ESetIterator::get_description(), Xapian::ESet::Internal::get_description(), Xapian::Internal::ESetItem::get_description(), Xapian::MSet::Internal::get_description(), Xapian::Internal::MSetItem::get_description(), Xapian::RSet::Internal::get_description(), Xapian::Document::Internal::get_description(), OmDocumentTerm::get_description(), Xapian::MSet::Internal::get_doc_by_index(), InMemoryDatabase::get_doclength(), FlintTermListTable::get_doclength(), Xapian::Error::get_error_string(), RemoteServer::get_message(), RemoteDatabase::get_message(), QuartzRecordTable::get_record(), FlintRecordTable::get_record(), TcpClient::get_tcpcontext(), QuartzPostList::next(), QuartzPositionList::next(), QuartzAllDocsPostList::next(), FlintPostList::next(), QuartzPostList::next_chunk(), FlintPostList::next_chunk(), QuartzMetaFile::open(), InMemoryDatabase::open_document(), InMemoryDatabase::open_position_list(), Xapian::open_stub(), QuartzDatabase::open_tables(), QuartzDatabase::open_tables_consistent(), InMemoryDatabase::open_term_list(), QuartzDocIdListIterator::operator++(), QuartzDatabase::QuartzDatabase(), QuartzTermList::QuartzTermList(), FlintVersion::read_and_check(), Btree::read_block(), FlintTable::read_block(), FlintTable::read_tag(), RemoteDatabase::RemoteDatabase(), OmDocumentTerm::remove_position(), Xapian::Document::Internal::remove_value(), RemoteServer::run(), Xapian::Query::Internal::serialise(), QuartzPostList::skip_to(), QuartzPositionList::skip_to(), QuartzAllDocsPostList::skip_to(), FlintPostList::skip_to(), test_bitmap1(), test_overwrite1(), test_qp_value_range3(), test_tostring1(), and Xapian::Query::Internal::validate_query().

string om_tostring ( unsigned int  val  ) 

Convert an unsigned integer to a string.

Definition at line 59 of file utils.cc.

string om_tostring ( long int  val  ) 

Convert a long integer to a string.

Definition at line 65 of file utils.cc.

string om_tostring ( unsigned long int  val  ) 

Convert an unsigned long integer to a string.

Definition at line 71 of file utils.cc.

string om_tostring ( double  val  ) 

Convert a double to a string.

Definition at line 88 of file utils.cc.

string om_tostring ( const void *  val  ) 

Convert a pointer to a string.

Definition at line 94 of file utils.cc.

string om_tostring ( bool  val  ) 

Convert a bool to a string.

Definition at line 100 of file utils.cc.

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 Btree::exists(), FlintTable::exists(), test_driver::get_srcdir(), main(), QuartzDatabase::QuartzDatabase(), test_insertdelete1(), test_sequent1(), and Xapian::WritableDatabase::WritableDatabase().

bool dir_exists ( const string &  fname  ) 

Return true if the directory dirname exists.

Definition at line 118 of file utils.cc.

References S_ISDIR, and stat().

Referenced by main().


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