Files

Copyright 2008, 2012 Neil Edelman, distributed under the terms of the GNU General Public License, see copying.txt, or https://opensource.org/licenses/GPL-3.0.

Files is a list of File (private class defiend below,) the Files can have a relation to other Files by 'parent' and 'favourite' (@(pwd) uses this.)

minimum standard
C89/90
author
Neil
version
1.1; 2017-03 fixed pedantic warnings; took out arg
since
0.6; 2008-03-24

Declarations

struct Files

struct Files

See Files.

typedef int (*FilesFilter)(const struct Files *, const char *)

typedef int (*FilesFilter)(const struct Files *, const char *)

Returns a boolean value.

Function Summary

Return TypeFunction NameArgument List
struct Files * Files const struct Files *parent, const FilesFilter filter
void Files_ struct Files *files
int FilesAdvance struct Files *f
int FilesIsRoot const struct Files *f
void FilesSetPath struct Files *f
char * FilesEnumPath struct Files *f
char * FilesName const struct Files *files
int FilesSize const struct Files *files
int FilesIsDir const struct Files *files

Function Detail

Files

struct Files * Files (const struct Files *parent, const FilesFilter filter)

parent->this must be the 'file' (directory) that you want to create

Files_

void Files_ (struct Files *files)

Destructor.

FilesAdvance

int FilesAdvance (struct Files *f)

This is how we access the files sequentially.

FilesIsRoot

int FilesIsRoot (const struct Files *f)

Doesn't have a parent?

FilesSetPath

void FilesSetPath (struct Files *f)

Resets the list of favourites.

FilesEnumPath

char * FilesEnumPath (struct Files *f)

After FilesSetFarourite, this enumerates them.

FilesName

char * FilesName (const struct Files *files)
return
The file name of the selected file.

FilesSize

int FilesSize (const struct Files *files)
return
File size of the selected file.

FilesIsDir

int FilesIsDir (const struct Files *files)
return
Whether the file is a directory.