jigdo API

compat.hh File Reference

Cross-platform compatibility support. More...

#include <config.h>
#include <string>
#include <stdio.h>
#include <unistd-jigdo.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <db.h>

Go to the source code of this file.


Functions

int compat_truncate (const char *path, uint64 length)
 Truncate a file to a given length.
int compat_rename (const char *src, const char *dst)
 Rename a file.
int compat_mkdir (const char *newDir)
 Create a directory.
bool compat_setenv (const char *name, const char *value)
 Set/overwrite environment variable, return SUCCESS or FAILURE.
int ttyWidth ()
 Width in characters of the tty (for progress display), or 0 if not a tty or functions not present on system.
void compat_swapFileUriChars (string &s)
 (For "file:" URI handling) If directory separator on this system is not '/', exchange the actual separator for '/' and vice versa in the supplied string.
int compat_compare (const string &s1, string::size_type pos1, string::size_type n1, const string &s2, string::size_type pos2=0, string::size_type n2=string::npos)
 Three-way comparison between arbitrary substrings.
int compat_compare (const string &s1, string::size_type pos1, string::size_type n1, const char *s2, string::size_type n2=string::npos)
 Three-way comparison between arbitrary substrings.
int compat_dbOpen (DB *db, const char *file, const char *database, DBTYPE type, u_int32_t flags, int mode)

Detailed Description

Cross-platform compatibility support.


Function Documentation

int compat_compare ( const string &  s1,
string::size_type  pos1,
string::size_type  n1,
const char *  s2,
string::size_type  n2 = string::npos 
) [inline]

Three-way comparison between arbitrary substrings.

int compat_compare ( const string &  s1,
string::size_type  pos1,
string::size_type  n1,
const string &  s2,
string::size_type  pos2 = 0,
string::size_type  n2 = string::npos 
) [inline]

Three-way comparison between arbitrary substrings.

Referenced by JigdoDesc::isTemplate(), MkTemplate::PartIndex::operator()(), UrlMapping::parseOptions(), and uriJoin().

int compat_dbOpen ( DB *  db,
const char *  file,
const char *  database,
DBTYPE  type,
u_int32_t  flags,
int  mode 
) [inline]

References NULL.

Referenced by CacheFile::CacheFile().

int compat_mkdir ( const char *  newDir  )  [inline]

Create a directory.

Referenced by Job::MakeImageDl::run().

int compat_rename ( const char *  src,
const char *  dst 
) [inline]

Rename a file.

Mingw does provide rename(), but gives an error if the destination name already exists. This one doesn't.

Referenced by JigdoDesc::makeImage().

bool compat_setenv ( const char *  name,
const char *  value 
) [inline]

Set/overwrite environment variable, return SUCCESS or FAILURE.

void compat_swapFileUriChars ( string &  s  )  [inline]

(For "file:" URI handling) If directory separator on this system is not '/', exchange the actual separator for '/' and vice versa in the supplied string.

Do the same for any non-'.' file extension separator. We trust in the optimizer to remove unnecessary code.

int compat_truncate ( const char *  path,
uint64  length 
) [inline]

Truncate a file to a given length.

Behaviour undefined if given length is bigger than current file size

Referenced by writeMerge().

int ttyWidth (  ) 

Width in characters of the tty (for progress display), or 0 if not a tty or functions not present on system.


Generated on Tue Sep 23 14:27:42 2008 for jigdo by  doxygen 1.5.6