blob: e8f24d2d25dbd946bf351b063ace27bf555d995e (
plain)
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
|
/**
* Copyright (C) ARM Limited 2011-2012. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include "RequestXML.h"
#include "Logging.h"
extern void handleException();
static const char* TAG_REQUEST = "request";
static const char* ATTR_PROTOCOL = "protocol";
static const char* ATTR_EVENTS = "events";
static const char* ATTR_CONFIGURATION = "configuration";
static const char* ATTR_COUNTERS = "counters";
static const char* ATTR_SESSION = "session";
static const char* ATTR_CAPTURED = "captured";
static const char* ATTR_DEFAULTS = "defaults";
RequestXML::RequestXML(const char * str) {
parameters.protocol = false;
parameters.events = false;
parameters.configuration = false;
parameters.counters = false;
parameters.session = false;
parameters.captured = false;
parameters.defaults = false;
XMLReader reader(str);
char * tag = reader.nextTag();
while(tag != 0) {
if (strcmp(tag, TAG_REQUEST) == 0) {
requestTag(&reader);
return;
}
tag = reader.nextTag();
}
logg->logError(__FILE__, __LINE__, "No request tag found in the request.xml file");
handleException();
}
RequestXML::~RequestXML() {
}
void RequestXML::requestTag(XMLReader* in) {
parameters.protocol = in->getAttributeAsBoolean(ATTR_PROTOCOL, false);
parameters.events = in->getAttributeAsBoolean(ATTR_EVENTS, false);
parameters.configuration = in->getAttributeAsBoolean(ATTR_CONFIGURATION, false);
parameters.counters = in->getAttributeAsBoolean(ATTR_COUNTERS, false);
parameters.session = in->getAttributeAsBoolean(ATTR_SESSION, false);
parameters.captured = in->getAttributeAsBoolean(ATTR_CAPTURED, false);
parameters.defaults = in->getAttributeAsBoolean(ATTR_DEFAULTS, false);
}
|