Exemplo n.º 1
0
        public FFFile(FFApp app, FFDatabase db, SQLiteDataReader fileRdr)
        {
#if DEBUG
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }
            if (fileRdr == null)
            {
                throw new ArgumentNullException("rdr");
            }
#endif
            _app      = app;
            _id       = fileRdr.GetInt64(fileRdr.GetOrdinal("rowid"));
            _fileName = fileRdr.GetString(fileRdr.GetOrdinal("file_name"));
            _context  = FileContextUtil.GetFileContextFromFileName(_fileName);
            _modified = fileRdr.GetDateTime(fileRdr.GetOrdinal("modified"));

            var className = FileContextUtil.GetClassNameFromFileName(_fileName);
            if (!string.IsNullOrEmpty(className))
            {
                _class = new FFClass(_app, this, className);
            }

            UpdateVisibility();
        }
Exemplo n.º 2
0
        public FFFile(FFApp app, string fileName)
        {
#if DEBUG
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }
#endif
            _app      = app;
            _id       = 0L;             // Will be inserted during next database update
            _fileName = fileName;
            _modified = Constants.ZeroDate;
            _context  = FileContextUtil.GetFileContextFromFileName(_fileName);

            var className = FileContextUtil.GetClassNameFromFileName(_fileName);
            if (!string.IsNullOrEmpty(className))
            {
                _class = new FFClass(_app, this, className);
            }

            UpdateVisibility();
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
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();
        }