2008-06-02 17:41:35 -04:00
|
|
|
// Generated by gtkmmproc -- DO NOT MODIFY!
|
|
|
|
|
|
|
|
|
|
|
|
#include <glibmm/optionentry.h>
|
|
|
|
#include <glibmm/private/optionentry_p.h>
|
|
|
|
|
|
|
|
// -*- 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
|
2009-07-02 12:00:45 -04:00
|
|
|
* modify it under the terms of the GNU Library General Public
|
2008-06-02 17:41:35 -04:00
|
|
|
* License as published by the Free Software Foundation; either
|
2009-07-02 12:00:45 -04:00
|
|
|
* version 2 of the License, or (at your option) any later version.
|
2008-06-02 17:41:35 -04:00
|
|
|
*
|
|
|
|
* 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
|
2009-07-02 12:00:45 -04:00
|
|
|
* Library General Public License for more details.
|
2008-06-02 17:41:35 -04:00
|
|
|
*
|
2009-07-02 12:00:45 -04:00
|
|
|
* You should have received a copy of the GNU Library General Public
|
2008-06-02 17:41:35 -04:00
|
|
|
* 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>
|
2009-07-02 09:12:38 -04:00
|
|
|
#include <glib.h>
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2009-07-02 09:12:38 -04:00
|
|
|
void OptionEntry::set_long_name(const Glib::ustring& value)
|
|
|
|
{
|
|
|
|
if(gobject_->long_name)
|
|
|
|
{
|
|
|
|
g_free((gchar*)(gobject_->long_name));
|
|
|
|
gobject_->long_name = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Note that we do not use NULL for an empty string,
|
|
|
|
//because G_OPTION_REMAINING is actually a "", so it actually has a distinct meaning:
|
|
|
|
//TODO: Wrap G_OPTION_REMAINING in C++ somehow, maybe as an explicit set_long_name(void) or set_is_remaining()? murrayc.
|
|
|
|
gobj()->long_name = (value).c_str() ? g_strdup((value).c_str()) : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OptionEntry::set_description(const Glib::ustring& value)
|
|
|
|
{
|
|
|
|
if(gobject_->description)
|
|
|
|
{
|
|
|
|
g_free((gchar*)(gobject_->description));
|
|
|
|
gobject_->description = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
gobj()->description = (value).empty() ? NULL : g_strdup((value).c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
void OptionEntry::set_arg_description(const Glib::ustring& value)
|
|
|
|
{
|
|
|
|
if(gobject_->arg_description)
|
|
|
|
{
|
|
|
|
g_free((gchar*)(gobject_->arg_description));
|
|
|
|
gobject_->arg_description = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
gobj()->arg_description = (value).empty() ? NULL : g_strdup((value).c_str());
|
|
|
|
}
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
} // namespace Glib
|
|
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
|
|
|
|
namespace Glib
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
Glib::ustring OptionEntry::get_long_name() const
|
|
|
|
{
|
|
|
|
return Glib::convert_const_gchar_ptr_to_ustring(gobj()->long_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar OptionEntry::get_short_name() const
|
|
|
|
{
|
|
|
|
return gobj()->short_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OptionEntry::set_short_name(const gchar& value)
|
|
|
|
{
|
|
|
|
gobj()->short_name = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
int OptionEntry::get_flags() const
|
|
|
|
{
|
|
|
|
return gobj()->flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OptionEntry::set_flags(const int& value)
|
|
|
|
{
|
|
|
|
gobj()->flags = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
Glib::ustring OptionEntry::get_description() const
|
|
|
|
{
|
|
|
|
return Glib::convert_const_gchar_ptr_to_ustring(gobj()->description);
|
|
|
|
}
|
|
|
|
|
|
|
|
Glib::ustring OptionEntry::get_arg_description() const
|
|
|
|
{
|
|
|
|
return Glib::convert_const_gchar_ptr_to_ustring(gobj()->arg_description);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Glib
|
|
|
|
|
|
|
|
|