Blame pango/src/language.ccg

Packit 78284e
/* Copyright (C) 2002 The gtkmm Development Team
Packit 78284e
 *
Packit 78284e
 * This library is free software; you can redistribute it and/or
Packit 78284e
 * modify it under the terms of the GNU Lesser General Public
Packit 78284e
 * License as published by the Free Software Foundation; either
Packit 78284e
 * version 2.1 of the License, or (at your option) any later version.
Packit 78284e
 *
Packit 78284e
 * This library is distributed in the hope that it will be useful,
Packit 78284e
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 78284e
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 78284e
 * Lesser General Public License for more details.
Packit 78284e
 *
Packit 78284e
 * You should have received a copy of the GNU Lesser General Public
Packit 78284e
 * License along with this library; if not, write to the Free
Packit 78284e
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Packit 78284e
 */
Packit 78284e
Packit 78284e
#include <pango/pango-enum-types.h>
Packit 78284e
#include <pango/pango-script.h>
Packit 78284e
Packit 78284e
namespace Pango
Packit 78284e
{
Packit 78284e
Packit 78284e
/* PangoLanguage is just another example of inconsistent coding in atk/pango/gtk:
Packit 78284e
 * on the one hand it is defined and registered as a boxed type, on the other
Packit 78284e
 * hand it is always a pointer to some statically allocated string and thus
Packit 78284e
 * neither allocated by itself, nor copied by value, nor freed. Similar dummy
Packit 78284e
 * functions as below are defined in pango/pango-util.c but they are not exported.
Packit 78284e
 * Compare with pango/pango-util.c for reference. */
Packit 78284e
 //(I wonder who wrote this - it wasn't me. murrayc)
Packit 78284e
 
Packit 78284e
inline PangoLanguage* _pango_language_new()
Packit 78284e
{
Packit 78284e
  return 0;
Packit 78284e
}
Packit 78284e
Packit 78284e
inline PangoLanguage* _pango_language_copy(const PangoLanguage* language)
Packit 78284e
{
Packit 78284e
  return const_cast<PangoLanguage*>(language);
Packit 78284e
}
Packit 78284e
Packit 78284e
inline void _pango_language_free(PangoLanguage*)
Packit 78284e
{
Packit 78284e
  return;
Packit 78284e
}
Packit 78284e
Packit 78284e
Language::Language()
Packit 78284e
:
Packit 78284e
  gobject_(0)
Packit 78284e
{}
Packit 78284e
Packit 78284e
Language::Language(const Glib::ustring& language)
Packit 78284e
:
Packit 78284e
  gobject_(pango_language_from_string(language.c_str()))
Packit 78284e
{}
Packit 78284e
Packit 78284e
Glib::ustring Language::get_string() const
Packit 78284e
{
Packit 78284e
  if (gobject_)
Packit 78284e
    return pango_language_to_string(const_cast<PangoLanguage*>(gobj()));
Packit 78284e
  else
Packit 78284e
    return Glib::ustring();
Packit 78284e
}
Packit 78284e
Packit 78284e
Glib::ArrayHandle<Script> Language::get_scripts() const
Packit 78284e
{
Packit 78284e
  int num_scripts = 0;
Packit 78284e
  const PangoScript* carray = pango_language_get_scripts(const_cast<PangoLanguage*>(gobj()), &num_scripts);
Packit 78284e
  return Glib::ArrayHandle<Script>((const Script*)carray, num_scripts, Glib::OWNERSHIP_NONE);
Packit 78284e
}
Packit 78284e
Packit 78284e
Packit 78284e
} /* namespace Pango */