Debian Codegraph @

startop/view_compiler/layout_validation.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef LAYOUT_VALIDATION_H_
18 #define LAYOUT_VALIDATION_H_
19
20 #include "dex_builder.h"
21
22 #include <string>
23
24 namespace startop {
25
26 // This visitor determines whether a layout can be compiled. Since we do not currently support all
27 // features, such as includes and merges, we need to pre-validate the layout before we start
28 // compiling.
29 class LayoutValidationVisitor {
30 public:
31 void VisitStartDocument() const {}
32 void VisitEndDocument() const {}
33 void VisitStartTag(const std::u16string& name);
34 void VisitEndTag() const {}
35
36 const std::string& message() const { return message_; }
37 bool can_compile() const { return can_compile_; }
38
39 private:
40 std::string message_{"Okay"};
41 bool can_compile_{true};
42 };
43
44 } // namespace startop
45
46 #endif // LAYOUT_VALIDATION_H_