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


Go to the source code of this file.
Classes | |
| class | fdcloser |
| A tiny class used to close a filehandle safely in the presence of exceptions. More... | |
Namespaces | |
| namespace | Xapian |
| The Xapian namespace contains public interfaces for the Xapian library. | |
| namespace | Xapian::Internal |
Functions | |
| 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 | 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. | |
| void | removedir (const string &dirname) |
| Remove a directory, and its contents. | |
| bool | Xapian::Internal::within_DBL_EPSILON (double a, double b) |
| bool dir_exists | ( | const string & | dirname | ) |
Return true if the directory dirname exists.
Definition at line 46 of file utils.cc.
References S_ISDIR, and stat().
Referenced by DEFINE_TESTCASE(), Xapian::DatabaseReplica::Internal::Internal(), and main().
| bool file_exists | ( | const string & | fname | ) |
Return true if the file fname exists.
Definition at line 38 of file utils.cc.
References S_ISREG, and stat().
Referenced by BackendManagerMulti::createdb_multi(), Xapian::Database::Database(), DEFINE_TESTCASE(), FlintTable::exists(), ChertTable::exists(), BrassTable::exists(), test_driver::get_srcdir(), main(), Xapian::DatabaseReplicator::open(), FlintDatabaseReplicator::process_changeset_chunk_blocks(), ChertDatabaseReplicator::process_changeset_chunk_blocks(), BrassDatabaseReplicator::process_changeset_chunk_blocks(), and Xapian::WritableDatabase::WritableDatabase().
| int mkdir | ( | const string & | filename, | |
| mode_t | mode | |||
| ) | [inline] |
Allow mkdir to work directly on C++ strings.
Definition at line 53 of file utils.h.
Referenced by Xapian::DatabaseReplica::Internal::apply_db_copy(), BrassDatabase::BrassDatabase(), ChertDatabase::ChertDatabase(), Xapian::Compactor::Internal::compact(), cp_R(), BackendManager::create_dir_if_needed(), DEFINE_TESTCASE(), FlintDatabase::FlintDatabase(), Xapian::DatabaseReplica::Internal::Internal(), main(), mktmpdir(), test_qp_scale1(), test_qp_spell1(), test_qp_spell2(), test_qp_spellpartial1(), test_qp_spellwild1(), test_qp_synonym1(), test_qp_synonym2(), test_qp_synonym3(), and test_tg_spell1().
| void removedir | ( | const string & | dirname | ) |
Remove a directory, and its contents.
If dirname doesn't refer to a file or directory, no error is generated.
Note - this doesn't currently cope with directories which contain subdirectories.
Definition at line 66 of file utils.cc.
References dirent::d_name, opendir(), readdir(), and unlink().
Referenced by Xapian::DatabaseReplica::Internal::apply_db_copy(), and Xapian::DatabaseReplica::Internal::remove_offline_db().
| int stat | ( | const string & | filename, | |
| struct stat * | buf | |||
| ) | [inline] |
Allow stat to work directly on C++ strings.
Definition at line 58 of file utils.h.
Referenced by Xapian::Compactor::Internal::add_source(), BrassDatabase::BrassDatabase(), ChertDatabase::ChertDatabase(), Xapian::Compactor::Internal::compact(), compact_brass(), compact_chert(), compact_flint(), BackendManager::create_dir_if_needed(), Xapian::Database::Database(), DEFINE_TESTCASE(), dir_exists(), FlintVersion::ensure_uuid(), file_exists(), file_size(), FlintDatabase::FlintDatabase(), main(), rm_rf(), RemoteConnection::send_file(), Xapian::Compactor::Internal::set_destdir(), unserialise_stats(), and Xapian::WritableDatabase::WritableDatabase().
| int system | ( | const string & | command | ) | [inline] |
Allow system to work directly on C++ strings.
Definition at line 50 of file utils.h.
Referenced by cp_R(), DEFINE_TESTCASE(), and rm_rf().
| int unlink | ( | const string & | filename | ) | [inline] |
Allow unlink to work directly on C++ strings.
Definition at line 47 of file utils.h.
Referenced by FlintTable::commit(), ChertTable::commit(), BrassTable::commit(), DEFINE_TESTCASE(), io_unlink(), FlintCompact::multimerge_postlists(), ChertCompact::multimerge_postlists(), BrassCompact::multimerge_postlists(), test_driver::parse_command_line(), FlintDatabaseReplicator::process_changeset_chunk_base(), ChertDatabaseReplicator::process_changeset_chunk_base(), BrassDatabaseReplicator::process_changeset_chunk_base(), and removedir().