mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-14 18:46:34 +01:00
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
This commit is contained in:
parent
9c0d7d72d7
commit
449aab3c46
2869 changed files with 1026749 additions and 0 deletions
226
libs/glibmm2/glib/glibmm/optioncontext.cc
Normal file
226
libs/glibmm2/glib/glibmm/optioncontext.cc
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
// Generated by gtkmmproc -- DO NOT MODIFY!
|
||||
|
||||
|
||||
#include <glibmm/optioncontext.h>
|
||||
#include <glibmm/private/optioncontext_p.h>
|
||||
|
||||
// -*- c++ -*-
|
||||
/* $Id: optioncontext.ccg,v 1.4 2004/10/30 14:25:45 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 <glibmm/exceptionhandler.h>
|
||||
#include <glib/goption.h>
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
namespace Private
|
||||
{
|
||||
static const gchar* SignalProxy_translate_gtk_callback (const gchar* str, gpointer data)
|
||||
{
|
||||
Glib::ustring translated_str;
|
||||
Glib::OptionContext::SlotTranslate* the_slot =
|
||||
static_cast<Glib::OptionContext::SlotTranslate*>(data);
|
||||
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
try
|
||||
{
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
translated_str = (*the_slot)(str);
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
Glib::exception_handlers_invoke();
|
||||
}
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
return translated_str.c_str ();
|
||||
}
|
||||
|
||||
static void SignalProxy_translate_gtk_callback_destroy (gpointer data)
|
||||
{
|
||||
delete static_cast<Glib::OptionContext::SlotTranslate*>(data);
|
||||
}
|
||||
|
||||
} //namespace Private
|
||||
|
||||
OptionContext::OptionContext(const Glib::ustring& parameter_string)
|
||||
: gobject_( g_option_context_new(parameter_string.c_str()) ),
|
||||
has_ownership_(true)
|
||||
{
|
||||
}
|
||||
|
||||
OptionContext::OptionContext(GOptionContext* castitem, bool take_ownership)
|
||||
: gobject_(castitem),
|
||||
has_ownership_(take_ownership)
|
||||
{
|
||||
}
|
||||
|
||||
OptionContext::~OptionContext()
|
||||
{
|
||||
if(has_ownership_)
|
||||
g_option_context_free(gobj());
|
||||
|
||||
gobject_ = 0;
|
||||
}
|
||||
|
||||
void OptionContext::add_group(OptionGroup& group)
|
||||
{
|
||||
//Strangely, GObjectContext actually takes ownership of the GOptionGroup, deleting it later.
|
||||
g_option_context_add_group(gobj(), (group).gobj_give_ownership());
|
||||
}
|
||||
|
||||
void OptionContext::set_main_group(OptionGroup& group)
|
||||
{
|
||||
//Strangely, GObjectContext actually takes ownership of the GOptionGroup, deleting it later.
|
||||
g_option_context_set_main_group(gobj(), (group).gobj_give_ownership());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
OptionGroup OptionContext::get_main_group() const
|
||||
{
|
||||
const GOptionGroup* cobj = g_option_context_get_main_group(const_cast<GOptionContext*>( gobj()) );
|
||||
OptionGroup cppObj(const_cast<GOptionGroup*>(cobj), true); // take_copy
|
||||
return cppObj;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void OptionContext::set_translate_func (const SlotTranslate& slot)
|
||||
{
|
||||
//Create a copy of the slot. A pointer to this will be passed through the callback's data parameter.
|
||||
//It will be deleted when SignalProxy_translate_gtk_callback_destroy() is called.
|
||||
SlotTranslate* slot_copy = new SlotTranslate(slot);
|
||||
|
||||
g_option_context_set_translate_func(
|
||||
gobj(), &Private::SignalProxy_translate_gtk_callback, slot_copy,
|
||||
&Private::SignalProxy_translate_gtk_callback_destroy);
|
||||
}
|
||||
|
||||
} // namespace Glib
|
||||
|
||||
namespace
|
||||
{
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
Glib::OptionError::OptionError(Glib::OptionError::Code error_code, const Glib::ustring& error_message)
|
||||
:
|
||||
Glib::Error (G_OPTION_ERROR, error_code, error_message)
|
||||
{}
|
||||
|
||||
Glib::OptionError::OptionError(GError* gobject)
|
||||
:
|
||||
Glib::Error (gobject)
|
||||
{}
|
||||
|
||||
Glib::OptionError::Code Glib::OptionError::code() const
|
||||
{
|
||||
return static_cast<Code>(Glib::Error::code());
|
||||
}
|
||||
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
void Glib::OptionError::throw_func(GError* gobject)
|
||||
{
|
||||
throw Glib::OptionError(gobject);
|
||||
}
|
||||
#else
|
||||
//When not using exceptions, we just pass the Exception object around without throwing it:
|
||||
std::auto_ptr<Glib::Error> Glib::OptionError::throw_func(GError* gobject)
|
||||
{
|
||||
return std::auto_ptr<Glib::Error>(new Glib::OptionError(gobject));
|
||||
}
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
|
||||
void OptionContext::set_help_enabled(bool help_enabled)
|
||||
{
|
||||
g_option_context_set_help_enabled(gobj(), static_cast<int>(help_enabled));
|
||||
}
|
||||
|
||||
bool OptionContext::get_help_enabled() const
|
||||
{
|
||||
return g_option_context_get_help_enabled(const_cast<GOptionContext*>(gobj()));
|
||||
}
|
||||
|
||||
void OptionContext::set_ignore_unknown_options(bool ignore_unknown)
|
||||
{
|
||||
g_option_context_set_ignore_unknown_options(gobj(), static_cast<int>(ignore_unknown));
|
||||
}
|
||||
|
||||
bool OptionContext::get_ignore_unknown_options() const
|
||||
{
|
||||
return g_option_context_get_ignore_unknown_options(const_cast<GOptionContext*>(gobj()));
|
||||
}
|
||||
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
bool OptionContext::parse(int& argc, char**& argv)
|
||||
#else
|
||||
bool OptionContext::parse(int& argc, char**& argv, std::auto_ptr<Glib::Error>& error)
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
{
|
||||
GError* gerror = 0;
|
||||
bool retvalue = g_option_context_parse(gobj(), &argc, &(argv), &(gerror));
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
if(gerror)
|
||||
::Glib::Error::throw_exception(gerror);
|
||||
#else
|
||||
if(gerror)
|
||||
error = ::Glib::Error::throw_exception(gerror);
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
return retvalue;
|
||||
|
||||
}
|
||||
|
||||
void OptionContext::set_summary(const Glib::ustring& summary)
|
||||
{
|
||||
g_option_context_set_summary(gobj(), summary.c_str());
|
||||
}
|
||||
|
||||
Glib::ustring OptionContext::get_summary() const
|
||||
{
|
||||
return Glib::convert_const_gchar_ptr_to_ustring(g_option_context_get_summary(const_cast<GOptionContext*>(gobj())));
|
||||
}
|
||||
|
||||
void OptionContext::set_description(const Glib::ustring& description)
|
||||
{
|
||||
g_option_context_set_description(gobj(), description.c_str());
|
||||
}
|
||||
|
||||
Glib::ustring OptionContext::get_description() const
|
||||
{
|
||||
return Glib::convert_const_gchar_ptr_to_ustring(g_option_context_get_description(const_cast<GOptionContext*>(gobj())));
|
||||
}
|
||||
|
||||
void OptionContext::set_translation_domain(const Glib::ustring& domain)
|
||||
{
|
||||
g_option_context_set_translation_domain(gobj(), domain.c_str());
|
||||
}
|
||||
|
||||
|
||||
} // namespace Glib
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue