Files
ardour/libs/glibmm2/glib/src/optionentry.ccg
Paul Davis 449aab3c46 rollback to 3428, before the mysterious removal of libs/* at 3431/3432
git-svn-id: svn://localhost/ardour2/branches/3.0@3435 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-06-02 21:41:35 +00:00

80 lines
2.2 KiB
C++

// -*- c++ -*-
/* $Id: optionentry.ccg,v 1.8 2006/03/08 12:23:03 murrayc Exp $ */
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/utility.h>
#include <glib/goption.h>
#include <glib/gmem.h>
namespace Glib
{
OptionEntry::OptionEntry()
{
gobject_ = g_new0(GOptionEntry, 1);
}
OptionEntry::~OptionEntry()
{
g_free(const_cast<char*>(gobject_->long_name));
g_free(const_cast<char*>(gobject_->description));
g_free(const_cast<char*>(gobject_->arg_description));
g_free(gobject_);
}
OptionEntry::OptionEntry(const OptionEntry& src)
{
gobject_ = g_new0(GOptionEntry, 1);
operator=(src);
}
OptionEntry& OptionEntry::operator=(const OptionEntry& src)
{
if(this != &src)
{
if(gobject_->long_name)
g_free(const_cast<char*>(gobject_->long_name));
gobject_->long_name = g_strdup(src.gobject_->long_name);
gobject_->short_name = src.gobject_->short_name; //It's just one char.
gobject_->flags = src.gobject_->flags;
gobject_->arg = src.gobject_->arg;
gobject_->arg_data = src.gobject_->arg_data; //Shared, because it's not owned by any instance of this class anyway.
if(gobject_->description)
g_free(const_cast<char*>(gobject_->description));
gobject_->description = g_strdup(src.gobject_->description);
if(gobject_->arg_description)
g_free(const_cast<char*>(gobject_->arg_description));
gobject_->arg_description = g_strdup(src.gobject_->arg_description);
}
return *this;
}
} // namespace Glib