~ricotz/valide/valide-svgicons

« back to all changes in this revision

Viewing changes to plugins/completion/afrodite-provider/afrodite/queryoptions.vala

  • Committer: gege2061
  • Date: 2010-09-03 21:40:48 UTC
  • Revision ID: svn-v4:35bcdfa6-b98f-11dd-bba1-afcbec1a1e1f:trunk:687
Use Afrodite for completion

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* queryoptions.vala
 
2
 *
 
3
 * Copyright (C) 2010 Andrea Del Signore
 
4
 *
 
5
 * This library is free software: you can redistribute it and/or modify
 
6
 * it under the terms of the GNU Lesser General Public License as published by
 
7
 * the Free Software Foundation, either version 2.1 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU Lesser General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Lesser General Public License
 
16
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
17
 *
 
18
 * Author:
 
19
 *      Andrea Del Signore <sejerpz@tin.it>
 
20
 */
 
21
 
 
22
using GLib;
 
23
using Vala;
 
24
 
 
25
namespace Afrodite
 
26
{       
 
27
        public class QueryOptions
 
28
        {
 
29
                public bool all_symbols = false; // don't filter
 
30
                public bool only_creation_methods = false;
 
31
                public bool only_static_factories = false; // this covers static methods factories and struct initialization
 
32
                public bool only_error_domains = false;
 
33
                public bool exclude_creation_methods = true;
 
34
                public bool exclude_code_node = true; // skip code node: symbols that starts with ! and rapresent a statement with scope like if or foreach
 
35
                
 
36
                public SymbolAccessibility access = SymbolAccessibility.ANY;
 
37
                
 
38
                public bool auto_member_binding_mode = true; // if true the query function will adapt the member binding value automatically
 
39
                public MemberBinding binding = MemberBinding.ANY;
 
40
 
 
41
                public CompareMode compare_mode = CompareMode.EXACT;
 
42
                
 
43
                public static QueryOptions standard ()
 
44
                {
 
45
                        return new QueryOptions ();
 
46
                }
 
47
                
 
48
                public static QueryOptions creation_methods ()
 
49
                {
 
50
                        var opt = new QueryOptions ();
 
51
                        opt.only_creation_methods = true;
 
52
                        opt.exclude_creation_methods = false;
 
53
                        return opt;
 
54
                }
 
55
                
 
56
                public static QueryOptions factory_methods ()
 
57
                {
 
58
                        var opt = new QueryOptions ();
 
59
                        opt.only_static_factories = true;
 
60
                        return opt;
 
61
                }
 
62
                
 
63
                public static QueryOptions error_domains ()
 
64
                {
 
65
                        var opt = new QueryOptions ();
 
66
                        opt.only_error_domains = true;
 
67
                        return opt;
 
68
                }
 
69
                
 
70
                public void dump_settings ()
 
71
                {
 
72
                        Utils.trace ("Member Binding (autoadapt: %s)", auto_member_binding_mode ? "true" : "false");
 
73
                        Utils.trace ("    Instance: %s", (binding & MemberBinding.INSTANCE) != 0 ? "true" : "false");
 
74
                        Utils.trace ("    Static: %s", (binding & MemberBinding.STATIC) != 0 ? "true" : "false");
 
75
                        Utils.trace ("    Class: %s", (binding & MemberBinding.CLASS) != 0 ? "true" : "false");
 
76
 
 
77
                        Utils.trace ("Scope");
 
78
                        Utils.trace ("    Private: %s", (access & SymbolAccessibility.PRIVATE) != 0 ? "true" : "false");
 
79
                        Utils.trace ("    Protected: %s", (access & SymbolAccessibility.PROTECTED) != 0 ? "true" : "false");
 
80
                        Utils.trace ("    Internal: %s", (access & SymbolAccessibility.INTERNAL) != 0 ? "true" : "false");
 
81
                        Utils.trace ("    Public: %s", (access & SymbolAccessibility.PUBLIC) != 0 ? "true" : "false");
 
82
                        
 
83
                        Utils.trace ("All symbols.............: %s", all_symbols ? "true" : "false");
 
84
                        Utils.trace ("Error domains only......: %s", only_error_domains ? "true" : "false");
 
85
                        Utils.trace ("Static factories only...: %s", only_static_factories ? "true" : "false");
 
86
                        Utils.trace ("Creation methods only...: %s", only_creation_methods ? "true" : "false");
 
87
                        Utils.trace ("Creation methods exclude: %s", exclude_creation_methods ? "true" : "false");
 
88
                }
 
89
        }
 
90
}