3 /* Copyright (C) 2002 The gtkmm Development Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
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 GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <glibmm/utility.h>
21 #include <glibmm/checksum.h>
26 Checksum::Checksum(ChecksumType type)
27 : gobject_(g_checksum_new((GChecksumType)type))
31 Checksum::operator bool() const
36 gssize Checksum::get_length(ChecksumType checksum_type)
38 return g_checksum_type_get_length((GChecksumType)checksum_type);
41 std::string Checksum::compute_checksum(ChecksumType type, const std::string& data)
43 return Glib::convert_return_gchar_ptr_to_ustring(g_compute_checksum_for_string(((GChecksumType)type), data.c_str(), data.size()));
46 void Checksum::update(const std::string& data)
48 g_checksum_update(gobj(), (const guchar*)data.c_str(), data.size());