Main Page   Compound List   File List   Compound Members   File Members  

lib/gobj/path.h File Reference

Path object. More...

#include <gobjconfig.h>
#include <gobj/types.h>
#include <gobj/id.h>

Go to the source code of this file.

Compounds

struct  Gj_Path_struct

Typedefs

typedef struct Gj_Path_struct Gj_Path
 Path structure typedef.

typedef enum Gj_PathType_enum  Gj_PathType
 Path element type enum.


Enumerations

enum  Gj_PathType_enum {
  GJ_PATHTYPE_NONE = 0,
  GJ_PATHTYPE_STRING,
  GJ_PATHTYPE_ID,
  GJ_PATHTYPE_NUM
}
 Path element type enum.


Functions

Gj_PathGj_path_new ()
 Create a new path structure. More...

Gj_PathGj_path_create (Gj_Ctx* ctx, Gj_Stream* stream)
 Create a path structure from a stream. More...

Gj_PathGj_path_duplicate (Gj_Path* path)
 Create a new path as a duplicate of an existing one.

void Gj_path_delete (Gj_Path* ptr)
 Destroy a path structure created via Gj_path_new().

void Gj_path_init (Gj_Path* path)
 Initialize a path structure.

void Gj_path_finalize (Gj_Path* path)
 Finalize a path structure.

int Gj_path_read (Gj_Ctx* ctx, Gj_Path* path, Gj_Stream* stream)
 Read a path form a stream. More...

int Gj_path_write (Gj_Ctx* ctx, Gj_Path* path, Gj_Stream* stream)
 Write a path to a stream. More...

int Gj_path_getCount (Gj_Path* path)
 Get the element count of a path.

void Gj_path_addString (Gj_Path* path, char* str)
 Add a string path element. More...

void Gj_path_addId (Gj_Path* path, Gj_Id* id)
 Add an id path element.

void Gj_path_addNum (Gj_Path* path, int num)
 Add a numerical path element.

Gj_PathType Gj_path_nextType (Gj_Path* path, void** ptr)
 Return the type of the next element of the walkthrough. More...

char* Gj_path_nextAsString (Gj_Path* path, void** ptr)
 Return the next element of a walkthrough as a string. More...

Gj_IdGj_path_nextAsId (Gj_Path* path, void** ptr)
 Return the next element of a walkthrough as an id. More...

int* Gj_path_nextAsNum (Gj_Path* path, void** ptr)
 Return the next element of a walkthrough as a pointer to a number. More...

char* Gj_path2str (Gj_Path* path)
 Convert a path structure into a string allocated via Gj_alloc().


Detailed Description

Path object.


Function Documentation

Gj_Path * Gj_path_new ( )
 

Create a new path structure.

Calls to Gj_path_init() and Gj_path_finalize() are not needed.

Gj_Path * Gj_path_create ( Gj_Ctx * ctx,
Gj_Stream * stream )
 

Create a path structure from a stream.

Returns:
The pointer to the path on success, 0 otherwise.

int Gj_path_read ( Gj_Ctx * ctx,
Gj_Path * path,
Gj_Stream * stream )
 

Read a path form a stream.

Returns:
0 on success, -1 otherwise.

int Gj_path_write ( Gj_Ctx * ctx,
Gj_Path * path,
Gj_Stream * stream )
 

Write a path to a stream.

Returns:
0 on success, -1 otherwise.

void Gj_path_addString ( Gj_Path * path,
char * str )
 

Add a string path element.

The string is DUPLICATED.

Gj_PathType Gj_path_nextType ( Gj_Path * path,
void ** ptr )
 

Return the type of the next element of the walkthrough.

If *ptr is 0, the type of the first element is returned. If the last element has already been reached, GJ_PATHTYPE_NONE is returned. Calls to Gj_path_nextType do not change the walkthrough position.

char * Gj_path_nextAsString ( Gj_Path * path,
void ** ptr )
 

Return the next element of a walkthrough as a string.

If *ptr is 0, the first element is returned. If the last element has already been reached, 0 is returned.

Gj_Id * Gj_path_nextAsId ( Gj_Path * path,
void ** ptr )
 

Return the next element of a walkthrough as an id.

If *ptr is 0, the first element is returned. If the last element has already been reached, 0 is returned.

int * Gj_path_nextAsNum ( Gj_Path * path,
void ** ptr )
 

Return the next element of a walkthrough as a pointer to a number.

If *ptr is 0, the first element is returned. If the last element has already been reached, 0 is returned.


Generated at Fri Aug 17 18:28:57 2001 for Gobj by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000