Twitch SDK (Internal)
assertion.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
11 namespace ttv
12 {
13  namespace assertion
14  {
24  typedef bool (*AssertHandler)(const char* component, const char* expr, const char* file, int line);
25 
33 
34  bool AssertFailed(const char *component, const char *expr, const char *file, int line);
35  }
36 }
37 
38 #if defined(NDEBUG)
39 # define ttv_assert(component, expr) ((void)0)
40 #else
41 # define ttv_assert(component, expr) \
42  ((void)(((expr) ? 0 : (ttv::assertion::AssertFailed((component), #expr, __FILE__, __LINE__))), 0))
43 #endif
44 #if defined (assert)
45 # undef assert
46 #endif
47 #define assert(expr) ttv_assert("unknown", (expr))
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
bool AssertFailed(const char *component, const char *expr, const char *file, int line)
AssertHandler SetAssertHandler(AssertHandler assertHandler)
bool(* AssertHandler)(const char *component, const char *expr, const char *file, int line)
Definition: assertion.h:24