Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ift.h File Reference

Go to the source code of this file.

Data Structures

struct  IFT_KEY_AND_VALUE
struct  IFT

Functions

void libift_printdate (FILE *fp)
void iftSetStatus (IFT *ift, int status)
void iftInit (IFT *ift)
void iftEmpty (IFT *ift)
int iftPut (IFT *ift, char *key, char *value, char *cmt_type)
int iftRead (IFT *ift, char *filename, int is_key_required)
int iftWriteItem (IFT *ift, int item, FILE *fp)
int iftWrite (IFT *ift, char *filename)
int iftGet (IFT *ift, char *key)
int iftGetNth (IFT *ift, char *key, int n)
int iftFindNthKey (IFT *ift, char *str, int n)
int iftFindNthValue (IFT *ift, char *str, int n)
int iftDeleteItem (IFT *ift, int item)
int iftReplaceNthValue (IFT *ift, int item, char *value)

Variables

int IFT_TEST


Function Documentation

int iftDeleteItem IFT ift,
int  item
 

Remove the specified item from IFT.

Returns:
Returns 0 if ok.
Parameters:
ift  Pointer to existing IFT
item  Index [0..keyNr-1] of key and value to delete

void iftEmpty IFT ift  ) 
 

Free memory allocated for IFT. All contents are destroyed.

int iftFindNthKey IFT ift,
char *  str,
int  n
 

Find the Nth item of IFT where the specified string is found in the key. Comparison is case sensitive.

Returns:
Returns -1 if key was not found, or other negative value in case of an error, and the index [0..keyNr-1] if matching key is found.
Parameters:
ift  Pointer to existing IFT
str  Pointer to the case-sensitive (partial) key string
n  Nth (1..keyNr-1) insidence of value is searched.

int iftFindNthValue IFT ift,
char *  str,
int  n
 

Find the Nth item of IFT where the specified string is found in the value. Comparison is case sensitive.

Returns:
Returns -1 if key was not found, or other negative value in case of an error, and the index [0..keyNr-1] if matching value is found.
Parameters:
ift  Pointer to existing IFT
str  Pointer to the case-sensitive (partial) value string
n  Nth (1..keyNr-1) insidence of value is searched.

int iftGet IFT ift,
char *  key
 

Find the key in the IFT and return the index [0..keyNr-1]. Key is case insensitive.

Returns:
Returns -1 if key was not found, or other negative value in case of an error
Parameters:
ift  Pointer to existing IFT
key  Pointer to the key string; contents are replaced by the correct key string

int iftGetNth IFT ift,
char *  key,
int  n
 

Find the Nth key with similar name in the IFT and return the index [0..keyNr-1]. Key is case insensitive.

Returns:
Returns -1 if key was not found, or other negative value in case of an error
Parameters:
ift  Pointer to existing IFT
key  Pointer to the key string; contents are replaced by the correct key string
n  Nth (1..) insidence of key is searched.

void iftInit IFT ift  ) 
 

Initiate IFT structure. This should be called once before first use.

int iftPut IFT ift,
char *  key,
char *  value,
char *  cmt_type
 

Add specified key and its value to the IFT. Also comment type (first character pointed to) can be added. Either key or value can be empty, but not both of them.

Returns:
Returns 0 if ok. Sets ift->status.
Parameters:
ift  Pointer to initiated IFT
key  Key string; can be empty ("" or NULL)
value  Value string; can be empty ("" or NULL)
cmt_type  Pointer to comment character, e.g. '#' or ';' or '!' can be empty ("" or NULL)

int iftRead IFT ift,
char *  filename,
int  is_key_required
 

Read IFT file keys and values. Previous contents of IFT are preserved. This function can read the initial ASCII part of files that contain also binary data.

Returns:
Returns 0 if ok. Sets ift->status.
Parameters:
ift  Pointer to initiated but empty IFT
filename  Input filename
is_key_required  0=key name is not required, 1=only lines with key and equals sign are read

int iftReplaceNthValue IFT ift,
int  item,
char *  value
 

Replaces specified value in IFT with a new value.

Returns:
Returns 0 if ok.
Parameters:
ift  Pointer to initiated IFT
item  Index [0..keyNr-1] of key and value
value  Value string; can be empty ("" or NULL)

void iftSetStatus IFT ift,
int  status
 

int iftWrite IFT ift,
char *  filename
 

Write all keys and values.

Returns:
Returns 0 if ok.
Parameters:
ift  Pointer to initiated but empty IFT
filename  Output filename; string "stdout" is identified

int iftWriteItem IFT ift,
int  item,
FILE *  fp
 

Write one item in IFT to the specified file pointer.

Returns:
Returns 0 if ok.
Parameters:
ift  Pointer to initiated but empty IFT
item  Index [0..keyNr-1] of key and value to print
fp  Output file pointer

void libift_printdate FILE *  fp  ) 
 

Print the compilation date and time to specified FILE pointer


Variable Documentation

int IFT_TEST
 


Generated on Wed Jan 5 23:33:12 2005 for libIFT by  doxygen 1.3.9.1