[anjuta] symbol-db: added parameter filescope_search to _search_project* and _search_system*



commit 3660d4112b7582f2c534af7c3d49d4b88fe52b44
Author: Massimo Corà <mcora src gnome org>
Date:   Sat Aug 1 18:00:01 2009 +0200

    symbol-db: added parameter filescope_search to _search_project* and _search_system*
    
    This is necessary because of it's really useful when doing async queries, avoiding to
    do more queries.

 libanjuta/interfaces/libanjuta.idl           |   22 ++++++++++++++++---
 plugins/symbol-db/symbol-db-iface.c          |   29 +++++++++++++++++---------
 plugins/symbol-db/symbol-db-iface.h          |    8 +++++-
 plugins/symbol-db/symbol-db-search-command.c |    5 +++-
 plugins/symbol-db/symbol-db-search-command.h |    1 +
 5 files changed, 48 insertions(+), 17 deletions(-)
---
diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl
index fbe1bd2..d64c03d 100644
--- a/libanjuta/interfaces/libanjuta.idl
+++ b/libanjuta/interfaces/libanjuta.idl
@@ -5270,6 +5270,9 @@ interface IAnjutaSymbolManager
 	* @pattern Pattern you want to search for. It can me something like 'foo_func' (exact match)
 	*          or something like 'foo_fun%' (LIKE match, matching all the symbol prefixed with 
 	*          'foo_fun'). NULL _is not_ accepted
+	* @filescope_search: if #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_PUBLIC it will search only for public/extern functions. 
+	* 						If #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_PRIVATE it will search also for static/private functions.
+	* 						If #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_IGNORE it'll search for both public and private
 	* @results_limit: Limit results to an upper bound. -1 If you don't want to use this par.
 	* @results_offset: Skip results_offset results. -1 If you don't want to use this par.	 
 	* @err: Error propagation and reporting.	 
@@ -5281,7 +5284,7 @@ interface IAnjutaSymbolManager
 	* Returns: an iteratable object, or NULL if error occurs or if no symbols are found.
 	* 
 	*/	
-	IAnjutaIterable* search_system (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *pattern, gint results_limit, gint results_offset);
+	IAnjutaIterable* search_system (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *pattern, SearchFileScope filescope_search, gint results_limit, gint results_offset);
 
 	/**
 	* ianjuta_symbol_manager_search_project_async:
@@ -5293,6 +5296,9 @@ interface IAnjutaSymbolManager
 	* @pattern Pattern you want to search for. It can me something like 'foo_func' (exact match)
 	*          or something like 'foo_fun%' (LIKE match, matching all the symbol prefixed with 
 	*          'foo_fun'). NULL _is not_ accepted
+	* @filescope_search: if #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_PUBLIC it will search only for public/extern functions. 
+	* 						If #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_PRIVATE it will search also for static/private functions.
+	* 						If #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_IGNORE it'll search for both public and private
 	* @results_limit: Limit results to an upper bound. -1 If you don't want to use this par.
 	* @results_offset: Skip results_offset results. -1 If you don't want to use this par.	 
 	* @cancel: An optional #GCancellable object to cancel the operation, or NULL.
@@ -5308,7 +5314,7 @@ interface IAnjutaSymbolManager
 	* more async queries at the same time. This is for identify them. Returns 0 on error.
 	* 
     */
-	guint search_system_async (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *pattern, gint results_limit, gint results_offset, GCancellable* cancel, AnjutaAsyncNotify *notify, SearchCallback callback, gpointer callback_user_data);
+	guint search_system_async (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *pattern, SearchFileScope filescope_search, gint results_limit, gint results_offset, GCancellable* cancel, AnjutaAsyncNotify *notify, SearchCallback callback, gpointer callback_user_data);
 	
 	/**
 	* ianjuta_symbol_manager_search_project:
@@ -5320,6 +5326,9 @@ interface IAnjutaSymbolManager
 	* @pattern Pattern you want to search for. It can me something like 'foo_func' (exact match)
 	*          or something like 'foo_fun%' (LIKE match, matching all the symbol prefixed with 
 	*          'foo_fun'). NULL _is not_ accepted
+	* @filescope_search: if #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_PUBLIC it will search only for public/extern functions. 
+	* 						If #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_PRIVATE it will search also for static/private functions.
+	* 						If #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_IGNORE it'll search for both public and private
 	* @results_limit: Limit results to an upper bound. -1 If you don't want to use this par.
 	* @results_offset: Skip results_offset results. -1 If you don't want to use this par.	 
 	* @err: Error propagation and reporting.	 
@@ -5330,7 +5339,7 @@ interface IAnjutaSymbolManager
 	* Returns: an iteratable object, or NULL if error occurs or if no symbols are found.
 	* 
 	*/	
-	IAnjutaIterable* search_project (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *pattern, gint results_limit, gint results_offset);
+	IAnjutaIterable* search_project (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *pattern, SearchFileScope filescope_search, gint results_limit, gint results_offset);
 
 	/**
 	* ianjuta_symbol_manager_search_project_async:
@@ -5342,6 +5351,9 @@ interface IAnjutaSymbolManager
 	* @pattern Pattern you want to search for. It can me something like 'foo_func' (exact match)
 	*          or something like 'foo_fun%' (LIKE match, matching all the symbol prefixed with 
 	*          'foo_fun'). NULL _is not_ accepted	
+	* @filescope_search: if #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_PUBLIC it will search only for public/extern functions. 
+	* 						If #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_PRIVATE it will search also for static/private functions.
+	* 						If #IANJUTA_SYMBOL_MANAGER_SEARCH_FS_IGNORE it'll search for both public and private
     * @results_limit: Limit results to an upper bound. -1 If you don't want to use this par.
 	* @results_offset: Skip results_offset results. -1 If you don't want to use this par.	 
 	* @cancel: An optional #GCancellable object to cancel the operation, or NULL.
@@ -5357,7 +5369,7 @@ interface IAnjutaSymbolManager
 	* more async queries at the same time. This is for identify them. Returns 0 on error.
 	* 
     */	
-	guint search_project_async (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *pattern, gint results_limit, gint results_offset, GCancellable* cancel, AnjutaAsyncNotify *notify, SearchCallback callback, gpointer callback_user_data);
+	guint search_project_async (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *pattern, SearchFileScope filescope_search, gint results_limit, gint results_offset, GCancellable* cancel, AnjutaAsyncNotify *notify, SearchCallback callback, gpointer callback_user_data);
 	
 	/**
 	* ianjuta_symbol_manager_search_file:
@@ -5376,6 +5388,7 @@ interface IAnjutaSymbolManager
 	*
 	* Database query. The returned #IAnjutaIterable object must be unreffed after use.
 	* The search is case sensitive. Symbols are searched only in the specified file.
+	* There won't be distinction in symbols with file_scope = 1 or 0
 	* 
 	* Returns: an iteratable object, or NULL if error occurs or if no symbols are found.
 	* 
@@ -5403,6 +5416,7 @@ interface IAnjutaSymbolManager
 	*
 	* Async database query. The returned #IAnjutaIterable object must be unreffed after use.
 	* The search is case sensitive. Symbols are searched only in the specified file.
+	* There won't be distinction in symbols with file_scope = 1 or 0
 	* 
 	* Returns: guint handle to identify the query result. It would infact be possible to have
 	* more async queries at the same time. This is for identify them. Returns 0 on error.
diff --git a/plugins/symbol-db/symbol-db-iface.c b/plugins/symbol-db/symbol-db-iface.c
index 42ca57a..51f9215 100644
--- a/plugins/symbol-db/symbol-db-iface.c
+++ b/plugins/symbol-db/symbol-db-iface.c
@@ -234,7 +234,8 @@ isymbol_manager_get_symbol_by_id (IAnjutaSymbolManager *sm,
 static SymbolDBEngineIterator *
 do_search_prj_glb (SymbolDBEngine *dbe, IAnjutaSymbolType match_types,
            gboolean include_types, IAnjutaSymbolField info_fields,
-           const gchar *pattern, gint results_limit, gint results_offset, 
+           const gchar *pattern, IAnjutaSymbolManagerSearchFileScope filescope_search,
+    	   gint results_limit, gint results_offset, 
            GList *session_packages)
 {
 	SymbolDBEngineIterator *iterator;
@@ -244,7 +245,7 @@ do_search_prj_glb (SymbolDBEngine *dbe, IAnjutaSymbolType match_types,
 					pattern,
 					match_types,
 					include_types,
-					SYMSEARCH_FILESCOPE_PUBLIC,
+					filescope_search,
 					session_packages,
 					results_limit,
 					results_offset,
@@ -256,7 +257,8 @@ do_search_prj_glb (SymbolDBEngine *dbe, IAnjutaSymbolType match_types,
 IAnjutaIterable* 
 isymbol_manager_search_system (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_types, 
 				gboolean include_types,  IAnjutaSymbolField info_fields, 
-				const gchar *pattern, gint results_limit, gint results_offset, 
+				const gchar *pattern, IAnjutaSymbolManagerSearchFileScope filescope_search,
+    			gint results_limit, gint results_offset, 
 				GError **err)
 {
 	SymbolDBPlugin *sdb_plugin;
@@ -269,7 +271,7 @@ isymbol_manager_search_system (IAnjutaSymbolManager *sm, IAnjutaSymbolType match
 	dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_globals);
 
 	iterator = do_search_prj_glb (dbe, match_types, info_fields, 
-	                      include_types, pattern, 
+	                      include_types, pattern, filescope_search,
 						  results_limit, results_offset,
 	           			  sdb_plugin->session_packages);
 
@@ -350,7 +352,8 @@ do_search_prj_glb_async (SymbolDBSearchCommand *search_command, guint cmd_id,
 
 guint
 isymbol_manager_search_system_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_types, 
-				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern, 
+				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern,
+    			IAnjutaSymbolManagerSearchFileScope filescope_search,
 			    gint results_limit, gint results_offset, 
                 GCancellable* cancel, AnjutaAsyncNotify *notify, 
                 IAnjutaSymbolManagerSearchCallback callback, 
@@ -374,7 +377,8 @@ isymbol_manager_search_system_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType
 	
 	/* create a new command */
 	search_command = symbol_db_search_command_new (dbe, CMD_SEARCH_SYSTEM, match_types, 
-				include_types, info_fields, pattern, results_limit, results_offset);
+				include_types, info_fields, pattern, filescope_search, results_limit, 
+	    		results_offset);
 
 	/* don't forget to set the session packages too */
 	symbol_db_search_command_set_session_packages (search_command, 
@@ -387,6 +391,7 @@ isymbol_manager_search_system_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType
 IAnjutaIterable* 
 isymbol_manager_search_project (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_types, 
 				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern, 
+    			IAnjutaSymbolManagerSearchFileScope filescope_search,
 				gint results_limit, gint results_offset, GError **err)
 {
 	SymbolDBPlugin *sdb_plugin;
@@ -399,7 +404,7 @@ isymbol_manager_search_project (IAnjutaSymbolManager *sm, IAnjutaSymbolType matc
 	dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_project);
 
 	iterator = do_search_prj_glb (dbe, match_types, info_fields, 
-	                      include_types, pattern, 
+	                      include_types, pattern, filescope_search,
 						  results_limit, results_offset,
 	           			  NULL);
 
@@ -409,6 +414,7 @@ isymbol_manager_search_project (IAnjutaSymbolManager *sm, IAnjutaSymbolType matc
 guint
 isymbol_manager_search_project_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_types, 
 				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern, 
+    			IAnjutaSymbolManagerSearchFileScope filescope_search,
 				gint results_limit, gint results_offset, 
                 GCancellable* cancel, AnjutaAsyncNotify *notify, 
                 IAnjutaSymbolManagerSearchCallback callback, 
@@ -432,7 +438,8 @@ isymbol_manager_search_project_async (IAnjutaSymbolManager *sm, IAnjutaSymbolTyp
 	
 	/* create a new command */
 	search_command = symbol_db_search_command_new (dbe, CMD_SEARCH_PROJECT, match_types, 
-				include_types, info_fields, pattern, results_limit, results_offset);
+				include_types, info_fields, pattern, filescope_search, results_limit, 
+	    		results_offset);
 
 	/* don't forget to set the session packages to NULL */
 	symbol_db_search_command_set_session_packages (search_command, NULL);	
@@ -483,7 +490,7 @@ isymbol_manager_search_file (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_t
 
 guint
 isymbol_manager_search_file_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_types, 
-				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern, 
+				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern,     			
 			 	const GFile *file, gint results_limit, gint results_offset, 
                 GCancellable* cancel, AnjutaAsyncNotify *notify, 
                 IAnjutaSymbolManagerSearchCallback callback, 
@@ -508,7 +515,9 @@ isymbol_manager_search_file_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType m
 	
 	/* create a new command */
 	search_command = symbol_db_search_command_new (dbe, CMD_SEARCH_FILE, match_types, 
-				include_types, info_fields, pattern, results_limit, results_offset);
+				include_types, info_fields, pattern, IANJUTA_SYMBOL_MANAGER_SEARCH_FS_IGNORE, 
+	    		results_limit, 
+	    		results_offset);
 
 	/* don't forget to set the file too */
 	symbol_db_search_command_set_file (search_command, file);	
diff --git a/plugins/symbol-db/symbol-db-iface.h b/plugins/symbol-db/symbol-db-iface.h
index 4366894..f6811c4 100644
--- a/plugins/symbol-db/symbol-db-iface.h
+++ b/plugins/symbol-db/symbol-db-iface.h
@@ -40,7 +40,7 @@ isymbol_manager_search_file (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_t
 
 guint
 isymbol_manager_search_file_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_types, 
-				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern, 
+				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern,     			
 			 	const GFile *file, gint results_limit, gint results_offset, 
                 GCancellable* cancel, AnjutaAsyncNotify *notify, 
                 IAnjutaSymbolManagerSearchCallback callback, 
@@ -49,11 +49,13 @@ isymbol_manager_search_file_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType m
 IAnjutaIterable* 
 isymbol_manager_search_project (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_types, 
 				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern, 
-				gint results_limit, gint results_offset, GError **err);
+				IAnjutaSymbolManagerSearchFileScope filescope_search,
+    			gint results_limit, gint results_offset, GError **err);
 
 guint
 isymbol_manager_search_project_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_types, 
 				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern, 
+    			IAnjutaSymbolManagerSearchFileScope filescope_search,
 				gint results_limit, gint results_offset, 
                 GCancellable* cancel, AnjutaAsyncNotify *notify, 
                 IAnjutaSymbolManagerSearchCallback callback, 
@@ -62,11 +64,13 @@ isymbol_manager_search_project_async (IAnjutaSymbolManager *sm, IAnjutaSymbolTyp
 IAnjutaIterable* 
 isymbol_manager_search_system (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_types, 
 				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern, 
+    			IAnjutaSymbolManagerSearchFileScope filescope_search,
 			    gint results_limit, gint results_offset, GError **err);
 
 guint
 isymbol_manager_search_system_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_types, 
 				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern, 
+    			IAnjutaSymbolManagerSearchFileScope filescope_search,
 			    gint results_limit, gint results_offset, 
                 GCancellable* cancel, AnjutaAsyncNotify *notify, 
                 IAnjutaSymbolManagerSearchCallback callback, 
diff --git a/plugins/symbol-db/symbol-db-search-command.c b/plugins/symbol-db/symbol-db-search-command.c
index cf43758..102e860 100644
--- a/plugins/symbol-db/symbol-db-search-command.c
+++ b/plugins/symbol-db/symbol-db-search-command.c
@@ -36,6 +36,7 @@ struct _SymbolDBSearchCommandPriv {
 	gboolean include_types;
 	IAnjutaSymbolField info_fields;
 	const gchar *pattern;
+	IAnjutaSymbolManagerSearchFileScope filescope_search;
 	gint results_limit;
 	gint results_offset;
 	
@@ -113,7 +114,7 @@ do_search_prj_glb (SymbolDBSearchCommand *sdbsc)
 					priv->pattern,
 					priv->match_types,
 					priv->include_types,
-					SYMSEARCH_FILESCOPE_PUBLIC,
+					priv->filescope_search,
 					priv->session_packages,
 					priv->results_limit,
 					priv->results_offset,
@@ -176,6 +177,7 @@ SymbolDBSearchCommand*
 symbol_db_search_command_new (SymbolDBEngine *dbe, CmdSearchType cmd_search_type, 
                               IAnjutaSymbolType match_types, gboolean include_types,  
                               IAnjutaSymbolField info_fields, const gchar *pattern, 
+    						  IAnjutaSymbolManagerSearchFileScope filescope_search,
                               gint results_limit, gint results_offset)
 {
 	SymbolDBSearchCommand *sdb_search_cmd;
@@ -191,6 +193,7 @@ symbol_db_search_command_new (SymbolDBEngine *dbe, CmdSearchType cmd_search_type
 	priv->include_types = include_types;
 	priv->info_fields = info_fields;
 	priv->pattern = pattern;
+	priv->filescope_search = filescope_search;
 	priv->results_limit = results_limit;
 	priv->results_offset = results_offset;	
 	priv->dbe = dbe;
diff --git a/plugins/symbol-db/symbol-db-search-command.h b/plugins/symbol-db/symbol-db-search-command.h
index 125e162..522af8c 100644
--- a/plugins/symbol-db/symbol-db-search-command.h
+++ b/plugins/symbol-db/symbol-db-search-command.h
@@ -65,6 +65,7 @@ SymbolDBSearchCommand*
 symbol_db_search_command_new (SymbolDBEngine *dbe, CmdSearchType cmd_search_type, 
                               IAnjutaSymbolType match_types, gboolean include_types,  
                               IAnjutaSymbolField info_fields, const gchar *pattern, 
+    						  IAnjutaSymbolManagerSearchFileScope filescope_search,
 			 				  gint results_limit, gint results_offset);
 
 /** set a gfile in case of a CMD_SEARCH_FILE command */



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