Ejemplo n.º 1
0
        public FFFunction(FFApp app, FFFile file, FFClass cls, CodeModel.Definitions.FunctionDefinition def)
        {
#if DEBUG
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }
            if (def == null)
            {
                throw new ArgumentNullException("def");
            }
#endif

            _app   = app;
            _file  = file;
            _class = cls;
            _name  = def.Name;
            _sig   = def.Signature;
            _span  = new CodeModel.Span(def.SourceStartPos, def.SourceStartPos);
            _def   = def;

            UpdateVisibility();
        }
Ejemplo n.º 2
0
 public FFPermEx(FFFile file, ExtractStatement exToken, ExtractTableDefinition exDef)
 {
     _file = file;
     _name = exToken.Name;
     _def  = exDef;
     _fields.AddRange(exToken.Fields);
     _filePos = exToken.FilePosition;
 }
Ejemplo n.º 3
0
        public void OnVisibleFileChanged(FFFile file)
        {
            _consolidatedFunctions = null;
            _consolidatedClasses   = null;
            _consolidatedPermExs   = null;

            var fileNameLower = file.FileName.ToLower();

            if (!_files.ContainsKey(fileNameLower))
            {
                _files[fileNameLower] = file;
            }
        }
Ejemplo n.º 4
0
        public FFPermEx(FFFile file, SQLiteDataReader rdr)
        {
            _file = file;
            _name = rdr.GetString(rdr.GetOrdinal("name"));
            _id   = rdr.GetInt32(rdr.GetOrdinal("rowid"));

            var fileName = rdr.GetStringOrNull(rdr.GetOrdinal("alt_file_name"));

            if (string.IsNullOrEmpty(fileName))
            {
                fileName = file.FileName;
            }
            var pos = rdr.GetInt32(rdr.GetOrdinal("pos"));

            _filePos = new FilePosition(fileName, pos);

            _def = new ExtractTableDefinition(_name, _filePos, true);
        }
Ejemplo n.º 5
0
        public FFFunction(FFApp app, FFFile file, FFClass cls, SQLiteDataReader rdr)
        {
#if DEBUG
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }
#endif

            _app   = app;
            _file  = file;
            _class = cls;

            _id   = rdr.GetInt64(rdr.GetOrdinal("rowid"));
            _name = rdr.GetString(rdr.GetOrdinal("name"));
            _sig  = FunctionSignature.ParseFromDb(rdr.GetString(rdr.GetOrdinal("sig")));

            var devDescValue = rdr.GetStringOrNull(rdr.GetOrdinal("description"));
            if (devDescValue != null)
            {
                // TODO: Transitionary until the next database version
                if (_sig.Description == null)
                {
                    _sig.Description = devDescValue;
                }
            }

            var fileName    = _file.FileName;
            var altFileName = rdr.GetStringOrNull(rdr.GetOrdinal("alt_file_name"));
            if (!string.IsNullOrEmpty(altFileName))
            {
                fileName = altFileName;
            }
            var pos     = rdr.GetInt32(rdr.GetOrdinal("pos"));
            var filePos = new FilePosition(fileName, pos);

            _def = new CodeModel.Definitions.FunctionDefinition(_sig, filePos, 0, 0, 0, _span);

            UpdateVisibility();
        }
Ejemplo n.º 6
0
        public FFFile GetFileForScan(FFDatabase db, string fileName)
        {
            FFFile file;
            var    fileNameLower = fileName.ToLower();

            lock (_files)
            {
                if (_files.TryGetValue(fileNameLower, out file))
                {
                    return(file);
                }
            }

            // Check if this is in the list of invisible files.
            if (_invisibleFiles.ContainsKey(fileNameLower))
            {
                using (var cmd = db.CreateCommand("select rowid, * from file_ where app_id = @app_id and file_name = @file_name"))
                {
                    cmd.Parameters.AddWithValue("@app_id", _id);
                    cmd.Parameters.AddWithValue("@file_name", fileName);
                    using (var rdr = cmd.ExecuteReader(CommandBehavior.SingleRow))
                    {
                        if (rdr.Read())
                        {
                            file = new FFFile(this, db, rdr);
                        }
                    }
                }
            }

            if (file != null)
            {
                // Was loaded as invisible file
                file.Load(db);
                return(file);
            }

            // New file
            file = new FFFile(this, fileName);
            return(file);
        }
Ejemplo n.º 7
0
        public FFClass(FFApp app, FFFile file, string name)
        {
#if DEBUG
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("name");
            }
#endif

            _app  = app;
            _file = file;
            _name = name;
            _def  = new CodeModel.Definitions.ClassDefinition(_name, _file.FileName);
        }
Ejemplo n.º 8
0
        public void OnInvisibleFileChanged(FFFile file)
        {
            var fileNameLower = file.FileName.ToLower();

            _invisibleFiles[fileNameLower] = file.Modified;
        }