mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
move KVP junk out of generic engine utilities
-- needed to make portions of engine more generic for use by other apps. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8417 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
15b50f49d4
commit
7b50af16ff
55
src/engine/kvp-util.h
Normal file
55
src/engine/kvp-util.h
Normal file
@ -0,0 +1,55 @@
|
||||
/********************************************************************\
|
||||
* kvp-util.h -- misc KVP utilities *
|
||||
* Copyright (C) 2003 Linas Vepstas <linas@linas.org> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
/** @file kvp-util.h @brief GnuCash KVP utility functions */
|
||||
|
||||
#ifndef GNC_ENGINE_UTIL_H
|
||||
#define GNC_ENGINE_UTIL_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/***********************************************************************\
|
||||
|
||||
g_hash_table_key_value_pairs(hash): Returns a GSList* of all the
|
||||
keys and values in a given hash table. Data elements of lists are
|
||||
actual hash elements, so be careful, and deallocation of the
|
||||
GHashTableKVPairs in the result list are the caller's
|
||||
responsibility. A typical sequence might look like this:
|
||||
|
||||
GSList *kvps = g_hash_table_key_value_pairs(hash);
|
||||
... use kvps->data->key and kvps->data->val, etc. here ...
|
||||
g_slist_foreach(kvps, g_hash_table_kv_pair_free_gfunc, NULL);
|
||||
g_slist_free(kvps);
|
||||
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
gpointer key;
|
||||
gpointer value;
|
||||
} GHashTableKVPair;
|
||||
|
||||
GSList *g_hash_table_key_value_pairs(GHashTable *table);
|
||||
void g_hash_table_kv_pair_free_gfunc(gpointer data, gpointer user_data);
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user