예제 #1
0
            public IClassVarElement GetVar(string uniqueName)
            {
                VCCodeVariable varElem = GetCodeVar(uniqueName);

                if (varElem != null)
                {
                    return(new ClassVarElement(varElem, this));
                }

                return(null);
            }
예제 #2
0
            public VCCodeVariable GetCodeVar(string uniqueName)
            {
                try
                {
                    foreach (CodeElement _elem in ent.Variables)
                    {
                        VCCodeVariable varElem = (VCCodeVariable)_elem;
                        if (varElem.FullName == uniqueName)
                        {
                            if (IsTypeSupported(varElem))
                            {
                                return(varElem);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }

                return(null);
            }
예제 #3
0
 public CheckElem(VCCodeVariable _var, bool _exists)
 {
     var        = _var;
     existsOrig = exists = _exists;
 }
예제 #4
0
            static public bool IsTypeSupported(VCCodeVariable varElem)
            {
                if (varElem.Type.TypeKind == vsCMTypeRef.vsCMTypeRefBool ||
                    varElem.Type.TypeKind == vsCMTypeRef.vsCMTypeRefByte ||
                    varElem.Type.TypeKind == vsCMTypeRef.vsCMTypeRefChar ||
                    varElem.Type.TypeKind == vsCMTypeRef.vsCMTypeRefDecimal ||
                    varElem.Type.TypeKind == vsCMTypeRef.vsCMTypeRefDouble ||
                    varElem.Type.TypeKind == vsCMTypeRef.vsCMTypeRefFloat ||
                    varElem.Type.TypeKind == vsCMTypeRef.vsCMTypeRefInt ||
                    varElem.Type.TypeKind == vsCMTypeRef.vsCMTypeRefLong ||
                    varElem.Type.TypeKind == vsCMTypeRef.vsCMTypeRefShort

                    || varElem.TypeString.Contains("signed ")
                    //|| varElem.TypeString == "unsigned short"
                    //|| varElem.TypeString == "unsigned short int"
                    //|| varElem.TypeString == "unsigned int"
                    //|| varElem.TypeString == "unsigned long"
                    //|| varElem.TypeString == "unsigned long int"
                    //|| varElem.TypeString == "unsigned long long"
                    //|| varElem.TypeString == "unsigned long long int"
                    //|| varElem.TypeString == "unsigned char"
                    ////|| varElem.TypeString == "signed short" // vsCMTypeRefInt
                    //|| varElem.TypeString == "signed short int"
                    ////|| varElem.TypeString == "signed int" //vsCMTypeRefInt
                    ////|| varElem.TypeString == "signed long" // vsCMTypeRefInt
                    //|| varElem.TypeString == "signed long int"
                    //|| varElem.TypeString == "signed long long"
                    //|| varElem.TypeString == "signed long long int"
                    ////|| varElem.TypeString == "signed char" // vsCMTypeRefInt

                    || varElem.TypeString.Contains("long ")
                    //|| varElem.TypeString == "long int"
                    //|| varElem.TypeString == "long long"
                    //|| varElem.TypeString == "long long int"

                    //|| varElem.TypeString == "short" // vsCMTypeRefShort
                    || varElem.TypeString == "short int"
                    //|| varElem.TypeString == "int" // vsCMTypeRefInt
                    //|| varElem.TypeString == "signed" // vsCMTypeRefInt
                    || varElem.TypeString == "unsigned" ||
                    varElem.TypeString == "long"
                    //|| varElem.TypeString == "double" // vsCMTypeRefDouble
                    //|| varElem.TypeString == "float" // vsCMTypeRefFloat
                    //|| varElem.TypeString == "bool" // vsCMTypeRefBool
                    //|| varElem.TypeString == "char" // vsCMTypeRefChar
                    || varElem.TypeString == "int8_t" || // signed char
                    varElem.TypeString == "int16_t" || // short
                    varElem.TypeString == "int32_t" || // int
                    varElem.TypeString == "int64_t" || // long long
                    varElem.TypeString == "uint8_t" || // unsigned char
                    varElem.TypeString == "uint16_t" || // unsigned short
                    varElem.TypeString == "uint32_t" || // unsigned int
                    varElem.TypeString == "uint64_t" // unsigned long long
                    )
                {
                    //Debug.WriteLine(varElem.TypeString + " : " + varElem.Type.TypeKind.ToString());
                    return(true);
                }
                //else
                //  Debug.WriteLine(varElem.TypeString);

                return(false);
            }