<commit_before>/* Rapicorn
 * Copyright (C) 2005 <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * A copy of the GNU Lesser General Public License should ship along
 * with this library; if not, see http://www.gnu.org/copyleft/.
 */
#ifndef __RAPICORN_UTILITIES_HH__
#define __RAPICORN_UTILITIES_HH__

#include <rapicorn-core.hh>
#include <typeinfo>

#if !defined __RAPICORN_HH__ && !defined RAPICORN_INTERNALS
#error Only <rapicorn.hh> can be included directly.
#endif

/* --- internally used macros --- */
#ifdef RAPICORN_INTERNALS
/* internal i18n */
#define _(str)  rapicorn_gettext (str)
#define N_(str) (str)
/* convenience macros */
#define MakeProperty                    RAPICORN_MakeProperty
#define MakeNamedCommand                RAPICORN_MakeNamedCommand
#define MakeSimpleCommand               RAPICORN_MakeSimpleCommand
#endif // RAPICORN_INTERNALS

namespace Rapicorn {
class RapicornTester;	// allow Rapicorn test implementations

/* --- i18n macros --- */
void          rapicorn_init             (int        *argcp,
                                         char     ***argvp,
                                         const char *app_name);
void          rapicorn_thread_enter     ();
bool          rapicorn_thread_try_enter ();
bool          rapicorn_thread_entered   ();
void          rapicorn_thread_leave     ();
const char*   rapicorn_gettext          (const char *text);

/* --- standard utlities --- */
//template<typename T> inline const T& min   (const T &a, const T &b) { return ::std::min<T> (a, b); }
//template<typename T> inline const T& max   (const T &a, const T &b) { return ::std::min<T> (a, b); }
using ::std::min;
using ::std::max;
inline double min     (double a, int64  b) { return min<double> (a, b); }
inline double min     (int64  a, double b) { return min<double> (a, b); }
inline double max     (double a, int64  b) { return max<double> (a, b); }
inline double max     (int64  a, double b) { return max<double> (a, b); }

/* --- exceptions --- */
struct Exception : std::exception {
public:
  // BROKEN(g++-3.3,g++-3.4): Exception  (const char *reason_format, ...) RAPICORN_PRINTF (2, 3);
  explicit            Exception  (const String &s1, const String &s2 = String(), const String &s3 = String(), const String &s4 = String(),
                                  const String &s5 = String(), const String &s6 = String(), const String &s7 = String(), const String &s8 = String());
  void                set        (const String &s);
  virtual const char* what       () const throw() { return reason ? reason : "out of memory"; }
  /*Copy*/            Exception  (const Exception &e);
  /*Des*/             ~Exception () throw();
private:
  Exception&          operator=  (const Exception&);
  char *reason;
};<commit_msg>UI: added class prototypes to utilities.hh, needed by ROPE glue<commit_after>/* Rapicorn
 * Copyright (C) 2005 <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * A copy of the GNU Lesser General Public License should ship along
 * with this library; if not, see http://www.gnu.org/copyleft/.
 */
#ifndef __RAPICORN_UTILITIES_HH__
#define __RAPICORN_UTILITIES_HH__

#include <rapicorn-core.hh>
#include <typeinfo>

#if !defined __RAPICORN_HH__ && !defined RAPICORN_INTERNALS
#error Only <rapicorn.hh> can be included directly.
#endif

/* --- internally used macros --- */
#ifdef RAPICORN_INTERNALS
/* internal i18n */
#define _(str)  rapicorn_gettext (str)
#define N_(str) (str)
/* convenience macros */
#define MakeProperty                    RAPICORN_MakeProperty
#define MakeNamedCommand                RAPICORN_MakeNamedCommand
#define MakeSimpleCommand               RAPICORN_MakeSimpleCommand
#endif // RAPICORN_INTERNALS

namespace Rapicorn {
class RapicornTester;	// allow Rapicorn test implementations

/* --- i18n macros --- */
void          rapicorn_init             (int        *argcp,
                                         char     ***argvp,
                                         const char *app_name);
void          rapicorn_thread_enter     ();
bool          rapicorn_thread_try_enter ();
bool          rapicorn_thread_entered   ();
void          rapicorn_thread_leave     ();
const char*   rapicorn_gettext          (const char *text);

/* --- standard utlities --- */
//template<typename T> inline const T& min   (const T &a, const T &b) { return ::std::min<T> (a, b); }
//template<typename T> inline const T& max   (const T &a, const T &b) { return ::std::min<T> (a, b); }
using ::std::min;
using ::std::max;
inline double min     (double a, int64  b) { return min<double> (a, b); }
inline double min     (int64  a, double b) { return min<double> (a, b); }
inline double max     (double a, int64  b) { return max<double> (a, b); }
inline double max     (int64  a, double b) { return max<double> (a, b); }

/* --- Rope Protocoll structures --- */
class ProtoRecord;
class ProtoSequence;
class ProtoArg;
class ProtoMessage;

/* --- exceptions --- */
struct Exception : std::exception {
public:
  // BROKEN(g++-3.3,g++-3.4): Exception  (const char *reason_format, ...) RAPICORN_PRINTF (2, 3);
  explicit            Exception  (const String &s1, const String &s2 = String(), const String &s3 = String(), const String &s4 = String(),
                                  const String &s5 = String(), const String &s6 = String(), const String &s7 = String(), const String &s8 = String());
  void                set        (const String &s);
  virtual const char* what       () const throw() { return reason ? reason : "out of memory"; }
  /*Copy*/            Exception  (const Exception &e);
  /*Des*/             ~Exception () throw();
private:
  Exception&          operator=  (const Exception&);
  char *reason;
};
{'fraction_non_alphanumeric': 0.11548280522600991, 'fraction_numerical': 0.00961105271061721, 'mean_word_length': 2.685666851134477, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6225198', 'n_tokens_mistral': 2008, 'n_tokens_neox': 1911, 'n_words': 714}