コード例 #1
0
        /**
         * Read a tag with a given tag id. The tag will be read out of the class
         * defined in getTagEnum().
         *
         * @param tagid
         *            A RPM tag id
         * @return The name of the RPM tag
         * @throws IllegalArgumentException
         *             if the tag id was not found
         */
        public String getTagNameForId(long tagid)
        {
            EnumIf e = RPMHeaderTag.getEnumById(tagid);

            if (e == null)
            {
                throw new java.lang.IllegalArgumentException("unknown tag with id <" + tagid
                                                             + ">");
            }
            return(e.getName());
        }
コード例 #2
0
        /**
         * Read a tag with a given tag name. The tag will be read out of the class
         * defined in getTagEnum().
         *
         * @param tagname
         *            A RPM tag name
         * @return The id of the RPM tag
         * @throws IllegalArgumentException
         *             if the tag name was not found
         */
        public long getTagIdForName(String tagname)
        {
            EnumIf e = RPMHeaderTag.getEnumByName(tagname);

            if (e == null)
            {
                throw new java.lang.IllegalArgumentException("unknown tag with name <"
                                                             + tagname + ">");
            }

            return(e.getId());
        }
コード例 #3
0
ファイル: EnumDelegate.cs プロジェクト: bastie/NetVampire
        /**
         * Get a enum by name
         *
         * @param refClass referencing class
         * @param name The name of the enum
         * @return The enum object
         */
        public static EnumIf getEnumByName(Type refClass, String name)
        {
            EnumIf   ret      = null;
            MapEntry mapEntry = null;

            mapEntry = (MapEntry)map.get(refClass);

            if (mapEntry != null)
            {
                ret = (EnumIf)mapEntry.nameMap.get(name.toLowerCase());

                if (ret == null)
                {
                    ret = (EnumIf)mapEntry.idMap.get(new java.lang.Long(EnumIfConstants._UNKNOWN));
                }
            }

            return(ret);
        }
コード例 #4
0
ファイル: EnumDelegate.cs プロジェクト: bastie/NetVampire
        /**
         * Get a enum by id
         *
         * @param refClass referencing class
         * @param id The id of the enum
         * @return The enum object
         */
        public static EnumIf getEnumById(Type refClass, long id)
        {
            EnumIf   ret      = null;
            MapEntry mapEntry = null;

            mapEntry = (MapEntry)map.get(refClass);

            if (mapEntry != null)
            {
                ret = (EnumIf)mapEntry.idMap.get(new java.lang.Long(id));

                if (ret == null)
                {
                    // warn
                    ret = (EnumIf)mapEntry.idMap.get(new java.lang.Long(EnumIfConstants._UNKNOWN));
                }
            }

            return(ret);
        }
コード例 #5
0
ファイル: EnumDelegate.cs プロジェクト: bastie/NetVampire
        /**
         * Creates a new EnumDelegate object.
         *
         * @param refClass Referencing class for this enum (the class that : the enum)
         * @param id A id for this enum
         * @param name A name for this enum
         * @param realEnum The actual reference of the enum object (the real enum object that : EnumIf)
         */
        public EnumDelegate(Type refClass, long id, String name, EnumIf realEnum)
        {
            this.id   = id;
            this.name = name;

            MapEntry mapEntry;

            if (map.containsKey(refClass))
            {
                mapEntry = (MapEntry)map.get(refClass);
            }
            else
            {
                mapEntry = new MapEntry();
                map.put(refClass, mapEntry);
            }

            mapEntry.idMap.put(new java.lang.Long(id), realEnum);
            mapEntry.nameMap.put(name.toLowerCase(), realEnum);
        }
コード例 #6
0
        /**
         * Get a enum by id
         *
         * @param id The id of the enum
         * @return The enum object
         */
        public static EnumIf getEnumById(long id)
        {
            EnumIf result = EnumDelegate.getEnumById(typeof(LeadType), id);

            if (null == result)
            {
                switch (id)
                {
                case _BINARY:
                    result = LeadType.BINARY;
                    break;

                case _SOURCE:
                    result = LeadType.SOURCE;
                    break;

                default:
                    result = LeadType.UNKNOWN;
                    break;
                }
            }
            return(result);
        }
コード例 #7
0
 public ArgTuple(KaitaiStream p__io, EnumIf.Operation p__parent = null, EnumIf p__root = null) : base(p__io)
 {
     m_parent = p__parent;
     m_root   = p__root;
     _read();
 }
コード例 #8
0
 public EnumIf(KaitaiStream p__io, KaitaiStruct p__parent = null, EnumIf p__root = null) : base(p__io)
 {
     m_parent = p__parent;
     m_root   = p__root ?? this;
     _read();
 }
コード例 #9
0
ファイル: LeadOS.cs プロジェクト: bastie/NetVampire
 private LeadOS(int os, String name)
 {
     delegateJ = new EnumDelegate(typeof(LeadOS), os, name, this);
 }
コード例 #10
0
ファイル: LeadSignature.cs プロジェクト: bastie/NetVampire
 private LeadSignature(int signature, String name)
 {
     delegateJ = new EnumDelegate(typeof(LeadSignature), signature, name, this);
 }
コード例 #11
0
ファイル: RPMHeaderTag.cs プロジェクト: bastie/NetVampire
        /**
         * Get a enum by name
         *
         * @param name
         *                The name of the enum
         * @return The enum object
         */
        public static EnumIf getEnumByName(String name)
        {
            EnumIf result = EnumDelegate.getEnumByName(typeof(RPMHeaderTag), name);

            return(result);
        }
コード例 #12
0
ファイル: RPMHeaderTag.cs プロジェクト: bastie/NetVampire
 private RPMHeaderTag(int tag, String name)
 {
     delegateJ = new EnumDelegate(typeof(RPMHeaderTag), tag, name, this);
 }
コード例 #13
0
 private LeadType(int type, String name)
 {
     delegateJ = new EnumDelegate(typeof(LeadType), type, name, this);
 }
コード例 #14
0
 private RPMIndexType(int type, String name, int size)
 {
     delegateJ = new EnumDelegate(typeof(RPMIndexType), type, name, this);
     this.size = size;
 }
コード例 #15
0
ファイル: LeadArchitecture.cs プロジェクト: bastie/NetVampire
 private LeadArchitecture(int architecture, String name)
 {
     delegateJ = new EnumDelegate(typeof(LeadArchitecture), architecture, name, this);
 }