• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

step/stepcore

  • sources
  • kde-4.14
  • kdeedu
  • step
  • stepcore
util.h
Go to the documentation of this file.
1 /* This file is part of StepCore library.
2  Copyright (C) 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com>
3 
4  StepCore library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  StepCore library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with StepCore; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
23 #ifndef STEPCORE_UTIL_H
24 #define STEPCORE_UTIL_H
25 
26 #include <QtGlobal>
27 
28 namespace StepCore {
29 
30 template<typename T> inline T square(T v) { return v*v; }
31 
32 /*
33 template<class _Class, class _BaseIterator>
34 class ClassFilterIterator
35 {
36 public:
37  ClassFilterIterator(const _BaseIterator& it): _it(it);
38 protected:
39  _BaseIterator _it;
40 };
41 */
42 
43 } // namespace StepCore
44 
45 #ifdef __GNUC__
46 #define STEPCORE_UNUSED __attribute__((unused))
47 #else
48 #define STEPCORE_UNUSED
49 #endif
50 
51 #define STEPCORE_STRINGIFY(x) _STEPCORE_STRINGIFY(x)
52 #define _STEPCORE_STRINGIFY(x) #x
53 
54 #ifdef NDEBUG
55 #define STEPCORE_ASSERT_NOABORT(expr)
56 #else // NDEBUG
57 
58 #define STEPCORE_ASSERT_NOABORT(expr) \
59  if( ! (expr) ) \
60  StepCore::_step_assert_noabort_helper<int> \
61  ( STEPCORE_STRINGIFY(expr), __LINE__, \
62  __FILE__, __PRETTY_FUNCTION__ )
63 
64 namespace StepCore {
65 template<typename unused>
66 void _step_assert_noabort_helper( const char *expr, int line,
67  const char *file, const char *function )
68 {
69 #ifdef STEPCORE_WITH_QT
70  qCritical("*** StepCore: failed assertion on line %d of file %s\n"
71  "*** asserted expression: %s\n"
72  "*** in function: %s\n",
73  line, file, expr, function);
74 #else
75  fprintf(stderr, "*** StepCore: failed assertion on line %d of file %s\n"
76  "*** asserted expression: %s\n"
77  "*** in function: %s\n",
78  line, file, expr, function);
79 #endif
80 }
81 } // namespace StepCore
82 
83 #endif // ! NDEBUG
84 
85 #endif
86 
StepCore::_step_assert_noabort_helper
void _step_assert_noabort_helper(const char *expr, int line, const char *file, const char *function)
Definition: util.h:66
StepCore::square
T square(T v)
Definition: util.h:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:16:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

step/stepcore

Skip menu "step/stepcore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal