예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StringValue"/> class.
        /// </summary>
        /// <param name="theBytes">The bytes.</param>
        /// <param name="theStringDefinition">The string definition.</param>
        /// <param name="parent">The parent.</param>
        public StringValue(ByteStore theBytes, StringDefinition theStringDefinition, Value parent)
            : base(theStringDefinition, parent)
        {
            List<Byte> stringBytes = new List<byte>();

            // Read bytes until they run out or we hit null terminator
            Byte theByte = 0xff;
            while (theBytes.ReadPosition < theBytes.PayloadLength && theByte != '\0')
            {
                theByte = theBytes.GetByte();
                stringBytes.Add(theByte);
            }

            m_Value = Encoding.ASCII.GetString(stringBytes.ToArray());
        }
        /// <summary>
        /// Initializes static members of the <see cref="DictionaryManager"/> class.
        /// </summary>
        static DictionaryManager()
        {
            s_ObjectNamesToTypes["struct"] = TypeId.StructType;
            s_ObjectNamesToTypes["union"] = TypeId.UnionType;
            s_ObjectNamesToTypes["typedef"] = TypeId.TypeDefType;
            s_ObjectNamesToTypes["enum"] = TypeId.EnumType;
            s_ObjectNamesToTypes["basetype"] = TypeId.BaseType;
            s_ObjectNamesToTypes["switch"] = TypeId.SwitchType;

            s_TypeIdsToXmlTags[TypeId.StructType] = "Struct";
            s_TypeIdsToXmlTags[TypeId.UnionType] = "Union";
            s_TypeIdsToXmlTags[TypeId.TypeDefType] = "TypeDef";
            s_TypeIdsToXmlTags[TypeId.EnumType] = "Enum";
            s_TypeIdsToXmlTags[TypeId.BaseType] = "BaseType";
            s_TypeIdsToXmlTags[TypeId.SwitchType] = "Switch";

            StringDefinition stringDefinition = new StringDefinition ();
            s_BuiltInTypes[stringDefinition.Name] = stringDefinition;
        }
        /// <summary>
        /// Initializes a new instance of the DictionaryManager class
        /// </summary>
        public DictionaryManager()
        {
            IsLoaded = false;

            m_TypeDefinitionsByName = new MultiDictionary<string, TypeDefinition>(false);

            // Add special built-in type 'String'
            StringDefinition theStringDefinition = new StringDefinition();
            m_TypeDefinitionsByName.Add(theStringDefinition.Name, theStringDefinition);
        }