James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2021 Google Inc. All rights reserved. |
| 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 FLATBUFFERS_BFBS_GENERATOR_H_ |
| 18 | #define FLATBUFFERS_BFBS_GENERATOR_H_ |
| 19 | |
| 20 | #include <cstdint> |
| 21 | |
| 22 | namespace flatbuffers { |
| 23 | |
| 24 | enum GeneratorStatus { |
| 25 | OK, |
| 26 | FAILED, |
| 27 | FAILED_VERIFICATION, |
| 28 | }; |
| 29 | |
| 30 | // A Flatbuffer Code Generator that receives a binary serialized reflection.fbs |
| 31 | // and generates code from it. |
| 32 | class BfbsGenerator { |
| 33 | public: |
| 34 | virtual ~BfbsGenerator() {} |
| 35 | |
| 36 | // Generate code from the provided `buffer` of given `length`. The buffer is |
| 37 | // a serialized reflection.fbs. |
| 38 | virtual GeneratorStatus Generate(const uint8_t *buffer, int64_t length) = 0; |
| 39 | }; |
| 40 | |
| 41 | } // namespace flatbuffers |
| 42 | |
| 43 | #endif // FLATBUFFERS_BFBS_GENERATOR_H_ |