/src/harfbuzz/src/graph/graph-result.hh
Line | Count | Source |
1 | | /* |
2 | | * Copyright © 2026 Google, Inc. |
3 | | * |
4 | | * This is part of HarfBuzz, a text shaping library. |
5 | | * |
6 | | * Permission is hereby granted, without written agreement and without |
7 | | * license or royalty fees, to use, copy, modify, and distribute this |
8 | | * software and its documentation for any purpose, provided that the |
9 | | * above copyright notice and the following two paragraphs appear in |
10 | | * all copies of this software. |
11 | | * |
12 | | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
13 | | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
14 | | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
15 | | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
16 | | * DAMAGE. |
17 | | * |
18 | | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
19 | | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
20 | | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
21 | | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
22 | | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
23 | | * |
24 | | * Google Author(s): Garret Rieger |
25 | | */ |
26 | | |
27 | | #ifndef GRAPH_GRAPH_RESULT_HH |
28 | | #define GRAPH_GRAPH_RESULT_HH |
29 | | |
30 | | #include "../hb-result.hh" |
31 | | |
32 | | namespace graph { |
33 | | |
34 | | enum graph_error_t { |
35 | | ALLOCATION_FAILURE, |
36 | | LIMIT_EXCEEDED, |
37 | | INVALID_ARGUMENT, |
38 | | CYCLE_DETECTED, |
39 | | SANITIZE_FAILURE, |
40 | | OUT_OF_BOUNDS, |
41 | | ORPHANED_NODES, |
42 | | OVERFLOW_RESOLUTION_FAILED, |
43 | | UNKNOWN, |
44 | | }; |
45 | | |
46 | 0 | static inline const char* to_string(graph_error_t e) { |
47 | 0 | switch (e) { |
48 | 0 | case ALLOCATION_FAILURE: return "Memory Allocation Failed"; |
49 | 0 | case LIMIT_EXCEEDED: return "Limit Exceeded"; |
50 | 0 | case INVALID_ARGUMENT: return "Invalid Argument"; |
51 | 0 | case CYCLE_DETECTED: return "Cycle in Graph"; |
52 | 0 | case SANITIZE_FAILURE: return "Failed Sanitization"; |
53 | 0 | case OUT_OF_BOUNDS: return "Out of Bounds"; |
54 | 0 | case ORPHANED_NODES: return "Graph is not fully connected"; |
55 | 0 | case OVERFLOW_RESOLUTION_FAILED: return "Overflows are not able to be resolved"; |
56 | 0 | case UNKNOWN: |
57 | 0 | default: |
58 | 0 | return "Unknown Error"; |
59 | 0 | } |
60 | 0 | } Unexecuted instantiation: hb-subset.cc:graph::to_string(graph::graph_error_t) Unexecuted instantiation: hb-subset-table-layout.cc:graph::to_string(graph::graph_error_t) Unexecuted instantiation: hb-subset-table-var.cc:graph::to_string(graph::graph_error_t) Unexecuted instantiation: hb-subset-table-cff.cc:graph::to_string(graph::graph_error_t) Unexecuted instantiation: hb-subset-table-color.cc:graph::to_string(graph::graph_error_t) Unexecuted instantiation: hb-subset-table-other.cc:graph::to_string(graph::graph_error_t) Unexecuted instantiation: gsubgpos-context.cc:graph::to_string(graph::graph_error_t) |
61 | | |
62 | | template<typename T> |
63 | | using graph_result_t = hb_result_t<T, graph_error_t>; |
64 | | |
65 | | } // namespace graph |
66 | | |
67 | | #endif /* GRAPH_GRAPH_RESULT_HH */ |