1 #ifndef _XECONTAINERFORMATPARSER_HPP
2 #define _XECONTAINERFORMATPARSER_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 log container format parser.
24 *//*--------------------------------------------------------------------*/
27 #include "deRingBuffer.hpp"
34 CONTAINERELEMENT_INCOMPLETE = 0,
35 CONTAINERELEMENT_END_OF_STRING,
36 CONTAINERELEMENT_BEGIN_SESSION,
37 CONTAINERELEMENT_END_SESSION,
38 CONTAINERELEMENT_SESSION_INFO,
39 CONTAINERELEMENT_BEGIN_TEST_CASE_RESULT,
40 CONTAINERELEMENT_END_TEST_CASE_RESULT,
41 CONTAINERELEMENT_TERMINATE_TEST_CASE_RESULT,
42 CONTAINERELEMENT_TEST_LOG_DATA,
47 class ContainerParseError : public ParseError
50 ContainerParseError (const std::string& message) : ParseError(message) {}
53 class ContainerFormatParser
56 ContainerFormatParser (void);
57 ~ContainerFormatParser (void);
61 void feed (const deUint8* bytes, size_t numBytes);
64 ContainerElement getElement (void) const { return m_element; }
67 const char* getSessionInfoAttribute (void) const;
68 const char* getSessionInfoValue (void) const;
71 const char* getTestCasePath (void) const;
73 // TERMINATE_TEST_CASE
74 const char* getTerminateReason (void) const;
77 int getDataSize (void) const;
78 void getData (deUint8* dst, int numBytes, int offset);
81 ContainerFormatParser (const ContainerFormatParser& other);
82 ContainerFormatParser& operator= (const ContainerFormatParser& other);
84 void error (const std::string& what);
97 END_OF_STRING = 0, //!< End of string (0).
98 END_OF_BUFFER = 0xffffffff //!< End of current data buffer.
101 int getChar (int offset) const;
102 void parseContainerLine (void);
103 void parseContainerValue (std::string& dst, int& offset) const;
105 ContainerElement m_element;
108 std::string m_attribute;
111 de::RingBuffer<deUint8> m_buf;
116 #endif // _XECONTAINERFORMATPARSER_HPP