xref: /llvm-project/libc/utils/hdrgen/enumeration.py (revision 07e13b764d6a5002f5bd9a41bf514106607f13f1)
1*07e13b76SRoland McGrath# ====-- Enumeration class for libc function headers ----------*- python -*--==#
2*07e13b76SRoland McGrath#
3*07e13b76SRoland McGrath# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*07e13b76SRoland McGrath# See https://llvm.org/LICENSE.txt for license information.
5*07e13b76SRoland McGrath# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*07e13b76SRoland McGrath#
7*07e13b76SRoland McGrath# ==-------------------------------------------------------------------------==#
8*07e13b76SRoland McGrath
9*07e13b76SRoland McGrath
10*07e13b76SRoland McGrathclass Enumeration:
11*07e13b76SRoland McGrath    def __init__(self, name, value):
12*07e13b76SRoland McGrath        self.name = name
13*07e13b76SRoland McGrath        self.value = value
14*07e13b76SRoland McGrath
15*07e13b76SRoland McGrath    def __str__(self):
16*07e13b76SRoland McGrath        if self.value != None:
17*07e13b76SRoland McGrath            return f"{self.name} = {self.value}"
18*07e13b76SRoland McGrath        else:
19*07e13b76SRoland McGrath            return f"{self.name}"
20