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

GTaskStreamParser


Data Structures

struct  _GTaskStreamParser
struct  _GTaskStreamParserClass
struct  _GTaskStreamParserPrivate

Defines

#define GTASK_STREAM_PARSER_TYPE   (gtask_stream_parser_get_type())
#define GTASK_STREAM_PARSER(obj)
#define GTASK_STREAM_PARSER_CLASS(kclass)
#define GTASK_IS_STREAM_PARSER(obj)
#define GTASK_IS_STREAM_PARSER_CLASS(klass)
#define GTASK_STREAM_PARSER_GET_CLASS(obj)

Typedefs

typedef _GTaskStreamParser GTaskStreamParser
typedef _GTaskStreamParserPrivate GTaskStreamParserPrivate
typedef _GTaskStreamParserClass GTaskStreamParserClass

Enumerations

enum  GTaskStreamParserLevel { DOCUMENT_LEVEL, STREAM_LEVEL, PACKET_LEVEL, PACKET_CONTENTS_LEVEL }
enum  GTaskStreamParserState { UNKNOWN, DOCUMENT_START }
enum  GTaskStreamParserPacket {
  NO_PACKET, ROLE, ERROR, WATCH,
  REMOVE_WATCH, TASK, QUERY
}
enum  GTaskStreamParserProperty {
  NO_PROPERTY, PROP_CATEGORY, PROP_TITLE, PROP_PERCENT_COMPLETED,
  PROP_ACTIVITY_STATE, PROP_STATUS_MESSAGE, PROP_ERROR_MESSAGE, PROP_MIME_TYPE,
  PROP_RESULTANT_FILE_URI, PROP_THUMBNAIL_URI, PROP_TIME_LEFT
}
enum  GTaskStreamParserError { GTASK_STREAM_PARSER_ERROR_NONE, GTASK_STREAM_PARSER_ERROR_SYNTAX_ERROR }

Functions

void gtask_stream_parser_class_init (GTaskStreamParserClass *klass)
void gtask_stream_parser_init (GTaskStreamParser *parser)
void gtask_stream_parser_finalize (GObject *obj)
void gtask_stream_parser_dispose (GObject *obj)
gboolean gtask_stream_parser_init_parser (GTaskStreamParser *parser, char *buff, int len)
 initializes the internal parser used by GTaskStreamParser (libxml SAX parser at the moment). The context for this parser requires 4 bytes of data before parsing can begin. All characters in the passed in buffer are automatically sent to the parser if the number of bytes exceeds the 4 that we need.

void start_document (gpointer data)
void end_document (gpointer data)
void start_element (gpointer data, const xmlChar *name, const xmlChar **attrs)
void end_element (gpointer data, const xmlChar *name)
void get_characters (gpointer data, const xmlChar *chars, int len)
void xml_warning (gpointer data, const char *msg,...)
void xml_error (gpointer data, const char *msg,...)
void xml_fatal_error (gpointer data, const char *msg,...)
GType gtask_stream_parser_get_type ()
GTaskStreamParsergtask_stream_parser_new ()
 creates a new GTaskStreamParser. This function should be used if you want the feed the resulting parser the input data yourself using gtask_stream_parser_push_data. If constructed through this function calls to gtask_stream_parser_get_next_packet() will not block and will immediately return NULL if there are no more packets to process.

gboolean gtask_stream_parser_has_packets (GTaskStreamParser *parser)
 returns TRUE if the GTaskStreamParser has packets waiting in its queue

gboolean gtask_stream_parser_push_data (GTaskStreamParser *parser, char *buff, int len)
GObject * gtask_stream_parser_get_next_packet (GTaskStreamParser *parser)
 continues returns the next packet if there is one, or NULL otherwise

gboolean gtask_stream_parser_has_error (GTaskStreamParser *parser)
void gtask_stream_parser_reset_state (GTaskStreamParser *parser)
 Resets the state of the stream parser to their defaults (ie the state before any parsing was done). This function will no, however clear out any generated packets that remain in the queue. This function is generally called when the stream that you are parsing has unexpectedly disconnection and you wish to reconnect and parse again.

GTaskStreamParserError gtask_stream_parser_get_error (GTaskStreamParser *parser)
gboolean gtask_stream_parser_at_eof (GTaskStreamParser *parser)

Variables

gpointer parent_class
xmlSAXHandler sax_handler

Define Documentation

#define GTASK_IS_STREAM_PARSER obj   ) 
 

Value:

(G_TYPE_CHECK_INSTANCE_TYPE( (obj), \
                                            GTASK_STREAM_PARSER_TYPE ))
returns TRUE is the passed in object is a GTaskStreamParser, FALSE otherwise

Definition at line 34 of file gtask-stream-parser.h.

#define GTASK_IS_STREAM_PARSER_CLASS klass   ) 
 

Value:

(G_TYPE_CHECK_CLASS_TYPE( (klass), \
                                              GTASK_STREAM_PARSER_TYPE ))
returns TRUE if the passed in object is a GTaskStreamParser, FALSE otherwise

Definition at line 41 of file gtask-stream-parser.h.

#define GTASK_STREAM_PARSER obj   ) 
 

Value:

(G_TYPE_CHECK_INSTANCE_CAST( (obj), \
                                            GTASK_STREAM_PARSER_TYPE, \
                                            GTaskStreamParser ))
casts the passed in object to a GTaskStreamParser

Definition at line 21 of file gtask-stream-parser.h.

#define GTASK_STREAM_PARSER_CLASS kclass   ) 
 

Value:

(G_TYPE_CHECK_CLASS_CAST( (klass), \
                                            GTASK_STREAM_PARSER_TYPE, \
                                            GTaskStreamParserClass ))
casts the passed in object to a GTaskStreamParserClass

Definition at line 26 of file gtask-stream-parser.h.

#define GTASK_STREAM_PARSER_GET_CLASS obj   ) 
 

Value:

(G_TYPE_INSTANCE_GET_CLASS( (obj), \
                                             GTASK_STREAM_PARSER_TYPE, \
                                             GTaskStreamParserClass ))

Definition at line 44 of file gtask-stream-parser.h.

#define GTASK_STREAM_PARSER_TYPE   (gtask_stream_parser_get_type())
 

returns a GType of GTaskStreamParser

Definition at line 18 of file gtask-stream-parser.h.


Typedef Documentation

typedef struct _GTaskStreamParser GTaskStreamParser
 

Definition at line 13 of file gtask-stream-parser.h.

typedef struct _GTaskStreamParserClass GTaskStreamParserClass
 

Definition at line 15 of file gtask-stream-parser.h.

typedef struct _GTaskStreamParserPrivate GTaskStreamParserPrivate
 

Definition at line 14 of file gtask-stream-parser.h.


Enumeration Type Documentation

enum GTaskStreamParserError
 

Enumeration values:
GTASK_STREAM_PARSER_ERROR_NONE  there is no error
GTASK_STREAM_PARSER_ERROR_SYNTAX_ERROR  a syntax error has occurred

Definition at line 57 of file gtask-stream-parser.h.

enum GTaskStreamParserLevel
 

Enumeration values:
DOCUMENT_LEVEL 
STREAM_LEVEL 
PACKET_LEVEL 
PACKET_CONTENTS_LEVEL 

Definition at line 104 of file gtask-stream-parser.c.

enum GTaskStreamParserPacket
 

Enumeration values:
NO_PACKET 
ROLE 
ERROR 
WATCH 
REMOVE_WATCH 
TASK 
QUERY 

Definition at line 116 of file gtask-stream-parser.c.

enum GTaskStreamParserProperty
 

Enumeration values:
NO_PROPERTY 
PROP_CATEGORY 
PROP_TITLE 
PROP_PERCENT_COMPLETED 
PROP_ACTIVITY_STATE 
PROP_STATUS_MESSAGE 
PROP_ERROR_MESSAGE 
PROP_MIME_TYPE 
PROP_RESULTANT_FILE_URI 
PROP_THUMBNAIL_URI 
PROP_TIME_LEFT 

Definition at line 126 of file gtask-stream-parser.c.

enum GTaskStreamParserState
 

Enumeration values:
UNKNOWN 
DOCUMENT_START 

Definition at line 111 of file gtask-stream-parser.c.


Function Documentation

void end_document gpointer  data  )  [static]
 

Definition at line 276 of file gtask-stream-parser.c.

void end_element gpointer  data,
const xmlChar *  name
[static]
 

Todo:
this is just a quick hack to fix a silly problem in the future we need to sanely clean up our strings

fix me

somehow it seems as if we are getting here twice

Definition at line 483 of file gtask-stream-parser.c.

void get_characters gpointer  data,
const xmlChar *  chars,
int  len
[static]
 

Definition at line 609 of file gtask-stream-parser.c.

gboolean gtask_stream_parser_at_eof GTaskStreamParser parser  ) 
 

void gtask_stream_parser_class_init GTaskStreamParserClass klass  )  [static]
 

Definition at line 637 of file gtask-stream-parser.c.

void gtask_stream_parser_dispose GObject *  obj  )  [static]
 

Definition at line 672 of file gtask-stream-parser.c.

void gtask_stream_parser_finalize GObject *  obj  )  [static]
 

Definition at line 693 of file gtask-stream-parser.c.

GTaskStreamParserError gtask_stream_parser_get_error GTaskStreamParser parser  ) 
 

GObject * gtask_stream_parser_get_next_packet GTaskStreamParser parser  ) 
 

continues returns the next packet if there is one, or NULL otherwise

Author:
Michael Henson
Parameters:
parser a GTaskStreamParser
Returns:
the next GTaskPacket or NULL when there are no more packets It is the caller's responsibility to call g_object_unref on all packets returned by this function.

Definition at line 840 of file gtask-stream-parser.c.

GType gtask_stream_parser_get_type void   ) 
 

Definition at line 191 of file gtask-stream-parser.c.

gboolean gtask_stream_parser_has_error GTaskStreamParser parser  ) 
 

Definition at line 864 of file gtask-stream-parser.c.

gboolean gtask_stream_parser_has_packets GTaskStreamParser parser  ) 
 

returns TRUE if the GTaskStreamParser has packets waiting in its queue

Author:
Michael Henson
Parameters:
parser a GTaskStreamParser
Returns:
TRUE if there are packets in the queue, FALSE otherwise

Definition at line 772 of file gtask-stream-parser.c.

void gtask_stream_parser_init GTaskStreamParser parser  )  [static]
 

Definition at line 647 of file gtask-stream-parser.c.

gboolean gtask_stream_parser_init_parser GTaskStreamParser parser,
char *  buff,
int  len
[static]
 

initializes the internal parser used by GTaskStreamParser (libxml SAX parser at the moment). The context for this parser requires 4 bytes of data before parsing can begin. All characters in the passed in buffer are automatically sent to the parser if the number of bytes exceeds the 4 that we need.

Author:
Michael Henson
Parameters:
parser a GTaskStreamParser to initialize
buff any new data (parser needs 4 bytes of data to start off)
len the amount of data passed in
Returns:
the success/failure of the operation

Definition at line 741 of file gtask-stream-parser.c.

GTaskStreamParser * gtask_stream_parser_new void   ) 
 

creates a new GTaskStreamParser. This function should be used if you want the feed the resulting parser the input data yourself using gtask_stream_parser_push_data. If constructed through this function calls to gtask_stream_parser_get_next_packet() will not block and will immediately return NULL if there are no more packets to process.

Author:
Michael Henson
Returns:
the new GTaskStreamParser

Definition at line 721 of file gtask-stream-parser.c.

gboolean gtask_stream_parser_push_data GTaskStreamParser parser,
char *  buff,
int  len
 

Author:
Michael Henson
Parameters:
parser a GTaskStreamParser
Returns:
TRUE if there were no parsing errors, FALSE otherwise
Todo:
need some sort of error state to catch this

how do we tell the parser when we are done here?

Definition at line 789 of file gtask-stream-parser.c.

void gtask_stream_parser_reset_state GTaskStreamParser parser  ) 
 

Resets the state of the stream parser to their defaults (ie the state before any parsing was done). This function will no, however clear out any generated packets that remain in the queue. This function is generally called when the stream that you are parsing has unexpectedly disconnection and you wish to reconnect and parse again.

Parameters:
parser a GTaskStreamParser

Definition at line 882 of file gtask-stream-parser.c.

void start_document gpointer  data  )  [static]
 

Definition at line 259 of file gtask-stream-parser.c.

void start_element gpointer  data,
const xmlChar *  name,
const xmlChar **  attrs
[static]
 

Todo:
the parser needs to be much more explicit about the type of error that has occurred

Todo:
we need to check for the class of the task and instantiate the correct type

decide how we are implementing error types. I expect that this implementation will change in the future, so this really isn't all that critical

Definition at line 285 of file gtask-stream-parser.c.

void xml_error gpointer  data,
const char *  msg,
... 
[static]
 

Definition at line 234 of file gtask-stream-parser.c.

void xml_fatal_error gpointer  data,
const char *  msg,
... 
[static]
 

Definition at line 246 of file gtask-stream-parser.c.

void xml_warning gpointer  data,
const char *  msg,
... 
[static]
 

Todo:
better warning and error handling check out glib's logging facilities

Definition at line 224 of file gtask-stream-parser.c.


Variable Documentation

gpointer parent_class [static]
 

Definition at line 22 of file gtask-stream-parser.c.

xmlSAXHandler sax_handler
 

Definition at line 69 of file gtask-stream-parser.c.


Generated on Mon Feb 2 21:26:18 2004 for libgtask by doxygen 1.3.4