grim/guifications3
Clone
Summary
Browse
Changes
Graph
moved guifications-gtk to cmake
cmake
2010-12-13, Gary Kramlich
36e02fafe588
moved guifications-gtk to cmake
/*
* Guifications - The end-all, be-all notification framework
* Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include
<gflib/gf_hash.h>
/******************************************************************************
* GfHash API
*****************************************************************************/
GType
gf_hash_get_type
(
void
)
{
static
GType
type
=
0
;
if
(
type
==
0
)
{
static
const
GTypeInfo
info
=
{
sizeof
(
GfHashClass
),
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
sizeof
(
GfHash
),
0
,
NULL
,
};
type
=
g_type_register_static
(
GF_TYPE_OBJECT
,
"GfHash"
,
&
info
,
G_TYPE_FLAG_ABSTRACT
);
}
return
type
;
}
/**
* gf_hash_init;
* @hash : The #GfHash instance.
*
* Initializes @hash.
*/
void
gf_hash_init
(
GfHash
*
hash
)
{
GfHashClass
*
klass
;
g_return_if_fail
(
GF_IS_HASH
(
hash
));
klass
=
GF_HASH_GET_CLASS
(
hash
);
g_return_if_fail
(
GF_IS_HASH_CLASS
(
klass
));
if
(
klass
->
init
)
klass
->
init
(
hash
);
}
/**
* gf_hash_reset:
* @hash : The #GfHash instance.
*
* Resets @hash.
*/
void
gf_hash_reset
(
GfHash
*
hash
)
{
GfHashClass
*
klass
;
g_return_if_fail
(
GF_IS_HASH
(
hash
));
klass
=
GF_HASH_GET_CLASS
(
hash
);
g_return_if_fail
(
GF_IS_HASH_CLASS
(
klass
));
if
(
klass
->
reset
)
klass
->
reset
(
hash
);
}
/**
* gf_hash_uninit:
* @hash : The #GfHash instance.
*
* Uninitializes @hash.
*/
void
gf_hash_uninit
(
GfHash
*
hash
)
{
GfHashClass
*
klass
;
g_return_if_fail
(
GF_IS_HASH
(
hash
));
klass
=
GF_HASH_GET_CLASS
(
hash
);
g_return_if_fail
(
GF_IS_HASH_CLASS
(
klass
));
if
(
klass
->
uninit
)
klass
->
uninit
(
hash
);
}
/**
* gf_hash_append:
* @hash : The #GfHash instance.
* @data : The data to append.
* @data_sz : The size of @data.
*
* Appends @data to @hash.
*/
void
gf_hash_append
(
GfHash
*
hash
,
const
guint8
*
data
,
gsize
data_sz
)
{
GfHashClass
*
klass
;
g_return_if_fail
(
GF_IS_HASH
(
hash
));
klass
=
GF_HASH_GET_CLASS
(
hash
);
g_return_if_fail
(
GF_IS_HASH_CLASS
(
klass
));
if
(
klass
->
append
)
klass
->
append
(
hash
,
data
,
data_sz
);
}
/**
* gf_hash_digest:
* @hash : The #GfHash instance.
* @in_sz : The size of @digest.
* @digest : The output buffer.
* @out_sz : The size written to @digest.
*
* Digests @hash.
*
* Return Value: TRUE on success.
*/
gboolean
gf_hash_digest
(
GfHash
*
hash
,
gsize
in_sz
,
guint8
*
digest
,
gsize
*
out_sz
)
{
GfHashClass
*
klass
;
g_return_val_if_fail
(
GF_IS_HASH
(
hash
),
FALSE
);
g_return_val_if_fail
(
digest
,
FALSE
);
klass
=
GF_HASH_GET_CLASS
(
hash
);
g_return_val_if_fail
(
GF_IS_HASH_CLASS
(
klass
),
FALSE
);
if
(
klass
->
digest
)
return
klass
->
digest
(
hash
,
in_sz
,
digest
,
out_sz
);
return
FALSE
;
}