/*
 * SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software. 
 * This class is generated using the converter UniSharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

const Hashtable = require("./../unisharp/Hashtable");

/**
 * Подерживаемые стандартные кодировки для EncodingWrapper. Введены, чтобы избежать зависимости от 
 * платформы и языка программирования.
 * Подерживаемые стандартные кодировки
 */
class EncodingStandard {

    constructor(val, str) {
        this.m_val = val;
        this.m_str = str;
    }
    toString() {
        return this.m_str;
    }
    value() {
        return this.m_val;
    }
    static of(val) {
        if(val instanceof EncodingStandard) 
            return val;
        if(typeof val === 'string' || val instanceof String) {
            val = val.toUpperCase();
            if(EncodingStandard.mapStringToEnum.containsKey(val))
                return EncodingStandard.mapStringToEnum.get(val);
            return null;
        }
        if(EncodingStandard.mapIntToEnum.containsKey(val))
            return EncodingStandard.mapIntToEnum.get(val);
        let it = new EncodingStandard(val, val.toString());
        EncodingStandard.mapIntToEnum.put(val, it);
        EncodingStandard.mapStringToEnum.put(val.toString(), it);
        return it;
    }
    static isDefined(val) {
        return EncodingStandard.m_Keys.indexOf(val) >= 0;
    }
    static getValues() {
        return EncodingStandard.m_Values;
    }
    static static_constructor() {
        EncodingStandard.mapIntToEnum = new Hashtable();
        EncodingStandard.mapStringToEnum = new Hashtable();
        EncodingStandard.UNDEFINED = new EncodingStandard(0, "UNDEFINED");
        EncodingStandard.mapIntToEnum.put(EncodingStandard.UNDEFINED.value(), EncodingStandard.UNDEFINED); 
        EncodingStandard.mapStringToEnum.put(EncodingStandard.UNDEFINED.m_str.toUpperCase(), EncodingStandard.UNDEFINED); 
        EncodingStandard.ACSII = new EncodingStandard(1, "ACSII");
        EncodingStandard.mapIntToEnum.put(EncodingStandard.ACSII.value(), EncodingStandard.ACSII); 
        EncodingStandard.mapStringToEnum.put(EncodingStandard.ACSII.m_str.toUpperCase(), EncodingStandard.ACSII); 
        EncodingStandard.UTF8 = new EncodingStandard(2, "UTF8");
        EncodingStandard.mapIntToEnum.put(EncodingStandard.UTF8.value(), EncodingStandard.UTF8); 
        EncodingStandard.mapStringToEnum.put(EncodingStandard.UTF8.m_str.toUpperCase(), EncodingStandard.UTF8); 
        EncodingStandard.UTF16LE = new EncodingStandard(3, "UTF16LE");
        EncodingStandard.mapIntToEnum.put(EncodingStandard.UTF16LE.value(), EncodingStandard.UTF16LE); 
        EncodingStandard.mapStringToEnum.put(EncodingStandard.UTF16LE.m_str.toUpperCase(), EncodingStandard.UTF16LE); 
        EncodingStandard.UTF16BE = new EncodingStandard(4, "UTF16BE");
        EncodingStandard.mapIntToEnum.put(EncodingStandard.UTF16BE.value(), EncodingStandard.UTF16BE); 
        EncodingStandard.mapStringToEnum.put(EncodingStandard.UTF16BE.m_str.toUpperCase(), EncodingStandard.UTF16BE); 
        EncodingStandard.CP1251 = new EncodingStandard(5, "CP1251");
        EncodingStandard.mapIntToEnum.put(EncodingStandard.CP1251.value(), EncodingStandard.CP1251); 
        EncodingStandard.mapStringToEnum.put(EncodingStandard.CP1251.m_str.toUpperCase(), EncodingStandard.CP1251); 
        EncodingStandard.CP1252 = new EncodingStandard(6, "CP1252");
        EncodingStandard.mapIntToEnum.put(EncodingStandard.CP1252.value(), EncodingStandard.CP1252); 
        EncodingStandard.mapStringToEnum.put(EncodingStandard.CP1252.m_str.toUpperCase(), EncodingStandard.CP1252); 
        EncodingStandard.m_Values = Array.from(EncodingStandard.mapIntToEnum.values);
        EncodingStandard.m_Keys = Array.from(EncodingStandard.mapIntToEnum.keys);
    }
}


EncodingStandard.static_constructor();

module.exports = EncodingStandard