-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathasxparser.h
More file actions
77 lines (59 loc) · 1.7 KB
/
asxparser.h
File metadata and controls
77 lines (59 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* asxparser.h: ASX parser
*
* Contact:
* Moonlight List (moonlight-list@lists.ximian.com)
*
* Copyright 2007 Novell, Inc. (http://www.novell.com)
*
* See the LICENSE file included with the distribution for details.
*/
#ifndef __MOON_ASXPARSER_H__
#define __MOON_ASXPARSER_H__
#include <glib.h>
#include "pipeline.h"
namespace Moonlight {
class AsxParser;
class AsxParserInternal;
typedef void asx_text_handler (AsxParser *parser, const char* text);
typedef void asx_error_handler (AsxParser *parser, int error_code, const char* error);
typedef void asx_element_start_handler (AsxParser *parser, const char* element, GHashTable *atts);
typedef void asx_element_end_handler (AsxParser *parser, const char* element);
enum AsxParserError {
ASXPARSER_ERROR_NONE,
ASXPARSER_ERROR_INVALID_TOKEN,
ASXPARSER_ERROR_DUPLICATE_ATTRIBUTE,
ASXPARSER_ERROR_NO_ELEMENTS,
ASXPARSER_ERROR_UNBALANCED_ELEMENTS,
ASXPARSER_ERROR_QUOTE_EXPECTED
};
class AsxParser {
public:
AsxParser ();
~AsxParser ();
void SetErrorHandler (asx_error_handler *handler);
void SetTextHandler (asx_text_handler *handler);
void SetElementStartHandler (asx_element_start_handler *handler);
void SetElementEndHandler (asx_element_end_handler *handler);
bool ParseBuffer (MemoryBuffer *buffer);
void Stop ();
void SetUserData (void *data)
{
user_data = data;
}
void* GetUserData ()
{
return user_data;
}
AsxParserError GetErrorCode ();
const char* GetErrorMessage ();
int GetCurrentLineNumber ();
int GetCurrentColumnNumber ();
private:
AsxParserInternal *parser;
MemoryBuffer *buffer;
void *user_data;
};
};
#endif /* __MOON_ASXPARSER_H__ */