"Fossies" - the Fresh Open Source Software Archive

Member "regexxer-0.10/src/translation.h" (6 Oct 2011, 2547 Bytes) of package /linux/privat/old/regexxer-0.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "translation.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (c) 2002-2007  Daniel Elstner  <daniel.kitta@gmail.com>
    3  *
    4  * This file is part of regexxer.
    5  *
    6  * regexxer is free software; you can redistribute it and/or modify
    7  * it under the terms of the GNU General Public License as published by
    8  * the Free Software Foundation; either version 2 of the License, or
    9  * (at your option) any later version.
   10  *
   11  * regexxer is distributed in the hope that it will be useful,
   12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14  * GNU General Public License for more details.
   15  *
   16  * You should have received a copy of the GNU General Public License
   17  * along with regexxer; if not, write to the Free Software Foundation,
   18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   19  */
   20 
   21 #ifndef REGEXXER_TRANSLATION_H_INCLUDED
   22 #define REGEXXER_TRANSLATION_H_INCLUDED
   23 
   24 #include <glib/gmacros.h>
   25 #include <glibmm/ustring.h>
   26 
   27 #ifndef gettext_noop
   28 # define gettext_noop(s) (s)
   29 #endif
   30 
   31 #define _(s) ::Util::translate(s)
   32 #define N_(s) gettext_noop(s)
   33 
   34 namespace Util
   35 {
   36 
   37 void initialize_gettext(const char* domain, const char* localedir);
   38 const char* translate(const char* msgid) G_GNUC_FORMAT(1);
   39 
   40 Glib::ustring compose_argv(const char* format, int argc, const Glib::ustring *const * argv);
   41 
   42 /*
   43  * The compose functions substitute placeholders in a format string with
   44  * the referenced arguments.  The template string should be in qt-format,
   45  * that is "%1", "%2", ..., "%9" are used as placeholders and "%%" denotes
   46  * a literal "%".  Substitutions may be reordered.
   47  *
   48  * Note that the format argument is of type const char* because the format
   49  * should generally not be computed.  It should be either a literal string
   50  * or the result of a call to Util::translate().
   51  */
   52 inline
   53 Glib::ustring compose(const char* format, const Glib::ustring& s1)
   54 {
   55   const Glib::ustring *const argv[] = { &s1 };
   56   return compose_argv(format, G_N_ELEMENTS(argv), argv);
   57 }
   58 
   59 inline
   60 Glib::ustring compose(const char* format, const Glib::ustring& s1, const Glib::ustring& s2)
   61 {
   62   const Glib::ustring *const argv[] = { &s1, &s2 };
   63   return compose_argv(format, G_N_ELEMENTS(argv), argv);
   64 }
   65 
   66 inline
   67 Glib::ustring compose(const char* format, const Glib::ustring& s1, const Glib::ustring& s2,
   68                                           const Glib::ustring& s3)
   69 {
   70   const Glib::ustring *const argv[] = { &s1, &s2, &s3 };
   71   return compose_argv(format, G_N_ELEMENTS(argv), argv);
   72 }
   73 
   74 } // namespace Util
   75 
   76 #endif /* REGEXXER_TRANSLATION_H_INCLUDED */