Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

directory.h File Reference

Directory structures. More...

#include <libcomprex/file.h>

Go to the source code of this file.

Data Structures

struct  _CxDirectory
 A representation of a directory on the filesystem or in an archive. 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 cxSetDirectoryName (CxDirectory *dir, const char *name)
 Sets the path name of this directory.


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 * cxGetDirectoryName (CxDirectory *dir)
 Returns the path name of the specified directory.

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

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

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 _CxDirectory CxDirectory
 CxDirectory.


Detailed Description

Directory structures.

Id:
directory.h,v 1.10 2002/05/25 19:55:36 chipx86 Exp
Copyright:
(C) 2001-2002 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 _CxDirectory CxDirectory
 

CxDirectory.


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()

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()

const char* cxGetDirectoryName CxDirectory   dir
 

Returns the path name of the specified directory.

Parameters:
dir  The directory.
Returns:
The path name of the specified directory.
See also:
cxSetDirectoryName()

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()

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()

CxDirectory* cxNewDirectory void   
 

Creates a new CxDirectory structure.

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

Todo:
Implement 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 cxSetDirectoryName CxDirectory   dir,
const char *    name
 

Sets the path name of this directory.

Parameters:
dir  The directory.
name  The new path name.
See also:
cxGetDirectoryName()

void cxSetDirParent CxDirectory   dir,
CxDirectory   parent
 

Sets the specified directory's parent directory.

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


Generated on Wed May 29 12:20:35 2002 for libcomprex by doxygen1.2.15-20020430