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

gtask-stream-parser.c File Reference

#include <unistd.h>
#include <string.h>
#include <gtask/gtask-packet.h>
#include <gtask/gtask-error-packet.h>
#include <gtask/gtask-task-packet.h>
#include <gtask/gtask-watch-packet.h>
#include <gtask/gtask-remove-watch-packet.h>
#include <gtask-query-packet.h>
#include <gtask/gtask-file.h>
#include <gtask/gtask-stream-parser.h>
#include <gtask/gtask-internals.h>

Go to the source code of this file.

Data Structures

struct  _GTaskStreamParserPrivate

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
}

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.


Variables

gpointer parent_class
xmlSAXHandler sax_handler


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