common/utils.h File Reference

#include <xapian/visibility.h>
#include <string>
#include <cstdlib>
#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.


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)


Function Documentation

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  ) 

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

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]

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]


Documentation for Xapian (version 1.2.8).
Generated on 14 Dec 2011 by Doxygen 1.5.9.