CsDebugScript.CodeGen.UserTypes.UserTypeFactory.GetUserType C# (CSharp) Method

GetUserType() private method

Look up for user type based on the specified module and type string.
private GetUserType ( Module module, string typeString, UserType &userType ) : bool
module Module The module.
typeString string The type string.
userType UserType The found user type.
return bool
        internal virtual bool GetUserType(Module module, string typeString, out UserType userType)
        {
            userType = GlobalCache.GetUserType(typeString, module);
            return userType != null;
        }

Same methods

UserTypeFactory::GetUserType ( Symbol type, UserType &userType ) : bool

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Updates the template arguments (symbols and user types).
        /// </summary>
        /// <param name="factory">The user type factory.</param>
        /// <returns><c>true</c> if all template arguments are resolved as user types.</returns>
        public bool UpdateTemplateArguments(UserTypeFactory factory)
        {
            bool result = true;

            templateArgumentsAsSymbols = ParseTemplateArguments(factory, Module, Symbol.Namespaces.Last()).ToList();
            templateArgumentsAsUserTypes.Clear();
            foreach (Symbol symbol in templateArgumentsAsSymbols)
            {
                // Try to get user type for the symbol
                UserType specializationUserType = null;

                if (!factory.GetUserType(symbol, out specializationUserType))
                {
                    if (symbol.Tag != CodeTypeTag.Enum && symbol.Tag != CodeTypeTag.Class && symbol.Tag != CodeTypeTag.Structure && symbol.Tag != CodeTypeTag.Union)
                    {
                        try
                        {
                            var typeString = GetSymbolTypeTree(symbol, factory).GetTypeString();

                            specializationUserType = new TemplateArgumentUserType(typeString, symbol);
                        }
                        catch
                        {
                        }
                    }
                }

                templateArgumentsAsUserTypes.Add(specializationUserType);
                result = result && specializationUserType != null;
            }

            // Enumerate all template arguments as strings
            IEnumerable <Symbol> allTemplateArguments = Enumerable.Empty <Symbol>();

            foreach (string symbolName in Symbol.Namespaces)
            {
                allTemplateArguments = allTemplateArguments.Concat(ParseTemplateArguments(factory, Module, symbolName));
            }

            AllTemplateArguments = allTemplateArguments.Select(s => s.Name).ToList();

            // TODO: Unused types should be removed
            return(result);
        }
All Usage Examples Of CsDebugScript.CodeGen.UserTypes.UserTypeFactory::GetUserType