Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

directory.h File Reference

Directory structures. More...

#include <libcomprex/fsnode.h>
#include <libcomprex/file.h>

Go to the source code of this file.

Data Structures

struct  _CxDirectoryData
 The data specific to a directory node. More...


Structure (De)allocation Functions

CxDirectorycxNewDirectory (void)
 Creates a new CxDirectory structure.

void cxDestroyDirectory (CxDirectory *dir)
 Destroys a CxDirectory structure.


Attribute Modification Functions

void cxSetDirArchive (CxDirectory *dir, CxArchive *archive)
 Sets the archive that owns the directory.

void cxSetDirParent (CxDirectory *dir, CxDirectory *parent)
 Sets the specified directory's parent directory.

void cxSetDirName (CxDirectory *dir, const char *name)
 Sets the base directory name of this directory.

void cxSetDirPhysicalPath (CxDirectory *dir, const char *path)
 Sets the full physical path to the directory.

void cxSetDirMode (CxDirectory *dir, mode_t mode)
 Sets the mode of the specified directory.

void cxSetDirGid (CxDirectory *dir, gid_t gid)
 Sets the group ID of the specified directory.

void cxSetDirUid (CxDirectory *dir, uid_t uid)
 Sets the user ID of the specified directory.

void cxSetDirDate (CxDirectory *dir, time_t date)
 Set the timestamp of the specified directory.

void cxSetDirLocal (CxDirectory *dir, char isLocal)
 Sets whether or not the file is stored locally.


Attribute Retrieval Functions

CxArchivecxGetDirArchive (CxDirectory *dir)
 Returns the archive that owns the specified directory.

CxDirectorycxGetDirParent (CxDirectory *dir)
 Returns the specified directory's parent directory.

const char * cxGetDirName (CxDirectory *dir)
 Returns the base directory name of the specified directory.

const char * cxGetDirPath (CxDirectory *dir)
 Returns the full path name of the specified directory.

unsigned int cxGetFileCount (CxDirectory *dir)
 Returns the number of files in the specified directory.

const char * cxGetDirPhysicalPath (CxDirectory *dir)
 Returns the full physical path to the directory.

mode_t cxGetDirMode (CxDirectory *dir)
 Return the mode of the specified directory.

uid_t cxGetDirUid (CxDirectory *dir)
 Returns the user ID of the specified directory.

gid_t cxGetDirGid (CxDirectory *dir)
 Returns the group ID of the specified directory.

time_t cxGetDirDate (CxDirectory *dir)
 Returns the timestamp of the specified directory.

char cxIsDirLocal (CxDirectory *dir)
 Returns whether or not the directory is stored locally.

unsigned int cxGetSubDirCount (CxDirectory *dir)
 Returns the number of subdirectories in the specified directory.


Directory Processing Functions

CxDirectorycxGetDirectory (CxDirectory *base, const char *path)
 Returns the subdirectory specified in the path.

CxFilecxGetFile (CxDirectory *base, const char *path)
 Returns the file specified in the path.


Directory Modification Functions

CxDirectorycxMkDir (CxDirectory *base, const char *path)
 Creates a directory.

void cxDirAddFile (CxDirectory *dir, CxFile *file)
 Adds a file to the directory.

void cxDirAddSubDir (CxDirectory *dir, CxDirectory *subdir)
 Adds a subdirectory to a directory.

void cxDirRemoveFile (CxDirectory *dir, CxFile *file)
 Removes a file from the directory.

void cxDirRemoveSubDir (CxDirectory *dir, CxDirectory *subdir)
 Removes a subdirectory from the directory.


Iteration Functions

CxFilecxGetFirstFile (CxDirectory *dir)
 Returns the first file in the directory.

CxDirectorycxGetFirstSubDir (CxDirectory *dir)
 Returns the first subdirectory in the directory.

CxDirectorycxGetPreviousDir (CxDirectory *dir)
 Returns the previous directory in a list of directories.

CxDirectorycxGetNextDir (CxDirectory *dir)
 Returns the next directory in a list of directories.


Typedefs

typedef _CxFsNode CxDirectory
 CxDirectory.

typedef _CxDirectoryData CxDirectoryData
 Directory data.


Detailed Description

Directory structures.

Copyright:
(C) 2001-2003 The GNUpdate Project.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Typedef Documentation

typedef struct _CxFsNode CxDirectory
 

CxDirectory.

typedef struct _CxDirectoryData CxDirectoryData
 

Directory data.


Function Documentation

void cxDestroyDirectory CxDirectory   dir
 

Destroys a CxDirectory structure.

Parameters:
dir The CxDirectory to destroy.
See also:
cxNewDirectory()

void cxDirAddFile CxDirectory   dir,
CxFile   file
 

Adds a file to the directory.

Note that this won't actually create a file in that directory. This just modifies the structure itself!

The directory will claim the reference on file, and will delete the structure when dir is deleted. If you wish to keep file intact, you must claim a reference to it using CX_LINK().

Parameters:
dir The directory.
file The file to add.
See also:
CxFile

cxDirAddSubDir()

cxDirRemoveFile()

cxDirRemoveSubDir()

void cxDirAddSubDir CxDirectory   dir,
CxDirectory   subdir
 

Adds a subdirectory to a directory.

Note that this won't actually create a subdirectory in that directory. This just modifies the structure itself!

The directory will claim the reference on subdir, and will delete the structure when dir is deleted. If you wish to keep subdir intact, you must claim a reference to it using CX_LINK().

Parameters:
dir The directory.
subdir The subdirectory to add.
See also:
CxDirectory

cxDirAddFile()

cxDirRemoveFile()

cxDirRemoveSubDir()

void cxDirRemoveFile CxDirectory   dir,
CxFile   file
 

Removes a file from the directory.

Note that this won't actually remove the file from the archive. This just modifies the structure itself!

Parameters:
dir The directory.
file The file to remove.
See also:
CxFile

cxDirAddFile()

cxDirAddSubDir()

cxDirRemoveSubDir()

void cxDirRemoveSubDir CxDirectory   dir,
CxDirectory   subdir
 

Removes a subdirectory from the directory.

Note that this won't actually remove the subdirectory from the archive. This just modifies the structure itself!

Parameters:
dir The directory.
subdir The subdirectory to remove.
See also:
CxFile

cxDirAddFile()

cxDirAddSubDir()

cxDirRemoveFile()

CxArchive* cxGetDirArchive CxDirectory   dir
 

Returns the archive that owns the specified directory.

Parameters:
dir The directory.
Returns:
The archive that owns this directory.
See also:
cxSetDirArchive()

time_t cxGetDirDate CxDirectory   dir
 

Returns the timestamp of the specified directory.

Parameters:
dir The directory.
Returns:
The date/time timestamp in seconds since the epoch.
See also:
cxSetDirDate(CxDirectory *dir)

CxDirectory* cxGetDirectory CxDirectory   base,
const char *    path
 

Returns the subdirectory specified in the path.

Parameters:
base The base directory.
path The path.
Returns:
The subdirectory, or NULL if not found.
See also:
cxGetFile()

gid_t cxGetDirGid CxDirectory   dir
 

Returns the group ID of the specified directory.

Parameters:
dir The directory.
Returns:
The group ID of the specified directory.
See also:
cxSetDirGid()

mode_t cxGetDirMode CxDirectory   dir
 

Return the mode of the specified directory.

Parameters:
dir The directory.
Returns:
The directory's mode.
See also:
cxSetDirMode()

const char* cxGetDirName CxDirectory   dir
 

Returns the base directory name of the specified directory.

Parameters:
dir The directory.
Returns:
The base directory name of the specified directory.
See also:
cxSetDirName()

CxDirectory* cxGetDirParent CxDirectory   dir
 

Returns the specified directory's parent directory.

Parameters:
dir The directory.
Returns:
The specified directory's parent directory.
See also:
cxSetDirParent()

const char* cxGetDirPath CxDirectory   dir
 

Returns the full path name of the specified directory.

Parameters:
dir The directory.
Returns:
The full path name.
See also:
cxSetDirPath()

const char* cxGetDirPhysicalPath CxDirectory   dir
 

Returns the full physical path to the directory.

If the directory is non-local, this will be a temporary directory.

Parameters:
dir The directory.
Returns:
The physical path to the directory.
See also:
cxSetDirPhysicalPath()

cxGetDirPath()

cxSetDirPath()

uid_t cxGetDirUid CxDirectory   dir
 

Returns the user ID of the specified directory.

Parameters:
dir The directory.
Returns:
The user ID of the specified directory.
See also:
cxSetDirUid()

CxFile* cxGetFile CxDirectory   base,
const char *    path
 

Returns the file specified in the path.

Parameters:
base The base directory.
path The path.
Returns:
The file, or NULL if not found.
See also:
cxGetDirectory()

unsigned int cxGetFileCount CxDirectory   dir
 

Returns the number of files in the specified directory.

Parameters:
dir The directory.
Returns:
The number of files in the specified directory.
See also:
cxGetSubDirCount()

CxFile* cxGetFirstFile CxDirectory   dir
 

Returns the first file in the directory.

Parameters:
dir The directory.
Returns:
The first file in the directory.
See also:
cxGetFirstSubDir()

cxGetNextFile()

cxGetPreviousFile()

CxDirectory* cxGetFirstSubDir CxDirectory   dir
 

Returns the first subdirectory in the directory.

Parameters:
dir The directory.
Returns:
The first subdirectory in the directory.
See also:
cxGetFirstFile()

cxGetNextDir()

cxGetPreviousDir()

CxDirectory* cxGetNextDir CxDirectory   dir
 

Returns the next directory in a list of directories.

Parameters:
dir The current directory.
Returns:
The next directory in the list.
See also:
cxGetFirstSubDir()

cxGetPreviousDir()

CxDirectory* cxGetPreviousDir CxDirectory   dir
 

Returns the previous directory in a list of directories.

Parameters:
dir The current directory.
Returns:
The previous directory in the list.
See also:
cxGetFirstSubDir()

cxGetNextDir()

unsigned int cxGetSubDirCount CxDirectory   dir
 

Returns the number of subdirectories in the specified directory.

Parameters:
dir The directory.
Returns:
The number of subdirectories in the specified directory.
See also:
cxGetFileCount()

char cxIsDirLocal CxDirectory   dir
 

Returns whether or not the directory is stored locally.

If the directory is located online, or within an archive, this will be 0. Otherwise, this will be 1.

Parameters:
dir The directory.
Returns:
1 if the file is stored locally; 0 otherwise.
See also:
cxSetDirLocal()

CxDirectory* cxMkDir CxDirectory   base,
const char *    path
 

Creates a directory.

This is equivalent to mkdir -p. That is, it will create each directory in the path if they don't exist.

Parameters:
base The base directory.
path The path of directories to create.
Returns:
The inner-most subdirectory.

CxDirectory* cxNewDirectory void   
 

Creates a new CxDirectory structure.

This does NOT create a new directory. For that, use cxMkDir().

Returns:
A new, empty CxDirectory structure.
See also:
cxDestroyDirectory()

void cxSetDirArchive CxDirectory   dir,
CxArchive   archive
 

Sets the archive that owns the directory.

This should only be used by libcomprex.

Parameters:
dir The directory.
archive The archive that owns this directory.
See also:
cxGetDirArchive()

void cxSetDirDate CxDirectory   dir,
time_t    date
 

Set the timestamp of the specified directory.

Parameters:
dir The directory.
date The date/time timestamp in seconds since the epoch.
See also:
cxGetDirDate()

void cxSetDirGid CxDirectory   dir,
gid_t    gid
 

Sets the group ID of the specified directory.

Parameters:
dir The directory.
gid The group ID.
See also:
cxGetFileGid()

void cxSetDirLocal CxDirectory   dir,
char    isLocal
 

Sets whether or not the file is stored locally.

If the directory is located online, or within an archive, this should be 0. Otherwise, this should be 1.

Parameters:
dir The directory.
isLocal 1 if the file is stored locally; 0 otherwise.
See also:
cxIsDirLocal()

void cxSetDirMode CxDirectory   dir,
mode_t    mode
 

Sets the mode of the specified directory.

Parameters:
dir The directory.
mode The mode to be set.
See also:
cxGetDirMode()

void cxSetDirName CxDirectory   dir,
const char *    name
 

Sets the base directory name of this directory.

Parameters:
dir The directory.
name The base directory name.
See also:
cxGetDirName()

void cxSetDirParent CxDirectory   dir,
CxDirectory   parent
 

Sets the specified directory's parent directory.

Parameters:
dir The directory.
parent The parent directory.
See also:
cxGetDirParent()

void cxSetDirPhysicalPath CxDirectory   dir,
const char *    path
 

Sets the full physical path to the directory.

Parameters:
dir The directory.
path The physical path to the directory.
See also:
cxSetDirPath()

cxGetDirPhysicalPath()

cxGetDirPath()

void cxSetDirUid CxDirectory   dir,
uid_t    uid
 

Sets the user ID of the specified directory.

Parameters:
dir The directory.
uid The user ID.
See also:
cxGetDirUid()


Generated on Wed Mar 5 20:47:43 2003 for libcomprex by doxygen1.2.18-20021020