1 #ifndef _XETESTRESULTPARSER_HPP
2 #define _XETESTRESULTPARSER_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Test Executor
5 * ------------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief Test case result parser.
24 *//*--------------------------------------------------------------------*/
27 #include "xeXMLParser.hpp"
28 #include "xeTestCaseResult.hpp"
37 TESTLOGVERSION_0_2_0 = 0,
47 class TestResultParseError : public ParseError
50 TestResultParseError (const std::string& message) : ParseError(message) {}
53 class TestResultParser
58 PARSERESULT_NOT_CHANGED,
66 TestResultParser (void);
67 ~TestResultParser (void);
69 void init (TestCaseResult* dstResult);
70 ParseResult parse (const deUint8* bytes, int numBytes);
73 TestResultParser (const TestResultParser& other);
74 TestResultParser& operator= (const TestResultParser& other);
78 void handleElementStart (void);
79 void handleElementEnd (void);
80 void handleData (void);
82 const char* getAttribute (const char* name);
84 ri::Item* getCurrentItem (void);
85 ri::List* getCurrentItemList (void);
86 void pushItem (ri::Item* item);
88 void updateCurrentItemList (void);
92 STATE_NOT_INITIALIZED = 0,
94 STATE_IN_TEST_CASE_RESULT,
95 STATE_TEST_CASE_RESULT_ENDED,
100 xml::Parser m_xmlParser;
101 TestCaseResult* m_result;
104 TestLogVersion m_logVersion; //!< Only valid in STATE_IN_TEST_CASE_RESULT.
106 std::vector<ri::Item*> m_itemStack;
107 ri::List* m_curItemList;
109 int m_base64DecodeOffset;
111 std::string m_curNumValue;
114 // Helpers exposed to other parsers.
115 TestStatusCode getTestStatusCode (const char* statusCode);
119 class TestCaseResultData;
121 void parseTestCaseResultFromData (TestResultParser* parser, TestCaseResult* result, const TestCaseResultData& data);
125 #endif // _XETESTRESULTPARSER_HPP