1/* 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS of ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16package std.core; 17 18// TODO(shumilov-petr): Add runtime mirror 19export final class EnumConstant { 20 private name: string = "" 21 private typ: TypeDesc = new TypeDesc() 22 private intVal: int 23 private strVal: string = "" 24 25 private constructor () {} 26 27 public getType(): Type { 28 return Type.resolve(this.typ)! 29 } 30 31 public getName(): string { 32 return this.name 33 } 34 35 public getValue(): int { 36 return this.intVal 37 } 38 39 public getStringValue(): string { 40 return this.strVal 41 } 42 43 public hasValue(): boolean { 44 // TODO(shumilov-petr): not implemented 45 return false 46 } 47 48 public hasStringValue(): boolean { 49 // TODO(shumilov-petr): not implemented 50 return false 51 } 52 53 public static create(name: string, typ: Type, v: int): EnumConstant { 54 // TODO(shumilov-petr): not implemented 55 throw new Error("not implemented") 56 } 57 58 public static create(name: string, typ: Type, v: string): EnumConstant { 59 // TODO(shumilov-petr): not implemented 60 throw new Error("not implemented") 61 } 62 63 public override toString(): string { 64 // TODO(shumilov-petr): not implemented 65 throw new Error("not implemented") 66 } 67} 68