MLLIF
a MLIR-based Language to Language Interoperability Flyover
Loading...
Searching...
No Matches
Context.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Yeong-won Seo
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#pragma once
18
19namespace mllif {
20 class Error {
21 std::string _what;
22
23 public:
24 Error(const std::string& what) : _what(what) {}
25
26 const std::string& what() const { return _what; }
27 };
28
30 std::vector<Error> _errors;
31
32 public:
33 const std::vector<Error>& errors() const { return _errors; }
34
35 void error(const std::string& what) {
36 _errors.push_back(Error(what));
37 }
38
39 operator bool() const {
40 return _errors.empty();
41 }
42
43 bool operator!() const {
44 return !_errors.empty();
45 }
46 };
47}
Error(const std::string &what)
Definition Context.h:24
const std::string & what() const
Definition Context.h:26
bool operator!() const
Definition Context.h:43
const std::vector< Error > & errors() const
Definition Context.h:33
void error(const std::string &what)
Definition Context.h:35