Inheritance: SimplBaseType
Beispiel #1
0
        /// <summary>
        /// Registers a given SimplType into one of the relevant type registries.
        /// </summary>
        /// <param name="type">Type to register</param>
        /// <returns>True if it succeded, false if it was not registered, exception if an issue occurred or the type would not fit in a category.</returns>
        public static bool RegisterSimplType(SimplType type)
        {
            bool result = false;

            result |= ScalarTypes.TryAdd(type);
            result |= CollectionTypes.TryAdd(type);
            result |= CompositeTypes.TryAdd(type);
            result |= SimplTypes.TryAdd(type);

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Registers an entire array of simplTypes
        /// </summary>
        /// <param name="simplTypes">Simpl Types to register</param>
        /// <returns>True if all succeeded, false if any fail.</returns>
        public static bool RegisterTypes(SimplType[] simplTypes)
        {
            bool result = true;

            foreach (var type in simplTypes)
            {
                result &= RegisterSimplType(type);
            }

            return result;
        }
Beispiel #3
0
        /// <summary>
        /// Registers a given SimplType into one of the relevant type registries.
        /// </summary>
        /// <param name="type">Type to register</param>
        /// <returns>True if it succeded, false if it was not registered, exception if an issue occurred or the type would not fit in a category.</returns>
        public static bool RegisterSimplType(SimplType type)
        {
            bool result = false;

            result |= ScalarTypes.TryAdd(type);
            result |= CollectionTypes.TryAdd(type);
            result |= CompositeTypes.TryAdd(type);
            result |= SimplTypes.TryAdd(type);

            return result;
        }
        /// <summary>
        /// Initializes an instance of <see cref="TypeCollection"/> with the default creation predicate (which throws an error on type creation.)
        /// </summary>
        public TypeCollection()
        {
            this.nameindexers = new List <TypeCollectionIndexer <string, SomeType> >();

            this.JavaName          = new TypeCollectionIndexer <string, SomeType>((t) => t.JavaTypeName);
            this.SimpleName        = new TypeCollectionIndexer <string, SomeType>((t) => t.SimplName);
            this.CSharpName        = new TypeCollectionIndexer <string, SomeType>((t) => t.CSharpTypeName);
            this.ObjectiveCName    = new TypeCollectionIndexer <string, SomeType>((t) => t.ObjectiveCTypeName);
            this.DBName            = new TypeCollectionIndexer <string, SomeType>((t) => t.DbTypeName);
            this.CSharpType        = new TypeCollectionIndexer <Type, SomeType>((t) => t.CSharpType);
            this.CrossPlatformName = new TypeCollectionIndexer <string, SomeType>((t) => SimplType.DeriveCrossPlatformName(t.CSharpType, t is ScalarType));

            nameindexers.AddRange(new[] { CSharpName, JavaName, SimpleName, CrossPlatformName, ObjectiveCName, DBName });
        }