[anjuta] symbol-db: using IAnjutaSymbolType and IAnjutaSymbolManagerSearchFileScope.



commit a138246550eeda3f834108d58c5f2b0340ab7df2
Author: Massimo Corà <mcora src gnome org>
Date:   Tue May 11 00:23:12 2010 +0200

    symbol-db: using IAnjutaSymbolType and IAnjutaSymbolManagerSearchFileScope.
    
    Interface enums constants are now used inside symbol-db plugin to avoid
    dups and maintenance problems

 plugins/symbol-db/plugin.c                   |    1 +
 plugins/symbol-db/symbol-db-engine-core.c    |    2 +-
 plugins/symbol-db/symbol-db-engine-priv.h    |   43 +++----------------------
 plugins/symbol-db/symbol-db-engine-queries.c |   10 +++---
 plugins/symbol-db/symbol-db-engine-utils.c   |   44 +++++++++++++-------------
 5 files changed, 34 insertions(+), 66 deletions(-)
---
diff --git a/plugins/symbol-db/plugin.c b/plugins/symbol-db/plugin.c
index b60866c..685b7cf 100644
--- a/plugins/symbol-db/plugin.c
+++ b/plugins/symbol-db/plugin.c
@@ -30,6 +30,7 @@
 #include <libanjuta/anjuta-tabber.h>
 #include <libanjuta/interfaces/ianjuta-document-manager.h>
 #include <libanjuta/interfaces/ianjuta-symbol-manager.h>
+#include <libanjuta/interfaces/ianjuta-symbol.h>
 #include <libanjuta/interfaces/ianjuta-project-manager.h>
 #include <libanjuta/interfaces/ianjuta-file-manager.h>
 #include <libanjuta/interfaces/ianjuta-file.h>
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index ef3ea80..ace13d4 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -4198,7 +4198,7 @@ sdb_engine_add_new_sym_kind (SymbolDBEngine * dbe, const tagEntry * tag_entry)
 		sym_type = GPOINTER_TO_SIZE (g_hash_table_lookup (priv->sym_type_conversion_hash, 
 		    									kind_name));
 		
-		if (sym_type & SYMTYPE_SCOPE_CONTAINER)
+		if (sym_type & IANJUTA_SYMBOL_TYPE_SCOPE_CONTAINER)
 			is_container = 1;
 		
 		MP_SET_HOLDER_BATCH_INT(priv, param, is_container, ret_bool, ret_value);
diff --git a/plugins/symbol-db/symbol-db-engine-priv.h b/plugins/symbol-db/symbol-db-engine-priv.h
index 5d58cfe..5dcd729 100644
--- a/plugins/symbol-db/symbol-db-engine-priv.h
+++ b/plugins/symbol-db/symbol-db-engine-priv.h
@@ -31,6 +31,9 @@
 #include <libgda/libgda.h>
 #include <sql-parser/gda-sql-parser.h>
 
+#include <libanjuta/interfaces/ianjuta-symbol-manager.h>
+#include <libanjuta/interfaces/ianjuta-symbol.h>
+
 /* file should be specified without the ".db" extension. */
 #define ANJUTA_DB_FILE	".anjuta_sym_db"
 
@@ -263,45 +266,9 @@ typedef enum {
 	
 } SymExtraInfo;
 
-/* WARNING: these must match the ones on libanjuta.idl [IAnjutaSymbol::Type] */
-typedef enum 
-{
-	SYMTYPE_UNDEF = 1,                
-	SYMTYPE_CLASS = 2,                
-	SYMTYPE_ENUM = 4,                 
-	SYMTYPE_ENUMERATOR = 8,           
-	SYMTYPE_FIELD = 16,               
-	SYMTYPE_FUNCTION = 32,            
-	SYMTYPE_INTERFACE = 64,           
-	SYMTYPE_MEMBER = 128,             
-	SYMTYPE_METHOD = 256,             
-	SYMTYPE_NAMESPACE = 512,          
-	SYMTYPE_PACKAGE = 1024,           
-	SYMTYPE_PROTOTYPE = 2048,         
-	SYMTYPE_STRUCT = 4096,            
-	SYMTYPE_TYPEDEF = 8192,           
-	SYMTYPE_UNION = 16384,            
-	SYMTYPE_VARIABLE = 32768,
-	SYMTYPE_EXTERNVAR = 65536,
-	SYMTYPE_MACRO = 131072,
-	SYMTYPE_MACRO_WITH_ARG = 262144,
-	SYMTYPE_FILE = 524288,
-	SYMTYPE_OTHER = 1048576,
-	SYMTYPE_SCOPE_CONTAINER = SYMTYPE_CLASS | SYMTYPE_ENUM |
-							SYMTYPE_INTERFACE | SYMTYPE_NAMESPACE | SYMTYPE_PACKAGE |
-							SYMTYPE_STRUCT | SYMTYPE_UNION,
-	SYMTYPE_MAX = 2097151,	
-		
-} SymType;
 
-/* WARNING: these must match the ones on libanjuta.idl [IAnjutaSymbolManager:SearchFileScope] */
-typedef enum 
-{
-	SYMSEARCH_FILESCOPE_IGNORE = -1,
-	SYMSEARCH_FILESCOPE_PUBLIC = 1,
-	SYMSEARCH_FILESCOPE_PRIVATE = 0
-	
-} SymSearchFileScope;
+typedef IAnjutaSymbolType SymType;
+typedef IAnjutaSymbolManagerSearchFileScope SymSearchFileScope;
 
 /* the SymbolDBEngine Private structure */
 struct _SymbolDBEnginePriv
diff --git a/plugins/symbol-db/symbol-db-engine-queries.c b/plugins/symbol-db/symbol-db-engine-queries.c
index 6b7437c..b2f4c85 100644
--- a/plugins/symbol-db/symbol-db-engine-queries.c
+++ b/plugins/symbol-db/symbol-db-engine-queries.c
@@ -1360,7 +1360,7 @@ symbol_db_engine_find_symbol_by_name_pattern_on_file (SymbolDBEngine *dbe,
 	dyn_node = NULL;
 
 	/* determine the filter_kinds thing */
-	if (filter_kinds == SYMTYPE_UNDEF)
+	if (filter_kinds == IANJUTA_SYMBOL_TYPE_UNDEF)
 		filter_kinds_array = NULL;
 	else
 		filter_kinds_array = symbol_db_util_fill_type_array (filter_kinds);
@@ -1662,7 +1662,7 @@ symbol_db_engine_find_symbol_in_scope (SymbolDBEngine *dbe,
 	dyn_node = NULL;
 
 	/* determine the filter_kinds thing */
-	if (filter_kinds == SYMTYPE_UNDEF)
+	if (filter_kinds == IANJUTA_SYMBOL_TYPE_UNDEF)
 		filter_kinds_array = NULL;
 	else
 		filter_kinds_array = symbol_db_util_fill_type_array (filter_kinds);
@@ -1988,7 +1988,7 @@ symbol_db_engine_find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe,
 	dyn_node = NULL;
 
 	/* determine the filter_kinds thing */
-	if (filter_kinds == SYMTYPE_UNDEF)
+	if (filter_kinds == IANJUTA_SYMBOL_TYPE_UNDEF)
 		filter_kinds_array = NULL;
 	else
 		filter_kinds_array = symbol_db_util_fill_type_array (filter_kinds);
@@ -2007,13 +2007,13 @@ symbol_db_engine_find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe,
 		match_str = " LIKE ## /* name:'pattern' type:gchararray */";
 	}	
 	
-	if (filescope_search == SYMSEARCH_FILESCOPE_PUBLIC)
+	if (filescope_search == IANJUTA_SYMBOL_MANAGER_SEARCH_FS_PUBLIC)
 	{
 		other_parameters |= 
 			DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_YES;
 		file_scope_str = " AND symbol.is_file_scope = 0 ";
 	}
-	else if (filescope_search == SYMSEARCH_FILESCOPE_PRIVATE)
+	else if (filescope_search == IANJUTA_SYMBOL_MANAGER_SEARCH_FS_PRIVATE)
 	{
 		other_parameters |= 
 			DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_NO;
diff --git a/plugins/symbol-db/symbol-db-engine-utils.c b/plugins/symbol-db/symbol-db-engine-utils.c
index a3ceec7..e3e67d3 100644
--- a/plugins/symbol-db/symbol-db-engine-utils.c
+++ b/plugins/symbol-db/symbol-db-engine-utils.c
@@ -328,112 +328,112 @@ symbol_db_util_fill_type_array (SymType match_types)
 	GPtrArray *filter_array;
 	filter_array = g_ptr_array_new ();
 
-	if (match_types & SYMTYPE_CLASS)
+	if (match_types & IANJUTA_SYMBOL_TYPE_CLASS)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("class"));
 	}
 
-	if (match_types & SYMTYPE_ENUM)
+	if (match_types & IANJUTA_SYMBOL_TYPE_ENUM)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("enum"));
 	}
 	
-	if (match_types & SYMTYPE_ENUMERATOR)
+	if (match_types & IANJUTA_SYMBOL_TYPE_ENUMERATOR)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("enumerator"));
 	}
 	
-	if (match_types & SYMTYPE_FIELD)
+	if (match_types & IANJUTA_SYMBOL_TYPE_FIELD)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("field"));
 	}
 	
-	if (match_types & SYMTYPE_FUNCTION)
+	if (match_types & IANJUTA_SYMBOL_TYPE_FUNCTION)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("function"));
 	}
 	
-	if (match_types & SYMTYPE_INTERFACE)
+	if (match_types & IANJUTA_SYMBOL_TYPE_INTERFACE)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("interface"));
 	}
 	
-	if (match_types & SYMTYPE_MEMBER)
+	if (match_types & IANJUTA_SYMBOL_TYPE_MEMBER)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("member"));
 	}
 	
-	if (match_types & SYMTYPE_METHOD)
+	if (match_types & IANJUTA_SYMBOL_TYPE_METHOD)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("method"));
 	}
 	
-	if (match_types & SYMTYPE_NAMESPACE)
+	if (match_types & IANJUTA_SYMBOL_TYPE_NAMESPACE)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("namespace"));
 	}
 	
-	if (match_types & SYMTYPE_PACKAGE)
+	if (match_types & IANJUTA_SYMBOL_TYPE_PACKAGE)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("package"));
 	}
 	
-	if (match_types & SYMTYPE_PROTOTYPE)
+	if (match_types & IANJUTA_SYMBOL_TYPE_PROTOTYPE)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("prototype"));
 	}
 	
-	if (match_types & SYMTYPE_STRUCT)
+	if (match_types & IANJUTA_SYMBOL_TYPE_STRUCT)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("struct"));
 	}
 
-	if (match_types & SYMTYPE_TYPEDEF)
+	if (match_types & IANJUTA_SYMBOL_TYPE_TYPEDEF)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("typedef"));
 	}
 	
-	if (match_types & SYMTYPE_STRUCT)
+	if (match_types & IANJUTA_SYMBOL_TYPE_STRUCT)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("struct"));
 	}
 	
-	if (match_types & SYMTYPE_UNION)
+	if (match_types & IANJUTA_SYMBOL_TYPE_UNION)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("union"));
 	}
 	
-	if (match_types & SYMTYPE_VARIABLE)
+	if (match_types & IANJUTA_SYMBOL_TYPE_VARIABLE)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("variable"));
 	}
 				
-	if (match_types & SYMTYPE_EXTERNVAR)
+	if (match_types & IANJUTA_SYMBOL_TYPE_EXTERNVAR)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("externvar"));
 	}
 	
-	if (match_types & SYMTYPE_MACRO)
+	if (match_types & IANJUTA_SYMBOL_TYPE_MACRO)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("macro"));
 	}
 	
-	if (match_types & SYMTYPE_MACRO_WITH_ARG)
+	if (match_types & IANJUTA_SYMBOL_TYPE_MACRO_WITH_ARG)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("macro_with_arg"));
 	}
 	
-	if (match_types & SYMTYPE_FILE)
+	if (match_types & IANJUTA_SYMBOL_TYPE_FILE)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("file"));
 	}
 	
-	if (match_types & SYMTYPE_VARIABLE)
+	if (match_types & IANJUTA_SYMBOL_TYPE_VARIABLE)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("variable"));
 	}
 	
-	if (match_types & SYMTYPE_OTHER)
+	if (match_types & IANJUTA_SYMBOL_TYPE_OTHER)
 	{
 		g_ptr_array_add (filter_array, g_strdup ("other"));
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]