Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Visualizations.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Debug_Visualizations_h_
5#define _Stroika_Foundation_Debug_Visualizations_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
10
11/**
12 * \file
13 *
14 * \note - This Header file must be included in at least one module your application links with to force/pull in the visualization code
15 * into the debugger.
16 *
17 * The purpose of the module is to provide single function entrypoints callable by the Microsoft debugger (visual studio and visual studio code on windows)
18 * to evaluate / example objects (see .natvis file).
19 *
20 * A mechanism akin to this might be used going forward for gdb/lldb?
21 *
22 * \TODO: Consider promoting some of this to top-level - or much SHORTER - namespace, so easier to use
23 * from debugger --LGP 2024-12-02
24 *
25 */
26
28
29 namespace Private_ {
30 extern bool gMagicSoIncluded;
31
32#if qStroika_Foundation_Debug_AssertionsChecked
33 /**
34 * Magic to force the linker to include the visualizations obj file in executables.
35 */
36 const inline bool gMag2 = gMagicSoIncluded;
37#endif
38 }
39
40 /**
41 * ONLY for use in .navtis.
42 * BEWARE - keep this representation in sync with the code in StringRepHelperAllFitInSize_::Rep
43 *
44 * Also note - this doesn't work for ALL reps - just a few of the more common ones. But only for debugger visualization shortcut, so sb mostly harmless.
45 * --LGP 2023-12-05
46 */
47 template <typename REP_CHAR>
48 struct StringRep {
49 virtual ~StringRep () = default;
50 span<const REP_CHAR> fData;
51 };
52
53 /**
54 */
55 void ForceInclude ();
56
57 /**
58 * \brief tons of overloads declared inside CPP file. This is not meant to be called directly by any C++ code, but
59 * only to be called from the debugger, which can see those defitions (either via direct invocation or
60 * through the .natvis mechanism).
61 *
62 * \note - if calls to this function in the debugger don't work, try calling
63 * Visualizations::ForceInclude() - from the application main - to force its related code to get linked in.
64 *
65 * As a temporary hack (looking to do better) - you can call --LGP 2024-10-20
66 * Stroika::Foundation::Debug::Visualizations::ToStdString(v)
67 * on many Stroika types (like VariantValue) to view them in most debuggers
68 *
69 * NOTE - this sometimes doesn't work with ASAN, so you may need to disable ASAN to use this.
70 */
71 u8string ToStdString (const u8string& a);
72 // ... etc - many more overloads - see CPP file
73
74}
75#endif /*_Stroika_Foundation_Debug_Visualizations_h_*/
u8string ToStdString(const u8string &a)
tons of overloads declared inside CPP file. This is not meant to be called directly by any C++ code,...