assassinlike commited on
Commit
e5e8ca4
·
verified ·
1 Parent(s): 5b86a79

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-animation.h +221 -0
  2. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-autocleanups.h +37 -0
  3. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-core.h +525 -0
  4. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-enum-types.h +40 -0
  5. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-features.h +115 -0
  6. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-io.h +481 -0
  7. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-loader.h +113 -0
  8. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-macros.h +718 -0
  9. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-marshal.h +33 -0
  10. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-simple-anim.h +70 -0
  11. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-transform.h +168 -0
  12. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf.h +46 -0
  13. data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixdata.h +165 -0
  14. data/miniconda3/include/gtest/internal/custom/README.md +56 -0
  15. data/miniconda3/include/gtest/internal/custom/gtest-port.h +37 -0
  16. data/miniconda3/include/gtest/internal/custom/gtest-printers.h +42 -0
  17. data/miniconda3/include/gtest/internal/custom/gtest.h +37 -0
  18. data/miniconda3/include/gtest/internal/gtest-death-test-internal.h +304 -0
  19. data/miniconda3/include/gtest/internal/gtest-filepath.h +211 -0
  20. data/miniconda3/include/gtest/internal/gtest-internal.h +1560 -0
  21. data/miniconda3/include/gtest/internal/gtest-param-util.h +947 -0
  22. data/miniconda3/include/gtest/internal/gtest-port-arch.h +114 -0
  23. data/miniconda3/include/gtest/internal/gtest-port.h +2389 -0
  24. data/miniconda3/include/gtest/internal/gtest-string.h +175 -0
  25. data/miniconda3/include/gtest/internal/gtest-type-util.h +183 -0
  26. data/miniconda3/include/mamba/core/activation.hpp +263 -0
  27. data/miniconda3/include/mamba/core/channel_context.hpp +73 -0
  28. data/miniconda3/include/mamba/core/common_types.hpp +24 -0
  29. data/miniconda3/include/mamba/core/context.hpp +317 -0
  30. data/miniconda3/include/mamba/core/context_params.hpp +62 -0
  31. data/miniconda3/include/mamba/core/download_progress_bar.hpp +113 -0
  32. data/miniconda3/include/mamba/core/env_lockfile.hpp +124 -0
  33. data/miniconda3/include/mamba/core/environments_manager.hpp +50 -0
  34. data/miniconda3/include/mamba/core/error_handling.hpp +349 -0
  35. data/miniconda3/include/mamba/core/execution.hpp +158 -0
  36. data/miniconda3/include/mamba/core/fsutil.hpp +49 -0
  37. data/miniconda3/include/mamba/core/history.hpp +97 -0
  38. data/miniconda3/include/mamba/core/invoke.hpp +51 -0
  39. data/miniconda3/include/mamba/core/menuinst.hpp +20 -0
  40. data/miniconda3/include/mamba/core/output.hpp +208 -0
  41. data/miniconda3/include/mamba/core/package_cache.hpp +84 -0
  42. data/miniconda3/include/mamba/core/package_database_loader.hpp +39 -0
  43. data/miniconda3/include/mamba/core/package_fetcher.hpp +147 -0
  44. data/miniconda3/include/mamba/core/package_handling.hpp +88 -0
  45. data/miniconda3/include/mamba/core/package_paths.hpp +70 -0
  46. data/miniconda3/include/mamba/core/palette.hpp +80 -0
  47. data/miniconda3/include/mamba/core/pinning.hpp +29 -0
  48. data/miniconda3/include/mamba/core/prefix_data.hpp +61 -0
  49. data/miniconda3/include/mamba/core/progress_bar.hpp +100 -0
  50. data/miniconda3/include/mamba/core/query.hpp +125 -0
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-animation.h ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2
+ /* GdkPixbuf library - Animation support
3
+ *
4
+ * Copyright (C) 1999 The Free Software Foundation
5
+ *
6
+ * Authors: Mark Crichton <crichton@gimp.org>
7
+ * Miguel de Icaza <miguel@gnu.org>
8
+ * Federico Mena-Quintero <federico@gimp.org>
9
+ * Havoc Pennington <hp@redhat.com>
10
+ *
11
+ * This library is free software; you can redistribute it and/or
12
+ * modify it under the terms of the GNU Lesser General Public
13
+ * License as published by the Free Software Foundation; either
14
+ * version 2 of the License, or (at your option) any later version.
15
+ *
16
+ * This library is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ * Lesser General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU Lesser General Public
22
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+
25
+ #ifndef GDK_PIXBUF_ANIMATION_H
26
+ #define GDK_PIXBUF_ANIMATION_H
27
+
28
+ #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
29
+ #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
30
+ #endif
31
+
32
+ #include <glib-object.h>
33
+ #include <gdk-pixbuf/gdk-pixbuf-core.h>
34
+
35
+ G_BEGIN_DECLS
36
+
37
+ /* Animation support */
38
+
39
+ typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
40
+
41
+
42
+ typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter;
43
+
44
+ #define GDK_TYPE_PIXBUF_ANIMATION (gdk_pixbuf_animation_get_type ())
45
+ #define GDK_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimation))
46
+ #define GDK_IS_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANIMATION))
47
+
48
+ #define GDK_TYPE_PIXBUF_ANIMATION_ITER (gdk_pixbuf_animation_iter_get_type ())
49
+ #define GDK_PIXBUF_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIter))
50
+ #define GDK_IS_PIXBUF_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANIMATION_ITER))
51
+
52
+ GDK_PIXBUF_AVAILABLE_IN_ALL
53
+ GType gdk_pixbuf_animation_get_type (void) G_GNUC_CONST;
54
+
55
+ #ifdef G_OS_WIN32
56
+ /* API/ABI compat, see gdk-pixbuf-core.h for details */
57
+ GDK_PIXBUF_AVAILABLE_IN_ALL
58
+ GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file_utf8 (const char *filename,
59
+ GError **error);
60
+ #endif
61
+
62
+ GDK_PIXBUF_AVAILABLE_IN_ALL
63
+ GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename,
64
+ GError **error);
65
+ GDK_PIXBUF_AVAILABLE_IN_2_28
66
+ GdkPixbufAnimation *gdk_pixbuf_animation_new_from_stream (GInputStream *stream,
67
+ GCancellable *cancellable,
68
+ GError **error);
69
+ GDK_PIXBUF_AVAILABLE_IN_2_28
70
+ void gdk_pixbuf_animation_new_from_stream_async (GInputStream *stream,
71
+ GCancellable *cancellable,
72
+ GAsyncReadyCallback callback,
73
+ gpointer user_data);
74
+ GDK_PIXBUF_AVAILABLE_IN_2_28
75
+ GdkPixbufAnimation *gdk_pixbuf_animation_new_from_stream_finish (GAsyncResult*async_result,
76
+ GError **error);
77
+ GDK_PIXBUF_AVAILABLE_IN_2_28
78
+ GdkPixbufAnimation *gdk_pixbuf_animation_new_from_resource(const char *resource_path,
79
+ GError **error);
80
+
81
+ #ifndef GDK_PIXBUF_DISABLE_DEPRECATED
82
+
83
+ GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(g_object_ref)
84
+ GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
85
+ GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(g_object_unref)
86
+ void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation);
87
+ #endif
88
+
89
+ GDK_PIXBUF_AVAILABLE_IN_ALL
90
+ int gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation);
91
+ GDK_PIXBUF_AVAILABLE_IN_ALL
92
+ int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation);
93
+ GDK_PIXBUF_AVAILABLE_IN_ALL
94
+ gboolean gdk_pixbuf_animation_is_static_image (GdkPixbufAnimation *animation);
95
+ GDK_PIXBUF_AVAILABLE_IN_ALL
96
+ GdkPixbuf *gdk_pixbuf_animation_get_static_image (GdkPixbufAnimation *animation);
97
+
98
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
99
+ GDK_PIXBUF_AVAILABLE_IN_ALL
100
+ GdkPixbufAnimationIter *gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation,
101
+ const GTimeVal *start_time);
102
+ G_GNUC_END_IGNORE_DEPRECATIONS
103
+
104
+ GDK_PIXBUF_AVAILABLE_IN_ALL
105
+ GType gdk_pixbuf_animation_iter_get_type (void) G_GNUC_CONST;
106
+ GDK_PIXBUF_AVAILABLE_IN_ALL
107
+ int gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter);
108
+ GDK_PIXBUF_AVAILABLE_IN_ALL
109
+ GdkPixbuf *gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
110
+ GDK_PIXBUF_AVAILABLE_IN_ALL
111
+ gboolean gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter);
112
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
113
+ GDK_PIXBUF_AVAILABLE_IN_ALL
114
+ gboolean gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter,
115
+ const GTimeVal *current_time);
116
+ G_GNUC_END_IGNORE_DEPRECATIONS
117
+
118
+
119
+ #ifdef GDK_PIXBUF_ENABLE_BACKEND
120
+
121
+
122
+
123
+ /**
124
+ * GdkPixbufAnimationClass:
125
+ * @parent_class: the parent class
126
+ * @is_static_image: returns whether the given animation is just a static image.
127
+ * @get_static_image: returns a static image representing the given animation.
128
+ * @get_size: fills @width and @height with the frame size of the animation.
129
+ * @get_iter: returns an iterator for the given animation.
130
+ *
131
+ * Modules supporting animations must derive a type from
132
+ * #GdkPixbufAnimation, providing suitable implementations of the
133
+ * virtual functions.
134
+ */
135
+ typedef struct _GdkPixbufAnimationClass GdkPixbufAnimationClass;
136
+
137
+ #define GDK_PIXBUF_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimationClass))
138
+ #define GDK_IS_PIXBUF_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_ANIMATION))
139
+ #define GDK_PIXBUF_ANIMATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimationClass))
140
+
141
+ /* Private part of the GdkPixbufAnimation structure */
142
+ struct _GdkPixbufAnimation {
143
+ GObject parent_instance;
144
+
145
+ };
146
+
147
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
148
+ struct _GdkPixbufAnimationClass {
149
+ GObjectClass parent_class;
150
+
151
+ /*< public >*/
152
+
153
+ gboolean (*is_static_image) (GdkPixbufAnimation *animation);
154
+
155
+ GdkPixbuf* (*get_static_image) (GdkPixbufAnimation *animation);
156
+
157
+ void (*get_size) (GdkPixbufAnimation *animation,
158
+ int *width,
159
+ int *height);
160
+
161
+ GdkPixbufAnimationIter* (*get_iter) (GdkPixbufAnimation *animation,
162
+ const GTimeVal *start_time);
163
+ };
164
+ G_GNUC_END_IGNORE_DEPRECATIONS
165
+
166
+
167
+
168
+ /**
169
+ * GdkPixbufAnimationIterClass:
170
+ * @parent_class: the parent class
171
+ * @get_delay_time: returns the time in milliseconds that the current frame
172
+ * should be shown.
173
+ * @get_pixbuf: returns the current frame.
174
+ * @on_currently_loading_frame: returns whether the current frame of @iter is
175
+ * being loaded.
176
+ * @advance: advances the iterator to @current_time, possibly changing the
177
+ * current frame.
178
+ *
179
+ * Modules supporting animations must derive a type from
180
+ * #GdkPixbufAnimationIter, providing suitable implementations of the
181
+ * virtual functions.
182
+ */
183
+ typedef struct _GdkPixbufAnimationIterClass GdkPixbufAnimationIterClass;
184
+
185
+ #define GDK_PIXBUF_ANIMATION_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIterClass))
186
+ #define GDK_IS_PIXBUF_ANIMATION_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_ANIMATION_ITER))
187
+ #define GDK_PIXBUF_ANIMATION_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIterClass))
188
+
189
+ struct _GdkPixbufAnimationIter {
190
+ GObject parent_instance;
191
+
192
+ };
193
+
194
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
195
+ struct _GdkPixbufAnimationIterClass {
196
+ GObjectClass parent_class;
197
+
198
+ /*< public >*/
199
+
200
+ int (*get_delay_time) (GdkPixbufAnimationIter *iter);
201
+
202
+ GdkPixbuf* (*get_pixbuf) (GdkPixbufAnimationIter *iter);
203
+
204
+ gboolean (*on_currently_loading_frame) (GdkPixbufAnimationIter *iter);
205
+
206
+ gboolean (*advance) (GdkPixbufAnimationIter *iter,
207
+ const GTimeVal *current_time);
208
+ };
209
+ G_GNUC_END_IGNORE_DEPRECATIONS
210
+
211
+
212
+ GDK_PIXBUF_AVAILABLE_IN_ALL
213
+ GType gdk_pixbuf_non_anim_get_type (void) G_GNUC_CONST;
214
+ GDK_PIXBUF_AVAILABLE_IN_ALL
215
+ GdkPixbufAnimation* gdk_pixbuf_non_anim_new (GdkPixbuf *pixbuf);
216
+
217
+ #endif /* GDK_PIXBUF_ENABLE_BACKEND */
218
+
219
+ G_END_DECLS
220
+
221
+ #endif /* GDK_PIXBUF_ANIMATION_H */
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-autocleanups.h ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GdkPixbuf library - Autocleanup definitions
2
+ *
3
+ * Copyright (C) 2015 Kalev Lember <kalevlember@gmail.com>
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ #ifndef GDK_PIXBUF_AUTOCLEANUPS_H
20
+ #define GDK_PIXBUF_AUTOCLEANUPS_H
21
+
22
+ /* We need all the types, so don't try to include this directly */
23
+ #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
24
+ #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
25
+ #endif
26
+
27
+ #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
28
+
29
+ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPixbuf, g_object_unref)
30
+ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPixbufAnimation, g_object_unref)
31
+ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPixbufAnimationIter, g_object_unref)
32
+ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPixbufLoader, g_object_unref)
33
+ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPixbufSimpleAnim, g_object_unref)
34
+
35
+ #endif
36
+
37
+ #endif /* GDK_PIXBUF_AUTOCLEANUPS_H */
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-core.h ADDED
@@ -0,0 +1,525 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GdkPixbuf library - GdkPixbuf data structure
2
+ *
3
+ * Copyright (C) 2003 The Free Software Foundation
4
+ *
5
+ * Authors: Mark Crichton <crichton@gimp.org>
6
+ * Miguel de Icaza <miguel@gnu.org>
7
+ * Federico Mena-Quintero <federico@gimp.org>
8
+ * Havoc Pennington <hp@redhat.com>
9
+ *
10
+ * This library is free software; you can redistribute it and/or
11
+ * modify it under the terms of the GNU Lesser General Public
12
+ * License as published by the Free Software Foundation; either
13
+ * version 2 of the License, or (at your option) any later version.
14
+ *
15
+ * This library is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ * Lesser General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU Lesser General Public
21
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
22
+ */
23
+
24
+ #ifndef GDK_PIXBUF_CORE_H
25
+ #define GDK_PIXBUF_CORE_H
26
+
27
+ #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
28
+ #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
29
+ #endif
30
+
31
+ #include <glib.h>
32
+ #include <glib-object.h>
33
+ #include <gio/gio.h>
34
+
35
+ #include <gdk-pixbuf/gdk-pixbuf-macros.h>
36
+
37
+ G_BEGIN_DECLS
38
+
39
+ /**
40
+ * GdkPixbufAlphaMode:
41
+ * @GDK_PIXBUF_ALPHA_BILEVEL: A bilevel clipping mask (black and white)
42
+ * will be created and used to draw the image. Pixels below 0.5 opacity
43
+ * will be considered fully transparent, and all others will be
44
+ * considered fully opaque.
45
+ * @GDK_PIXBUF_ALPHA_FULL: For now falls back to #GDK_PIXBUF_ALPHA_BILEVEL.
46
+ * In the future it will do full alpha compositing.
47
+ *
48
+ * Control the alpha channel for drawables.
49
+ *
50
+ * These values can be passed to gdk_pixbuf_xlib_render_to_drawable_alpha()
51
+ * in gdk-pixbuf-xlib to control how the alpha channel of an image should
52
+ * be handled.
53
+ *
54
+ * This function can create a bilevel clipping mask (black and white) and use
55
+ * it while painting the image.
56
+ *
57
+ * In the future, when the X Window System gets an alpha channel extension,
58
+ * it will be possible to do full alpha compositing onto arbitrary drawables.
59
+ * For now both cases fall back to a bilevel clipping mask.
60
+ *
61
+ * Deprecated: 2.42: There is no user of GdkPixbufAlphaMode in GdkPixbuf,
62
+ * and the Xlib utility functions have been split out to their own
63
+ * library, gdk-pixbuf-xlib
64
+ */
65
+ typedef enum
66
+ {
67
+ GDK_PIXBUF_ALPHA_BILEVEL,
68
+ GDK_PIXBUF_ALPHA_FULL
69
+ } GdkPixbufAlphaMode;
70
+
71
+ /**
72
+ * GdkColorspace:
73
+ * @GDK_COLORSPACE_RGB: Indicates a red/green/blue additive color space.
74
+ *
75
+ * This enumeration defines the color spaces that are supported by
76
+ * the gdk-pixbuf library.
77
+ *
78
+ * Currently only RGB is supported.
79
+ */
80
+ /* Note that these values are encoded in inline pixbufs
81
+ * as ints, so don't reorder them
82
+ */
83
+ typedef enum {
84
+ GDK_COLORSPACE_RGB
85
+ } GdkColorspace;
86
+
87
+ /* All of these are opaque structures */
88
+
89
+ typedef struct _GdkPixbuf GdkPixbuf;
90
+
91
+ #define GDK_TYPE_PIXBUF (gdk_pixbuf_get_type ())
92
+ #define GDK_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF, GdkPixbuf))
93
+ #define GDK_IS_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF))
94
+
95
+
96
+ /**
97
+ * GdkPixbufDestroyNotify:
98
+ * @pixels: (array) (element-type guint8): The pixel array of the pixbuf
99
+ * that is being finalized.
100
+ * @data: (closure): User closure data.
101
+ *
102
+ * A function of this type is responsible for freeing the pixel array
103
+ * of a pixbuf.
104
+ *
105
+ * The gdk_pixbuf_new_from_data() function lets you pass in a pre-allocated
106
+ * pixel array so that a pixbuf can be created from it; in this case you
107
+ * will need to pass in a function of type `GdkPixbufDestroyNotify` so that
108
+ * the pixel data can be freed when the pixbuf is finalized.
109
+ */
110
+ typedef void (* GdkPixbufDestroyNotify) (guchar *pixels, gpointer data);
111
+
112
+ /**
113
+ * GDK_PIXBUF_ERROR:
114
+ *
115
+ * Error domain used for pixbuf operations.
116
+ *
117
+ * Indicates that the error code will be in the `GdkPixbufError` enumeration.
118
+ *
119
+ * See the `GError` for information on error domains and error codes.
120
+ */
121
+ #define GDK_PIXBUF_ERROR gdk_pixbuf_error_quark ()
122
+
123
+ /**
124
+ * GdkPixbufError:
125
+ * @GDK_PIXBUF_ERROR_CORRUPT_IMAGE: An image file was broken somehow.
126
+ * @GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY: Not enough memory.
127
+ * @GDK_PIXBUF_ERROR_BAD_OPTION: A bad option was passed to a pixbuf save module.
128
+ * @GDK_PIXBUF_ERROR_UNKNOWN_TYPE: Unknown image type.
129
+ * @GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION: Don't know how to perform the
130
+ * given operation on the type of image at hand.
131
+ * @GDK_PIXBUF_ERROR_FAILED: Generic failure code, something went wrong.
132
+ * @GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION: Only part of the animation was loaded.
133
+ *
134
+ * An error code in the `GDK_PIXBUF_ERROR` domain.
135
+ *
136
+ * Many gdk-pixbuf operations can cause errors in this domain, or in
137
+ * the `G_FILE_ERROR` domain.
138
+ */
139
+ typedef enum {
140
+ /* image data hosed */
141
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
142
+ /* no mem to load image */
143
+ GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
144
+ /* bad option passed to save routine */
145
+ GDK_PIXBUF_ERROR_BAD_OPTION,
146
+ /* unsupported image type (sort of an ENOSYS) */
147
+ GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
148
+ /* unsupported operation (load, save) for image type */
149
+ GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
150
+ GDK_PIXBUF_ERROR_FAILED,
151
+ GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION
152
+ } GdkPixbufError;
153
+
154
+ GDK_PIXBUF_AVAILABLE_IN_ALL
155
+ GQuark gdk_pixbuf_error_quark (void);
156
+
157
+
158
+
159
+ GDK_PIXBUF_AVAILABLE_IN_ALL
160
+ GType gdk_pixbuf_get_type (void) G_GNUC_CONST;
161
+
162
+ /* Reference counting */
163
+
164
+ #ifndef GDK_PIXBUF_DISABLE_DEPRECATED
165
+ GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(g_object_ref)
166
+ GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf);
167
+ GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(g_object_unref)
168
+ void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
169
+ #endif
170
+
171
+ /* GdkPixbuf accessors */
172
+
173
+ GDK_PIXBUF_AVAILABLE_IN_ALL
174
+ GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf);
175
+ GDK_PIXBUF_AVAILABLE_IN_ALL
176
+ int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf);
177
+ GDK_PIXBUF_AVAILABLE_IN_ALL
178
+ gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf);
179
+ GDK_PIXBUF_AVAILABLE_IN_ALL
180
+ int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf);
181
+ GDK_PIXBUF_AVAILABLE_IN_ALL
182
+ guchar *gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf);
183
+ GDK_PIXBUF_AVAILABLE_IN_ALL
184
+ int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf);
185
+ GDK_PIXBUF_AVAILABLE_IN_ALL
186
+ int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf);
187
+ GDK_PIXBUF_AVAILABLE_IN_ALL
188
+ int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf);
189
+ GDK_PIXBUF_AVAILABLE_IN_2_26
190
+ gsize gdk_pixbuf_get_byte_length (const GdkPixbuf *pixbuf);
191
+
192
+ GDK_PIXBUF_AVAILABLE_IN_2_26
193
+ guchar *gdk_pixbuf_get_pixels_with_length (const GdkPixbuf *pixbuf,
194
+ guint *length);
195
+
196
+ GDK_PIXBUF_AVAILABLE_IN_2_32
197
+ const guint8* gdk_pixbuf_read_pixels (const GdkPixbuf *pixbuf);
198
+ GDK_PIXBUF_AVAILABLE_IN_2_32
199
+ GBytes * gdk_pixbuf_read_pixel_bytes (const GdkPixbuf *pixbuf);
200
+
201
+
202
+
203
+ /* Create a blank pixbuf with an optimal rowstride and a new buffer */
204
+
205
+ GDK_PIXBUF_AVAILABLE_IN_ALL
206
+ GdkPixbuf *gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,
207
+ int width, int height);
208
+
209
+ GDK_PIXBUF_AVAILABLE_IN_2_36
210
+ gint gdk_pixbuf_calculate_rowstride (GdkColorspace colorspace,
211
+ gboolean has_alpha,
212
+ int bits_per_sample,
213
+ int width,
214
+ int height);
215
+
216
+ /* Copy a pixbuf */
217
+ GDK_PIXBUF_AVAILABLE_IN_ALL
218
+ GdkPixbuf *gdk_pixbuf_copy (const GdkPixbuf *pixbuf);
219
+
220
+ /* Create a pixbuf which points to the pixels of another pixbuf */
221
+ GDK_PIXBUF_AVAILABLE_IN_ALL
222
+ GdkPixbuf *gdk_pixbuf_new_subpixbuf (GdkPixbuf *src_pixbuf,
223
+ int src_x,
224
+ int src_y,
225
+ int width,
226
+ int height);
227
+
228
+ /* Simple loading */
229
+
230
+ #ifdef G_OS_WIN32
231
+ /* In previous versions these _utf8 variants where exported and linked to
232
+ * by default. Export them here for ABI (and gi API) compat.
233
+ */
234
+
235
+ GDK_PIXBUF_AVAILABLE_IN_ALL
236
+ GdkPixbuf *gdk_pixbuf_new_from_file_utf8 (const char *filename,
237
+ GError **error);
238
+ GDK_PIXBUF_AVAILABLE_IN_2_4
239
+ GdkPixbuf *gdk_pixbuf_new_from_file_at_size_utf8 (const char *filename,
240
+ int width,
241
+ int height,
242
+ GError **error);
243
+ GDK_PIXBUF_AVAILABLE_IN_2_6
244
+ GdkPixbuf *gdk_pixbuf_new_from_file_at_scale_utf8 (const char *filename,
245
+ int width,
246
+ int height,
247
+ gboolean preserve_aspect_ratio,
248
+ GError **error);
249
+ #endif
250
+
251
+ GDK_PIXBUF_AVAILABLE_IN_ALL
252
+ GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename,
253
+ GError **error);
254
+ GDK_PIXBUF_AVAILABLE_IN_2_4
255
+ GdkPixbuf *gdk_pixbuf_new_from_file_at_size (const char *filename,
256
+ int width,
257
+ int height,
258
+ GError **error);
259
+ GDK_PIXBUF_AVAILABLE_IN_2_6
260
+ GdkPixbuf *gdk_pixbuf_new_from_file_at_scale (const char *filename,
261
+ int width,
262
+ int height,
263
+ gboolean preserve_aspect_ratio,
264
+ GError **error);
265
+ GDK_PIXBUF_AVAILABLE_IN_2_26
266
+ GdkPixbuf *gdk_pixbuf_new_from_resource (const char *resource_path,
267
+ GError **error);
268
+ GDK_PIXBUF_AVAILABLE_IN_2_26
269
+ GdkPixbuf *gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
270
+ int width,
271
+ int height,
272
+ gboolean preserve_aspect_ratio,
273
+ GError **error);
274
+
275
+ GDK_PIXBUF_AVAILABLE_IN_ALL
276
+ GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data,
277
+ GdkColorspace colorspace,
278
+ gboolean has_alpha,
279
+ int bits_per_sample,
280
+ int width, int height,
281
+ int rowstride,
282
+ GdkPixbufDestroyNotify destroy_fn,
283
+ gpointer destroy_fn_data);
284
+
285
+ GDK_PIXBUF_AVAILABLE_IN_2_32
286
+ GdkPixbuf *gdk_pixbuf_new_from_bytes (GBytes *data,
287
+ GdkColorspace colorspace,
288
+ gboolean has_alpha,
289
+ int bits_per_sample,
290
+ int width, int height,
291
+ int rowstride);
292
+
293
+ GDK_PIXBUF_AVAILABLE_IN_ALL
294
+ GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data);
295
+
296
+ #ifndef GDK_PIXBUF_DISABLE_DEPRECATED
297
+ GDK_PIXBUF_DEPRECATED_IN_2_32
298
+ GdkPixbuf* gdk_pixbuf_new_from_inline (gint data_length,
299
+ const guint8 *data,
300
+ gboolean copy_pixels,
301
+ GError **error);
302
+ #endif
303
+
304
+ /* Mutations */
305
+ GDK_PIXBUF_AVAILABLE_IN_ALL
306
+ void gdk_pixbuf_fill (GdkPixbuf *pixbuf,
307
+ guint32 pixel);
308
+
309
+ /* Saving */
310
+
311
+ #ifndef __GTK_DOC_IGNORE__
312
+ #ifdef G_OS_WIN32
313
+ /* DLL ABI stability hack. */
314
+ #define gdk_pixbuf_save gdk_pixbuf_save_utf8
315
+ #endif
316
+ #endif
317
+
318
+ GDK_PIXBUF_AVAILABLE_IN_ALL
319
+ gboolean gdk_pixbuf_save (GdkPixbuf *pixbuf,
320
+ const char *filename,
321
+ const char *type,
322
+ GError **error,
323
+ ...) G_GNUC_NULL_TERMINATED;
324
+
325
+ GDK_PIXBUF_AVAILABLE_IN_ALL
326
+ gboolean gdk_pixbuf_savev (GdkPixbuf *pixbuf,
327
+ const char *filename,
328
+ const char *type,
329
+ char **option_keys,
330
+ char **option_values,
331
+ GError **error);
332
+
333
+ #ifdef G_OS_WIN32
334
+ GDK_PIXBUF_AVAILABLE_IN_ALL
335
+ gboolean gdk_pixbuf_savev_utf8 (GdkPixbuf *pixbuf,
336
+ const char *filename,
337
+ const char *type,
338
+ char **option_keys,
339
+ char **option_values,
340
+ GError **error);
341
+ #endif
342
+
343
+ /* Saving to a callback function */
344
+
345
+
346
+ /**
347
+ * GdkPixbufSaveFunc:
348
+ * @buf: (array length=count) (element-type guint8): bytes to be written.
349
+ * @count: number of bytes in @buf.
350
+ * @error: (out): A location to return an error.
351
+ * @data: (closure): user data passed to gdk_pixbuf_save_to_callback().
352
+ *
353
+ * Save functions used by [method@GdkPixbuf.Pixbuf.save_to_callback].
354
+ *
355
+ * This function is called once for each block of bytes that is "written"
356
+ * by `gdk_pixbuf_save_to_callback()`.
357
+ *
358
+ * If successful it should return `TRUE`; if an error occurs it should set
359
+ * `error` and return `FALSE`, in which case `gdk_pixbuf_save_to_callback()`
360
+ * will fail with the same error.
361
+ *
362
+ * Returns: `TRUE` if successful, `FALSE` otherwise
363
+ *
364
+ * Since: 2.4
365
+ */
366
+
367
+ typedef gboolean (*GdkPixbufSaveFunc) (const gchar *buf,
368
+ gsize count,
369
+ GError **error,
370
+ gpointer data);
371
+
372
+ GDK_PIXBUF_AVAILABLE_IN_2_4
373
+ gboolean gdk_pixbuf_save_to_callback (GdkPixbuf *pixbuf,
374
+ GdkPixbufSaveFunc save_func,
375
+ gpointer user_data,
376
+ const char *type,
377
+ GError **error,
378
+ ...) G_GNUC_NULL_TERMINATED;
379
+
380
+ GDK_PIXBUF_AVAILABLE_IN_2_4
381
+ gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf,
382
+ GdkPixbufSaveFunc save_func,
383
+ gpointer user_data,
384
+ const char *type,
385
+ char **option_keys,
386
+ char **option_values,
387
+ GError **error);
388
+
389
+ /* Saving into a newly allocated char array */
390
+
391
+ GDK_PIXBUF_AVAILABLE_IN_2_4
392
+ gboolean gdk_pixbuf_save_to_buffer (GdkPixbuf *pixbuf,
393
+ gchar **buffer,
394
+ gsize *buffer_size,
395
+ const char *type,
396
+ GError **error,
397
+ ...) G_GNUC_NULL_TERMINATED;
398
+
399
+ GDK_PIXBUF_AVAILABLE_IN_2_4
400
+ gboolean gdk_pixbuf_save_to_bufferv (GdkPixbuf *pixbuf,
401
+ gchar **buffer,
402
+ gsize *buffer_size,
403
+ const char *type,
404
+ char **option_keys,
405
+ char **option_values,
406
+ GError **error);
407
+
408
+ GDK_PIXBUF_AVAILABLE_IN_2_14
409
+ GdkPixbuf *gdk_pixbuf_new_from_stream (GInputStream *stream,
410
+ GCancellable *cancellable,
411
+ GError **error);
412
+
413
+ GDK_PIXBUF_AVAILABLE_IN_ALL
414
+ void gdk_pixbuf_new_from_stream_async (GInputStream *stream,
415
+ GCancellable *cancellable,
416
+ GAsyncReadyCallback callback,
417
+ gpointer user_data);
418
+
419
+ GDK_PIXBUF_AVAILABLE_IN_ALL
420
+ GdkPixbuf *gdk_pixbuf_new_from_stream_finish (GAsyncResult *async_result,
421
+ GError **error);
422
+
423
+ GDK_PIXBUF_AVAILABLE_IN_2_14
424
+ GdkPixbuf *gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
425
+ gint width,
426
+ gint height,
427
+ gboolean preserve_aspect_ratio,
428
+ GCancellable *cancellable,
429
+ GError **error);
430
+
431
+ GDK_PIXBUF_AVAILABLE_IN_ALL
432
+ void gdk_pixbuf_new_from_stream_at_scale_async (GInputStream *stream,
433
+ gint width,
434
+ gint height,
435
+ gboolean preserve_aspect_ratio,
436
+ GCancellable *cancellable,
437
+ GAsyncReadyCallback callback,
438
+ gpointer user_data);
439
+
440
+ GDK_PIXBUF_AVAILABLE_IN_2_14
441
+ gboolean gdk_pixbuf_save_to_stream (GdkPixbuf *pixbuf,
442
+ GOutputStream *stream,
443
+ const char *type,
444
+ GCancellable *cancellable,
445
+ GError **error,
446
+ ...);
447
+
448
+ GDK_PIXBUF_AVAILABLE_IN_ALL
449
+ void gdk_pixbuf_save_to_stream_async (GdkPixbuf *pixbuf,
450
+ GOutputStream *stream,
451
+ const gchar *type,
452
+ GCancellable *cancellable,
453
+ GAsyncReadyCallback callback,
454
+ gpointer user_data,
455
+ ...);
456
+
457
+ GDK_PIXBUF_AVAILABLE_IN_ALL
458
+ gboolean gdk_pixbuf_save_to_stream_finish (GAsyncResult *async_result,
459
+ GError **error);
460
+
461
+ GDK_PIXBUF_AVAILABLE_IN_2_36
462
+ void gdk_pixbuf_save_to_streamv_async (GdkPixbuf *pixbuf,
463
+ GOutputStream *stream,
464
+ const gchar *type,
465
+ gchar **option_keys,
466
+ gchar **option_values,
467
+ GCancellable *cancellable,
468
+ GAsyncReadyCallback callback,
469
+ gpointer user_data);
470
+
471
+ GDK_PIXBUF_AVAILABLE_IN_2_36
472
+ gboolean gdk_pixbuf_save_to_streamv (GdkPixbuf *pixbuf,
473
+ GOutputStream *stream,
474
+ const char *type,
475
+ char **option_keys,
476
+ char **option_values,
477
+ GCancellable *cancellable,
478
+ GError **error);
479
+
480
+ /* Adding an alpha channel */
481
+ GDK_PIXBUF_AVAILABLE_IN_ALL
482
+ GdkPixbuf *gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf, gboolean substitute_color,
483
+ guchar r, guchar g, guchar b);
484
+
485
+ /* Copy an area of a pixbuf onto another one */
486
+ GDK_PIXBUF_AVAILABLE_IN_ALL
487
+ void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
488
+ int src_x, int src_y,
489
+ int width, int height,
490
+ GdkPixbuf *dest_pixbuf,
491
+ int dest_x, int dest_y);
492
+
493
+ /* Brighten/darken and optionally make it pixelated-looking */
494
+ GDK_PIXBUF_AVAILABLE_IN_ALL
495
+ void gdk_pixbuf_saturate_and_pixelate (const GdkPixbuf *src,
496
+ GdkPixbuf *dest,
497
+ gfloat saturation,
498
+ gboolean pixelate);
499
+
500
+ /* Transform an image to agree with its embedded orientation option / tag */
501
+ GDK_PIXBUF_AVAILABLE_IN_2_12
502
+ GdkPixbuf *gdk_pixbuf_apply_embedded_orientation (GdkPixbuf *src);
503
+
504
+ /* key/value pairs that can be attached by the pixbuf loader */
505
+ GDK_PIXBUF_AVAILABLE_IN_ALL
506
+ gboolean gdk_pixbuf_set_option (GdkPixbuf *pixbuf,
507
+ const gchar *key,
508
+ const gchar *value);
509
+ GDK_PIXBUF_AVAILABLE_IN_ALL
510
+ const gchar * gdk_pixbuf_get_option (GdkPixbuf *pixbuf,
511
+ const gchar *key);
512
+ GDK_PIXBUF_AVAILABLE_IN_2_36
513
+ gboolean gdk_pixbuf_remove_option (GdkPixbuf *pixbuf,
514
+ const gchar *key);
515
+ GDK_PIXBUF_AVAILABLE_IN_2_32
516
+ GHashTable * gdk_pixbuf_get_options (GdkPixbuf *pixbuf);
517
+ GDK_PIXBUF_AVAILABLE_IN_2_36
518
+ gboolean gdk_pixbuf_copy_options (GdkPixbuf *src_pixbuf,
519
+ GdkPixbuf *dest_pixbuf);
520
+
521
+
522
+ G_END_DECLS
523
+
524
+
525
+ #endif /* GDK_PIXBUF_CORE_H */
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-enum-types.h ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
3
+
4
+ #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
5
+ #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
6
+ #endif
7
+
8
+ #ifndef __GDK_PIXBUF_ENUM_TYPES_H__
9
+ #define __GDK_PIXBUF_ENUM_TYPES_H__
10
+
11
+ #include <glib-object.h>
12
+
13
+ #include <gdk-pixbuf/gdk-pixbuf-macros.h>
14
+
15
+ G_BEGIN_DECLS
16
+
17
+ /* enumerations from "gdk-pixbuf-core.h" */
18
+ GDK_PIXBUF_AVAILABLE_IN_ALL
19
+ GType gdk_pixbuf_alpha_mode_get_type (void) G_GNUC_CONST;
20
+ #define GDK_TYPE_PIXBUF_ALPHA_MODE (gdk_pixbuf_alpha_mode_get_type ())
21
+ GDK_PIXBUF_AVAILABLE_IN_ALL
22
+ GType gdk_colorspace_get_type (void) G_GNUC_CONST;
23
+ #define GDK_TYPE_COLORSPACE (gdk_colorspace_get_type ())
24
+ GDK_PIXBUF_AVAILABLE_IN_ALL
25
+ GType gdk_pixbuf_error_get_type (void) G_GNUC_CONST;
26
+ #define GDK_TYPE_PIXBUF_ERROR (gdk_pixbuf_error_get_type ())
27
+
28
+ /* enumerations from "gdk-pixbuf-transform.h" */
29
+ GDK_PIXBUF_AVAILABLE_IN_ALL
30
+ GType gdk_interp_type_get_type (void) G_GNUC_CONST;
31
+ #define GDK_TYPE_INTERP_TYPE (gdk_interp_type_get_type ())
32
+ GDK_PIXBUF_AVAILABLE_IN_ALL
33
+ GType gdk_pixbuf_rotation_get_type (void) G_GNUC_CONST;
34
+ #define GDK_TYPE_PIXBUF_ROTATION (gdk_pixbuf_rotation_get_type ())
35
+ G_END_DECLS
36
+
37
+ #endif /* __GDK_PIXBUF_ENUM_TYPES_H__ */
38
+
39
+ /* Generated data ends here */
40
+
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-features.h ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __GDK_PIXBUF_FEATURES_H__
2
+ #define __GDK_PIXBUF_FEATURES_H__
3
+
4
+ #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
5
+ #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
6
+ #endif
7
+
8
+ #include <glib.h>
9
+
10
+ /**
11
+ * GDK_PIXBUF_MAJOR:
12
+ *
13
+ * Major version of gdk-pixbuf library, that is the "0" in
14
+ * "0.8.2" for example.
15
+ */
16
+ /**
17
+ * GDK_PIXBUF_MINOR:
18
+ *
19
+ * Minor version of gdk-pixbuf library, that is the "8" in
20
+ * "0.8.2" for example.
21
+ */
22
+ /**
23
+ * GDK_PIXBUF_MICRO:
24
+ *
25
+ * Micro version of gdk-pixbuf library, that is the "2" in
26
+ * "0.8.2" for example.
27
+ */
28
+ /**
29
+ * GDK_PIXBUF_VERSION:
30
+ *
31
+ * Contains the full version of GdkPixbuf as a string.
32
+ *
33
+ * This is the version being compiled against; contrast with
34
+ * `gdk_pixbuf_version`.
35
+ */
36
+
37
+ #define GDK_PIXBUF_MAJOR (2)
38
+ #define GDK_PIXBUF_MINOR (42)
39
+ #define GDK_PIXBUF_MICRO (10)
40
+ #define GDK_PIXBUF_VERSION "2.42.10"
41
+
42
+ #ifndef _GDK_PIXBUF_EXTERN
43
+ #define _GDK_PIXBUF_EXTERN extern
44
+ #endif
45
+
46
+ /* We prefix variable declarations so they can
47
+ * properly get exported/imported from Windows DLLs.
48
+ */
49
+ #ifdef G_PLATFORM_WIN32
50
+ # ifdef GDK_PIXBUF_STATIC_COMPILATION
51
+ # define GDK_PIXBUF_VAR extern
52
+ # else /* !GDK_PIXBUF_STATIC_COMPILATION */
53
+ # ifdef GDK_PIXBUF_C_COMPILATION
54
+ # ifdef DLL_EXPORT
55
+ # define GDK_PIXBUF_VAR _GDK_PIXBUF_EXTERN
56
+ # else /* !DLL_EXPORT */
57
+ # define GDK_PIXBUF_VAR extern
58
+ # endif /* !DLL_EXPORT */
59
+ # else /* !GDK_PIXBUF_C_COMPILATION */
60
+ # define GDK_PIXBUF_VAR extern __declspec(dllimport)
61
+ # endif /* !GDK_PIXBUF_C_COMPILATION */
62
+ # endif /* !GDK_PIXBUF_STATIC_COMPILATION */
63
+ #else /* !G_PLATFORM_WIN32 */
64
+ # define GDK_PIXBUF_VAR _GDK_PIXBUF_EXTERN
65
+ #endif /* !G_PLATFORM_WIN32 */
66
+
67
+ /**
68
+ * gdk_pixbuf_major_version:
69
+ *
70
+ * The major version number of the gdk-pixbuf library. (e.g. in
71
+ * gdk-pixbuf version 1.2.5 this is 1.)
72
+ *
73
+ *
74
+ * This variable is in the library, so represents the
75
+ * gdk-pixbuf library you have linked against. Contrast with the
76
+ * `GDK_PIXBUF_MAJOR` macro, which represents the major version of the
77
+ * gdk-pixbuf headers you have included.
78
+ */
79
+ /**
80
+ * gdk_pixbuf_minor_version:
81
+ *
82
+ * The minor version number of the gdk-pixbuf library. (e.g. in
83
+ * gdk-pixbuf version 1.2.5 this is 2.)
84
+ *
85
+ *
86
+ * This variable is in the library, so represents the
87
+ * gdk-pixbuf library you have linked against. Contrast with the
88
+ * `GDK_PIXBUF_MINOR` macro, which represents the minor version of the
89
+ * gdk-pixbuf headers you have included.
90
+ */
91
+ /**
92
+ * gdk_pixbuf_micro_version:
93
+ *
94
+ * The micro version number of the gdk-pixbuf library. (e.g. in
95
+ * gdk-pixbuf version 1.2.5 this is 5.)
96
+ *
97
+ *
98
+ * This variable is in the library, so represents the
99
+ * gdk-pixbuf library you have linked against. Contrast with the
100
+ * `GDK_PIXBUF_MICRO` macro, which represents the micro version of the
101
+ * gdk-pixbuf headers you have included.
102
+ */
103
+ /**
104
+ * gdk_pixbuf_version:
105
+ *
106
+ * Contains the full version of the gdk-pixbuf library as a string.
107
+ * This is the version currently in use by a running program.
108
+ */
109
+
110
+ GDK_PIXBUF_VAR const guint gdk_pixbuf_major_version;
111
+ GDK_PIXBUF_VAR const guint gdk_pixbuf_minor_version;
112
+ GDK_PIXBUF_VAR const guint gdk_pixbuf_micro_version;
113
+ GDK_PIXBUF_VAR const char *gdk_pixbuf_version;
114
+
115
+ #endif /* __GDK_PIXBUF_FEATURES_H__ */
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-io.h ADDED
@@ -0,0 +1,481 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GdkPixbuf library - Io handling. This is an internal header for
2
+ * GdkPixbuf. You should never use it unless you are doing development for
3
+ * GdkPixbuf itself.
4
+ *
5
+ * Copyright (C) 1999 The Free Software Foundation
6
+ *
7
+ * Authors: Mark Crichton <crichton@gimp.org>
8
+ * Miguel de Icaza <miguel@gnu.org>
9
+ * Federico Mena-Quintero <federico@gimp.org>
10
+ * Jonathan Blandford <jrb@redhat.com>
11
+ * Michael Fulbright <drmike@redhat.com>
12
+ *
13
+ * This library is free software; you can redistribute it and/or
14
+ * modify it under the terms of the GNU Lesser General Public
15
+ * License as published by the Free Software Foundation; either
16
+ * version 2 of the License, or (at your option) any later version.
17
+ *
18
+ * This library is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
+ * Lesser General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU Lesser General Public
24
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
25
+ */
26
+
27
+ #ifndef GDK_PIXBUF_IO_H
28
+ #define GDK_PIXBUF_IO_H
29
+
30
+ #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
31
+ #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
32
+ #endif
33
+
34
+ #include <stdio.h>
35
+ #include <glib.h>
36
+ #include <gmodule.h>
37
+ #include <gdk-pixbuf/gdk-pixbuf-core.h>
38
+ #include <gdk-pixbuf/gdk-pixbuf-animation.h>
39
+
40
+ G_BEGIN_DECLS
41
+
42
+ typedef struct _GdkPixbufFormat GdkPixbufFormat;
43
+
44
+ GDK_PIXBUF_AVAILABLE_IN_2_40
45
+ gboolean gdk_pixbuf_init_modules (const char *path,
46
+ GError **error);
47
+
48
+ GDK_PIXBUF_AVAILABLE_IN_ALL
49
+ GType gdk_pixbuf_format_get_type (void) G_GNUC_CONST;
50
+
51
+ GDK_PIXBUF_AVAILABLE_IN_ALL
52
+ GSList *gdk_pixbuf_get_formats (void);
53
+ GDK_PIXBUF_AVAILABLE_IN_2_2
54
+ gchar *gdk_pixbuf_format_get_name (GdkPixbufFormat *format);
55
+ GDK_PIXBUF_AVAILABLE_IN_2_2
56
+ gchar *gdk_pixbuf_format_get_description (GdkPixbufFormat *format);
57
+ GDK_PIXBUF_AVAILABLE_IN_2_2
58
+ gchar **gdk_pixbuf_format_get_mime_types (GdkPixbufFormat *format);
59
+ GDK_PIXBUF_AVAILABLE_IN_2_2
60
+ gchar **gdk_pixbuf_format_get_extensions (GdkPixbufFormat *format);
61
+ GDK_PIXBUF_AVAILABLE_IN_2_36
62
+ gboolean gdk_pixbuf_format_is_save_option_supported (GdkPixbufFormat *format,
63
+ const gchar *option_key);
64
+ GDK_PIXBUF_AVAILABLE_IN_2_2
65
+ gboolean gdk_pixbuf_format_is_writable (GdkPixbufFormat *format);
66
+ GDK_PIXBUF_AVAILABLE_IN_2_6
67
+ gboolean gdk_pixbuf_format_is_scalable (GdkPixbufFormat *format);
68
+ GDK_PIXBUF_AVAILABLE_IN_2_6
69
+ gboolean gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format);
70
+ GDK_PIXBUF_AVAILABLE_IN_2_6
71
+ void gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format,
72
+ gboolean disabled);
73
+ GDK_PIXBUF_AVAILABLE_IN_2_6
74
+ gchar *gdk_pixbuf_format_get_license (GdkPixbufFormat *format);
75
+
76
+ GDK_PIXBUF_AVAILABLE_IN_2_4
77
+ GdkPixbufFormat *gdk_pixbuf_get_file_info (const gchar *filename,
78
+ gint *width,
79
+ gint *height);
80
+ GDK_PIXBUF_AVAILABLE_IN_2_32
81
+ void gdk_pixbuf_get_file_info_async (const gchar *filename,
82
+ GCancellable *cancellable,
83
+ GAsyncReadyCallback callback,
84
+ gpointer user_data);
85
+ GDK_PIXBUF_AVAILABLE_IN_2_32
86
+ GdkPixbufFormat *gdk_pixbuf_get_file_info_finish (GAsyncResult *async_result,
87
+ gint *width,
88
+ gint *height,
89
+ GError **error);
90
+
91
+ GDK_PIXBUF_AVAILABLE_IN_ALL
92
+ GdkPixbufFormat *gdk_pixbuf_format_copy (const GdkPixbufFormat *format);
93
+ GDK_PIXBUF_AVAILABLE_IN_ALL
94
+ void gdk_pixbuf_format_free (GdkPixbufFormat *format);
95
+
96
+ #ifdef GDK_PIXBUF_ENABLE_BACKEND
97
+
98
+
99
+
100
+ /**
101
+ * GdkPixbufModuleSizeFunc:
102
+ * @width: pointer to a location containing the current image width
103
+ * @height: pointer to a location containing the current image height
104
+ * @user_data: the loader.
105
+ *
106
+ * Defines the type of the function that gets called once the size
107
+ * of the loaded image is known.
108
+ *
109
+ * The function is expected to set @width and @height to the desired
110
+ * size to which the image should be scaled. If a module has no efficient
111
+ * way to achieve the desired scaling during the loading of the image, it may
112
+ * either ignore the size request, or only approximate it - gdk-pixbuf will
113
+ * then perform the required scaling on the completely loaded image.
114
+ *
115
+ * If the function sets @width or @height to zero, the module should interpret
116
+ * this as a hint that it will be closed soon and shouldn't allocate further
117
+ * resources. This convention is used to implement gdk_pixbuf_get_file_info()
118
+ * efficiently.
119
+ *
120
+ * Since: 2.2
121
+ */
122
+ typedef void (* GdkPixbufModuleSizeFunc) (gint *width,
123
+ gint *height,
124
+ gpointer user_data);
125
+
126
+ /**
127
+ * GdkPixbufModulePreparedFunc:
128
+ * @pixbuf: the #GdkPixbuf that is currently being loaded.
129
+ * @anim: if an animation is being loaded, the #GdkPixbufAnimation, else %NULL.
130
+ * @user_data: the loader.
131
+ *
132
+ * Defines the type of the function that gets called once the initial
133
+ * setup of @pixbuf is done.
134
+ *
135
+ * #GdkPixbufLoader uses a function of this type to emit the
136
+ * "<link linkend="GdkPixbufLoader-area-prepared">area_prepared</link>"
137
+ * signal.
138
+ *
139
+ * Since: 2.2
140
+ */
141
+ typedef void (* GdkPixbufModulePreparedFunc) (GdkPixbuf *pixbuf,
142
+ GdkPixbufAnimation *anim,
143
+ gpointer user_data);
144
+
145
+ /**
146
+ * GdkPixbufModuleUpdatedFunc:
147
+ * @pixbuf: the #GdkPixbuf that is currently being loaded.
148
+ * @x: the X origin of the updated area.
149
+ * @y: the Y origin of the updated area.
150
+ * @width: the width of the updated area.
151
+ * @height: the height of the updated area.
152
+ * @user_data: the loader.
153
+ *
154
+ * Defines the type of the function that gets called every time a region
155
+ * of @pixbuf is updated.
156
+ *
157
+ * #GdkPixbufLoader uses a function of this type to emit the
158
+ * "<link linkend="GdkPixbufLoader-area-updated">area_updated</link>"
159
+ * signal.
160
+ *
161
+ * Since: 2.2
162
+ */
163
+ typedef void (* GdkPixbufModuleUpdatedFunc) (GdkPixbuf *pixbuf,
164
+ int x,
165
+ int y,
166
+ int width,
167
+ int height,
168
+ gpointer user_data);
169
+
170
+ /**
171
+ * GdkPixbufModulePattern:
172
+ * @prefix: the prefix for this pattern
173
+ * @mask: mask containing bytes which modify how the prefix is matched against
174
+ * test data
175
+ * @relevance: relevance of this pattern
176
+ *
177
+ * The signature prefix for a module.
178
+ *
179
+ * The signature of a module is a set of prefixes. Prefixes are encoded as
180
+ * pairs of ordinary strings, where the second string, called the mask, if
181
+ * not `NULL`, must be of the same length as the first one and may contain
182
+ * ' ', '!', 'x', 'z', and 'n' to indicate bytes that must be matched,
183
+ * not matched, "don't-care"-bytes, zeros and non-zeros, respectively.
184
+ *
185
+ * Each prefix has an associated integer that describes the relevance of
186
+ * the prefix, with 0 meaning a mismatch and 100 a "perfect match".
187
+ *
188
+ * Starting with gdk-pixbuf 2.8, the first byte of the mask may be '*',
189
+ * indicating an unanchored pattern that matches not only at the beginning,
190
+ * but also in the middle. Versions prior to 2.8 will interpret the '*'
191
+ * like an 'x'.
192
+ *
193
+ * The signature of a module is stored as an array of
194
+ * `GdkPixbufModulePatterns`. The array is terminated by a pattern
195
+ * where the `prefix` is `NULL`.
196
+ *
197
+ * ```c
198
+ * GdkPixbufModulePattern *signature[] = {
199
+ * { "abcdx", " !x z", 100 },
200
+ * { "bla", NULL, 90 },
201
+ * { NULL, NULL, 0 }
202
+ * };
203
+ * ```
204
+ *
205
+ * In the example above, the signature matches e.g. "auud\0" with
206
+ * relevance 100, and "blau" with relevance 90.
207
+ *
208
+ * Since: 2.2
209
+ */
210
+ typedef struct _GdkPixbufModulePattern GdkPixbufModulePattern;
211
+ struct _GdkPixbufModulePattern {
212
+ char *prefix;
213
+ char *mask;
214
+ int relevance;
215
+ };
216
+
217
+ /**
218
+ * GdkPixbufModuleLoadFunc:
219
+ * @f: the file stream from which the image should be loaded
220
+ * @error: return location for a loading error
221
+ *
222
+ * Loads a file from a standard C file stream into a new `GdkPixbuf`.
223
+ *
224
+ * In case of error, this function should return `NULL` and set the `error` argument.
225
+ *
226
+ * Returns: (transfer full): a newly created `GdkPixbuf` for the contents of the file
227
+ */
228
+ typedef GdkPixbuf *(* GdkPixbufModuleLoadFunc) (FILE *f,
229
+ GError **error);
230
+
231
+ /**
232
+ * GdkPixbufModuleLoadXpmDataFunc:
233
+ * @data: (array zero-terminated=1): the XPM data
234
+ *
235
+ * Loads XPM data into a new `GdkPixbuf`.
236
+ *
237
+ * Returns: (transfer full): a newly created `GdkPixbuf` for the XPM data
238
+ */
239
+ typedef GdkPixbuf *(* GdkPixbufModuleLoadXpmDataFunc) (const char **data);
240
+
241
+ /**
242
+ * GdkPixbufModuleLoadAnimationFunc:
243
+ * @f: the file stream from which the image should be loaded
244
+ * @error: return location for a loading error
245
+ *
246
+ * Loads a file from a standard C file stream into a new `GdkPixbufAnimation`.
247
+ *
248
+ * In case of error, this function should return `NULL` and set the `error` argument.
249
+ *
250
+ * Returns: (transfer full): a newly created `GdkPixbufAnimation` for the contents of the file
251
+ */
252
+ typedef GdkPixbufAnimation *(* GdkPixbufModuleLoadAnimationFunc) (FILE *f,
253
+ GError **error);
254
+
255
+ /**
256
+ * GdkPixbufModuleBeginLoadFunc:
257
+ * @size_func: the function to be called when the size is known
258
+ * @prepared_func: the function to be called when the data has been prepared
259
+ * @updated_func: the function to be called when the data has been updated
260
+ * @user_data: the data to be passed to the functions
261
+ * @error: return location for a loading error
262
+ *
263
+ * Sets up the image loading state.
264
+ *
265
+ * The image loader is responsible for storing the given function pointers
266
+ * and user data, and call them when needed.
267
+ *
268
+ * The image loader should set up an internal state object, and return it
269
+ * from this function; the state object will then be updated from the
270
+ * [callback@GdkPixbuf.PixbufModuleIncrementLoadFunc] callback, and will be freed
271
+ * by [callback@GdkPixbuf.PixbufModuleStopLoadFunc] callback.
272
+ *
273
+ * Returns: (transfer full): the data to be passed to
274
+ * [callback@GdkPixbuf.PixbufModuleIncrementLoadFunc]
275
+ * and [callback@GdkPixbuf.PixbufModuleStopLoadFunc], or `NULL` in case of error
276
+ */
277
+ typedef gpointer (* GdkPixbufModuleBeginLoadFunc) (GdkPixbufModuleSizeFunc size_func,
278
+ GdkPixbufModulePreparedFunc prepared_func,
279
+ GdkPixbufModuleUpdatedFunc updated_func,
280
+ gpointer user_data,
281
+ GError **error);
282
+
283
+ /**
284
+ * GdkPixbufModuleStopLoadFunc:
285
+ * @context: (transfer full): the state object created by [callback@GdkPixbuf.PixbufModuleBeginLoadFunc]
286
+ * @error: return location for a loading error
287
+ *
288
+ * Finalizes the image loading state.
289
+ *
290
+ * This function is called on success and error states.
291
+ *
292
+ * Returns: `TRUE` if the loading operation was successful
293
+ */
294
+ typedef gboolean (* GdkPixbufModuleStopLoadFunc) (gpointer context,
295
+ GError **error);
296
+
297
+ /**
298
+ * GdkPixbufModuleIncrementLoadFunc:
299
+ * @context: (transfer none): the state object created by [callback@GdkPixbuf.PixbufModuleBeginLoadFunc]
300
+ * @buf: (array length=size) (element-type guint8): the data to load
301
+ * @size: the length of the data to load
302
+ * @error: return location for a loading error
303
+ *
304
+ * Incrementally loads a buffer into the image data.
305
+ *
306
+ * Returns: `TRUE` if the incremental load was successful
307
+ */
308
+ typedef gboolean (* GdkPixbufModuleIncrementLoadFunc) (gpointer context,
309
+ const guchar *buf,
310
+ guint size,
311
+ GError **error);
312
+
313
+ /**
314
+ * GdkPixbufModuleSaveFunc:
315
+ * @f: the file stream into which the image should be saved
316
+ * @pixbuf: the image to save
317
+ * @param_keys: (nullable) (array zero-terminated=1): parameter keys to save
318
+ * @param_values: (nullable) (array zero-terminated=1): parameter values to save
319
+ * @error: return location for a saving error
320
+ *
321
+ * Saves a `GdkPixbuf` into a standard C file stream.
322
+ *
323
+ * The optional `param_keys` and `param_values` arrays contain the keys and
324
+ * values (in the same order) for attributes to be saved alongside the image
325
+ * data.
326
+ *
327
+ * Returns: `TRUE` on success; in case of failure, `FALSE` is returned and
328
+ * the `error` is set
329
+ */
330
+ typedef gboolean (* GdkPixbufModuleSaveFunc) (FILE *f,
331
+ GdkPixbuf *pixbuf,
332
+ gchar **param_keys,
333
+ gchar **param_values,
334
+ GError **error);
335
+
336
+ /**
337
+ * GdkPixbufModuleSaveCallbackFunc:
338
+ * @save_func: the function to call when saving
339
+ * @user_data: (closure): the data to pass to @save_func
340
+ * @pixbuf: the `GdkPixbuf` to save
341
+ * @option_keys: (nullable) (array zero-terminated=1): an array of option names
342
+ * @option_values: (nullable) (array zero-terminated=1): an array of option values
343
+ * @error: return location for a save error
344
+ *
345
+ * Saves a `GdkPixbuf` by calling the provided function.
346
+ *
347
+ * The optional `option_keys` and `option_values` arrays contain the keys and
348
+ * values (in the same order) for attributes to be saved alongside the image
349
+ * data.
350
+ *
351
+ * Returns: `TRUE` on success; in case of failure, `FALSE` is returned and
352
+ * the `error` is set
353
+ */
354
+ typedef gboolean (* GdkPixbufModuleSaveCallbackFunc) (GdkPixbufSaveFunc save_func,
355
+ gpointer user_data,
356
+ GdkPixbuf *pixbuf,
357
+ gchar **option_keys,
358
+ gchar **option_values,
359
+ GError **error);
360
+
361
+ /**
362
+ * GdkPixbufModuleSaveOptionSupportedFunc:
363
+ * @option_key: the option key to check
364
+ *
365
+ * Checks whether the given `option_key` is supported when saving.
366
+ *
367
+ * Returns: `TRUE` if the option is supported
368
+ */
369
+ typedef gboolean (* GdkPixbufModuleSaveOptionSupportedFunc) (const gchar *option_key);
370
+
371
+ typedef struct _GdkPixbufModule GdkPixbufModule;
372
+ struct _GdkPixbufModule {
373
+ char *module_name;
374
+ char *module_path;
375
+ GModule *module;
376
+ GdkPixbufFormat *info;
377
+
378
+ /* Atomic loading */
379
+ GdkPixbufModuleLoadFunc load;
380
+ GdkPixbufModuleLoadXpmDataFunc load_xpm_data;
381
+
382
+ /* Incremental loading */
383
+ GdkPixbufModuleBeginLoadFunc begin_load;
384
+ GdkPixbufModuleStopLoadFunc stop_load;
385
+ GdkPixbufModuleIncrementLoadFunc load_increment;
386
+
387
+ /* Animation loading */
388
+ GdkPixbufModuleLoadAnimationFunc load_animation;
389
+
390
+ /* Saving */
391
+ GdkPixbufModuleSaveFunc save;
392
+ GdkPixbufModuleSaveCallbackFunc save_to_callback;
393
+ GdkPixbufModuleSaveOptionSupportedFunc is_save_option_supported;
394
+
395
+ /*< private >*/
396
+ void (*_reserved1) (void);
397
+ void (*_reserved2) (void);
398
+ void (*_reserved3) (void);
399
+ void (*_reserved4) (void);
400
+ };
401
+
402
+ /**
403
+ * GdkPixbufModuleFillVtableFunc:
404
+ * @module: a #GdkPixbufModule.
405
+ *
406
+ * Defines the type of the function used to set the vtable of a
407
+ * #GdkPixbufModule when it is loaded.
408
+ *
409
+ * Since: 2.2
410
+ */
411
+ typedef void (* GdkPixbufModuleFillVtableFunc) (GdkPixbufModule *module);
412
+
413
+ /**
414
+ * GdkPixbufModuleFillInfoFunc:
415
+ * @info: a #GdkPixbufFormat.
416
+ *
417
+ * Defines the type of the function used to fill a
418
+ * #GdkPixbufFormat structure with information about a module.
419
+ *
420
+ * Since: 2.2
421
+ */
422
+ typedef void (* GdkPixbufModuleFillInfoFunc) (GdkPixbufFormat *info);
423
+
424
+ /**
425
+ * GdkPixbufFormatFlags:
426
+ * @GDK_PIXBUF_FORMAT_WRITABLE: the module can write out images in the format.
427
+ * @GDK_PIXBUF_FORMAT_SCALABLE: the image format is scalable
428
+ * @GDK_PIXBUF_FORMAT_THREADSAFE: the module is threadsafe. gdk-pixbuf
429
+ * ignores modules that are not marked as threadsafe. (Since 2.28).
430
+ *
431
+ * Flags which allow a module to specify further details about the supported
432
+ * operations.
433
+ *
434
+ * Since: 2.2
435
+ */
436
+ typedef enum /*< skip >*/
437
+ {
438
+ GDK_PIXBUF_FORMAT_WRITABLE = 1 << 0,
439
+ GDK_PIXBUF_FORMAT_SCALABLE = 1 << 1,
440
+ GDK_PIXBUF_FORMAT_THREADSAFE = 1 << 2
441
+ } GdkPixbufFormatFlags;
442
+
443
+ /**
444
+ * GdkPixbufFormat:
445
+ * @name: the name of the image format
446
+ * @signature: the signature of the module
447
+ * @domain: the message domain for the `description`
448
+ * @description: a description of the image format
449
+ * @mime_types: (array zero-terminated=1): the MIME types for the image format
450
+ * @extensions: (array zero-terminated=1): typical filename extensions for the
451
+ * image format
452
+ * @flags: a combination of `GdkPixbufFormatFlags`
453
+ * @disabled: a boolean determining whether the loader is disabled`
454
+ * @license: a string containing license information, typically set to
455
+ * shorthands like "GPL", "LGPL", etc.
456
+ *
457
+ * A `GdkPixbufFormat` contains information about the image format accepted
458
+ * by a module.
459
+ *
460
+ * Only modules should access the fields directly, applications should
461
+ * use the `gdk_pixbuf_format_*` family of functions.
462
+ *
463
+ * Since: 2.2
464
+ */
465
+ struct _GdkPixbufFormat {
466
+ gchar *name;
467
+ GdkPixbufModulePattern *signature;
468
+ gchar *domain;
469
+ gchar *description;
470
+ gchar **mime_types;
471
+ gchar **extensions;
472
+ guint32 flags;
473
+ gboolean disabled;
474
+ gchar *license;
475
+ };
476
+
477
+ #endif /* GDK_PIXBUF_ENABLE_BACKEND */
478
+
479
+ G_END_DECLS
480
+
481
+ #endif /* GDK_PIXBUF_IO_H */
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-loader.h ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GdkPixbuf library - Progressive loader object
2
+ *
3
+ * Copyright (C) 1999 The Free Software Foundation
4
+ *
5
+ * Authors: Mark Crichton <crichton@gimp.org>
6
+ * Miguel de Icaza <miguel@gnu.org>
7
+ * Federico Mena-Quintero <federico@gimp.org>
8
+ * Jonathan Blandford <jrb@redhat.com>
9
+ *
10
+ * This library is free software; you can redistribute it and/or
11
+ * modify it under the terms of the GNU Lesser General Public
12
+ * License as published by the Free Software Foundation; either
13
+ * version 2 of the License, or (at your option) any later version.
14
+ *
15
+ * This library is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ * Lesser General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU Lesser General Public
21
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
22
+ */
23
+
24
+ #ifndef GDK_PIXBUF_LOADER_H
25
+ #define GDK_PIXBUF_LOADER_H
26
+
27
+ #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
28
+ #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
29
+ #endif
30
+
31
+ #include <glib.h>
32
+ #include <glib-object.h>
33
+ #include <gdk-pixbuf/gdk-pixbuf-core.h>
34
+ #include <gdk-pixbuf/gdk-pixbuf-animation.h>
35
+ #include <gdk-pixbuf/gdk-pixbuf-io.h>
36
+
37
+ G_BEGIN_DECLS
38
+
39
+ #define GDK_TYPE_PIXBUF_LOADER (gdk_pixbuf_loader_get_type ())
40
+ #define GDK_PIXBUF_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoader))
41
+ #define GDK_PIXBUF_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass))
42
+ #define GDK_IS_PIXBUF_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PIXBUF_LOADER))
43
+ #define GDK_IS_PIXBUF_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_LOADER))
44
+ #define GDK_PIXBUF_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass))
45
+
46
+ typedef struct _GdkPixbufLoader GdkPixbufLoader;
47
+ struct _GdkPixbufLoader
48
+ {
49
+ /*< private >*/
50
+ GObject parent_instance;
51
+
52
+ gpointer priv;
53
+ };
54
+
55
+ typedef struct _GdkPixbufLoaderClass GdkPixbufLoaderClass;
56
+ struct _GdkPixbufLoaderClass
57
+ {
58
+ GObjectClass parent_class;
59
+
60
+ void (*size_prepared) (GdkPixbufLoader *loader,
61
+ int width,
62
+ int height);
63
+
64
+ void (*area_prepared) (GdkPixbufLoader *loader);
65
+
66
+ /* Last known frame needs a redraw for x, y, width, height */
67
+ void (*area_updated) (GdkPixbufLoader *loader,
68
+ int x,
69
+ int y,
70
+ int width,
71
+ int height);
72
+
73
+ void (*closed) (GdkPixbufLoader *loader);
74
+ };
75
+
76
+ GDK_PIXBUF_AVAILABLE_IN_ALL
77
+ GType gdk_pixbuf_loader_get_type (void) G_GNUC_CONST;
78
+ GDK_PIXBUF_AVAILABLE_IN_ALL
79
+ GdkPixbufLoader * gdk_pixbuf_loader_new (void);
80
+ GDK_PIXBUF_AVAILABLE_IN_ALL
81
+ GdkPixbufLoader * gdk_pixbuf_loader_new_with_type (const char *image_type,
82
+ GError **error);
83
+ GDK_PIXBUF_AVAILABLE_IN_2_4
84
+ GdkPixbufLoader * gdk_pixbuf_loader_new_with_mime_type (const char *mime_type,
85
+ GError **error);
86
+ GDK_PIXBUF_AVAILABLE_IN_2_2
87
+ void gdk_pixbuf_loader_set_size (GdkPixbufLoader *loader,
88
+ int width,
89
+ int height);
90
+ GDK_PIXBUF_AVAILABLE_IN_ALL
91
+ gboolean gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
92
+ const guchar *buf,
93
+ gsize count,
94
+ GError **error);
95
+ GDK_PIXBUF_AVAILABLE_IN_2_30
96
+ gboolean gdk_pixbuf_loader_write_bytes (GdkPixbufLoader *loader,
97
+ GBytes *buffer,
98
+ GError **error);
99
+ GDK_PIXBUF_AVAILABLE_IN_ALL
100
+ GdkPixbuf * gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader);
101
+ GDK_PIXBUF_AVAILABLE_IN_ALL
102
+ GdkPixbufAnimation * gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader);
103
+ GDK_PIXBUF_AVAILABLE_IN_ALL
104
+ gboolean gdk_pixbuf_loader_close (GdkPixbufLoader *loader,
105
+ GError **error);
106
+ GDK_PIXBUF_AVAILABLE_IN_2_2
107
+ GdkPixbufFormat *gdk_pixbuf_loader_get_format (GdkPixbufLoader *loader);
108
+
109
+ G_END_DECLS
110
+
111
+ #endif
112
+
113
+
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-macros.h ADDED
@@ -0,0 +1,718 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GdkPixbuf library - GdkPixbuf Macros
2
+ *
3
+ * Copyright (C) 2016 Chun-wei Fan
4
+ *
5
+ * Authors: Chun-wei Fan <fanc999@yahoo.com.tw>
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+ #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
22
+ #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
23
+ #endif
24
+
25
+ #ifndef GDK_PIXBUF_MACROS_H
26
+ #define GDK_PIXBUF_MACROS_H
27
+
28
+ #include <glib.h>
29
+
30
+ #include <gdk-pixbuf/gdk-pixbuf-features.h>
31
+
32
+ /**
33
+ * GDK_PIXBUF_CHECK_VERSION:
34
+ * @major: major version (e.g. 2 for version 2.34.0)
35
+ * @minor: minor version (e.g. 34 for version 2.34.0)
36
+ * @micro: micro version (e.g. 0 for version 2.34.0)
37
+ *
38
+ * Macro to test the version of GdkPixbuf being compiled against.
39
+ *
40
+ * Returns: %TRUE if the version of the GdkPixbuf header files
41
+ * is the same as or newer than the passed-in version.
42
+ *
43
+ * Since: 2.36
44
+ */
45
+ #define GDK_PIXBUF_CHECK_VERSION(major, minor, micro) \
46
+ (GDK_PIXBUF_MAJOR > (major) || \
47
+ (GDK_PIXBUF_MAJOR == (major) && GDK_PIXBUF_MINOR > (minor)) || \
48
+ (GDK_PIXBUF_MAJOR == (major) && GDK_PIXBUF_MINOR == (minor) && \
49
+ GDK_PIXBUF_MICRO >= (micro)))
50
+
51
+ /**
52
+ * GDK_PIXBUF_VERSION_2_0:
53
+ *
54
+ * A macro that evaluates to the 2.0 version of GdkPixbuf,
55
+ * in a format that can be used by the C pre-processor.
56
+ *
57
+ * Since: 2.36
58
+ */
59
+ #define GDK_PIXBUF_VERSION_2_0 (G_ENCODE_VERSION (2, 0))
60
+
61
+ /**
62
+ * GDK_PIXBUF_VERSION_2_2:
63
+ *
64
+ * A macro that evaluates to the 2.2 version of GdkPixbuf,
65
+ * in a format that can be used by the C pre-processor.
66
+ *
67
+ * Since: 2.36
68
+ */
69
+ #define GDK_PIXBUF_VERSION_2_2 (G_ENCODE_VERSION (2, 2))
70
+
71
+ /**
72
+ * GDK_PIXBUF_VERSION_2_4:
73
+ *
74
+ * A macro that evaluates to the 2.4 version of GdkPixbuf,
75
+ * in a format that can be used by the C pre-processor.
76
+ *
77
+ * Since: 2.36
78
+ */
79
+ #define GDK_PIXBUF_VERSION_2_4 (G_ENCODE_VERSION (2, 4))
80
+
81
+ /**
82
+ * GDK_PIXBUF_VERSION_2_6:
83
+ *
84
+ * A macro that evaluates to the 2.6 version of GdkPixbuf,
85
+ * in a format that can be used by the C pre-processor.
86
+ *
87
+ * Since: 2.36
88
+ */
89
+ #define GDK_PIXBUF_VERSION_2_6 (G_ENCODE_VERSION (2, 6))
90
+
91
+ /**
92
+ * GDK_PIXBUF_VERSION_2_8:
93
+ *
94
+ * A macro that evaluates to the 2.8 version of GdkPixbuf,
95
+ * in a format that can be used by the C pre-processor.
96
+ *
97
+ * Since: 2.36
98
+ */
99
+ #define GDK_PIXBUF_VERSION_2_8 (G_ENCODE_VERSION (2, 8))
100
+
101
+ /**
102
+ * GDK_PIXBUF_VERSION_2_10:
103
+ *
104
+ * A macro that evaluates to the 2.10 version of GdkPixbuf,
105
+ * in a format that can be used by the C pre-processor.
106
+ *
107
+ * Since: 2.36
108
+ */
109
+ #define GDK_PIXBUF_VERSION_2_10 (G_ENCODE_VERSION (2, 10))
110
+
111
+ /**
112
+ * GDK_PIXBUF_VERSION_2_12:
113
+ *
114
+ * A macro that evaluates to the 2.12 version of GdkPixbuf,
115
+ * in a format that can be used by the C pre-processor.
116
+ *
117
+ * Since: 2.36
118
+ */
119
+ #define GDK_PIXBUF_VERSION_2_12 (G_ENCODE_VERSION (2, 12))
120
+
121
+ /**
122
+ * GDK_PIXBUF_VERSION_2_14:
123
+ *
124
+ * A macro that evaluates to the 2.14 version of GdkPixbuf,
125
+ * in a format that can be used by the C pre-processor.
126
+ *
127
+ * Since: 2.36
128
+ */
129
+ #define GDK_PIXBUF_VERSION_2_14 (G_ENCODE_VERSION (2, 14))
130
+
131
+ /**
132
+ * GDK_PIXBUF_VERSION_2_16:
133
+ *
134
+ * A macro that evaluates to the 2.16 version of GdkPixbuf,
135
+ * in a format that can be used by the C pre-processor.
136
+ *
137
+ * Since: 2.36
138
+ */
139
+ #define GDK_PIXBUF_VERSION_2_16 (G_ENCODE_VERSION (2, 16))
140
+
141
+ /**
142
+ * GDK_PIXBUF_VERSION_2_18:
143
+ *
144
+ * A macro that evaluates to the 2.18 version of GdkPixbuf,
145
+ * in a format that can be used by the C pre-processor.
146
+ *
147
+ * Since: 2.36
148
+ */
149
+ #define GDK_PIXBUF_VERSION_2_18 (G_ENCODE_VERSION (2, 18))
150
+
151
+ /**
152
+ * GDK_PIXBUF_VERSION_2_20:
153
+ *
154
+ * A macro that evaluates to the 2.20 version of GdkPixbuf,
155
+ * in a format that can be used by the C pre-processor.
156
+ *
157
+ * Since: 2.36
158
+ */
159
+ #define GDK_PIXBUF_VERSION_2_20 (G_ENCODE_VERSION (2, 20))
160
+
161
+ /**
162
+ * GDK_PIXBUF_VERSION_2_22:
163
+ *
164
+ * A macro that evaluates to the 2.22 version of GdkPixbuf,
165
+ * in a format that can be used by the C pre-processor.
166
+ *
167
+ * Since: 2.36
168
+ */
169
+ #define GDK_PIXBUF_VERSION_2_22 (G_ENCODE_VERSION (2, 22))
170
+
171
+ /**
172
+ * GDK_PIXBUF_VERSION_2_24:
173
+ *
174
+ * A macro that evaluates to the 2.24 version of GdkPixbuf,
175
+ * in a format that can be used by the C pre-processor.
176
+ *
177
+ * Since: 2.36
178
+ */
179
+ #define GDK_PIXBUF_VERSION_2_24 (G_ENCODE_VERSION (2, 24))
180
+
181
+ /**
182
+ * GDK_PIXBUF_VERSION_2_26:
183
+ *
184
+ * A macro that evaluates to the 2.26 version of GdkPixbuf,
185
+ * in a format that can be used by the C pre-processor.
186
+ *
187
+ * Since: 2.36
188
+ */
189
+ #define GDK_PIXBUF_VERSION_2_26 (G_ENCODE_VERSION (2, 26))
190
+
191
+ /**
192
+ * GDK_PIXBUF_VERSION_2_28:
193
+ *
194
+ * A macro that evaluates to the 2.28 version of GdkPixbuf,
195
+ * in a format that can be used by the C pre-processor.
196
+ *
197
+ * Since: 2.36
198
+ */
199
+ #define GDK_PIXBUF_VERSION_2_28 (G_ENCODE_VERSION (2, 28))
200
+
201
+ /**
202
+ * GDK_PIXBUF_VERSION_2_30:
203
+ *
204
+ * A macro that evaluates to the 2.30 version of GdkPixbuf,
205
+ * in a format that can be used by the C pre-processor.
206
+ *
207
+ * Since: 2.36
208
+ */
209
+ #define GDK_PIXBUF_VERSION_2_30 (G_ENCODE_VERSION (2, 30))
210
+
211
+ /**
212
+ * GDK_PIXBUF_VERSION_2_32:
213
+ *
214
+ * A macro that evaluates to the 2.32 version of GdkPixbuf,
215
+ * in a format that can be used by the C pre-processor.
216
+ *
217
+ * Since: 2.36
218
+ */
219
+ #define GDK_PIXBUF_VERSION_2_32 (G_ENCODE_VERSION (2, 32))
220
+
221
+ /**
222
+ * GDK_PIXBUF_VERSION_2_34:
223
+ *
224
+ * A macro that evaluates to the 2.34 version of GdkPixbuf,
225
+ * in a format that can be used by the C pre-processor.
226
+ *
227
+ * Since: 2.36
228
+ */
229
+ #define GDK_PIXBUF_VERSION_2_34 (G_ENCODE_VERSION (2, 34))
230
+
231
+ /**
232
+ * GDK_PIXBUF_VERSION_2_36:
233
+ *
234
+ * A macro that evaluates to the 2.36 version of GdkPixbuf,
235
+ * in a format that can be used by the C pre-processor.
236
+ *
237
+ * Since: 2.36
238
+ */
239
+ #define GDK_PIXBUF_VERSION_2_36 (G_ENCODE_VERSION (2, 36))
240
+
241
+ /**
242
+ * GDK_PIXBUF_VERSION_2_38:
243
+ *
244
+ * A macro that evaluates to the 2.38 version of GdkPixbuf,
245
+ * in a format that can be used by the C pre-processor.
246
+ *
247
+ * Since: 2.38
248
+ */
249
+ #define GDK_PIXBUF_VERSION_2_38 (G_ENCODE_VERSION (2, 38))
250
+
251
+ /**
252
+ * GDK_PIXBUF_VERSION_2_40:
253
+ *
254
+ * A macro that evaluates to the 2.40 version of GdkPixbuf,
255
+ * in a format that can be used by the C pre-processor.
256
+ *
257
+ * Since: 2.40
258
+ */
259
+ #define GDK_PIXBUF_VERSION_2_40 (G_ENCODE_VERSION (2, 40))
260
+
261
+ #ifndef __GTK_DOC_IGNORE__
262
+ #if (GDK_PIXBUF_MINOR % 2)
263
+ #define GDK_PIXBUF_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_PIXBUF_MAJOR, GDK_PIXBUF_MINOR + 1))
264
+ #else
265
+ #define GDK_PIXBUF_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_PIXBUF_MAJOR, GDK_PIXBUF_MINOR))
266
+ #endif
267
+ #endif /* __GTK_DOC_IGNORE__ */
268
+
269
+ #ifndef __GTK_DOC_IGNORE__
270
+ #if (GDK_PIXBUF_MINOR % 2)
271
+ #define GDK_PIXBUF_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_PIXBUF_MAJOR, GDK_PIXBUF_MINOR - 1))
272
+ #else
273
+ #define GDK_PIXBUF_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_PIXBUF_MAJOR, GDK_PIXBUF_MINOR - 2))
274
+ #endif
275
+ #endif /* __GTK_DOC_IGNORE__ */
276
+
277
+ /**
278
+ * GDK_PIXBUF_VERSION_MIN_REQUIRED:
279
+ *
280
+ * A macro that should be defined by the user prior to including
281
+ * the gdk-pixbuf.h header.
282
+ * The definition should be one of the predefined version
283
+ * macros: %GDK_PIXBUF_VERSION_2_0, %GDK_PIXBUF_VERSION_2_2, ...
284
+ *
285
+ * This macro defines the lower bound for the GdkPixbuf API to use.
286
+ *
287
+ * If a function has been deprecated in a newer version of GdkPixbuf,
288
+ * defining this symbol hides the compiler warnings for those functions
289
+ * without disabling warnings for the other deprecated functions.
290
+ *
291
+ * <warning>
292
+ * Warning: if you define this macro, do not forget to update it! Especially
293
+ * when writing new code. Otherwise you can miss the new deprecations.
294
+ * </warning>
295
+ *
296
+ * Since: 2.36
297
+ */
298
+ #ifndef GDK_PIXBUF_VERSION_MIN_REQUIRED
299
+ #define GDK_PIXBUF_VERSION_MIN_REQUIRED (GDK_PIXBUF_VERSION_CUR_STABLE)
300
+ #endif
301
+
302
+ /**
303
+ * GDK_PIXBUF_VERSION_MAX_ALLOWED:
304
+ *
305
+ * A macro that should be defined by the user prior to including
306
+ * the gdk-pixbuf.h header.
307
+ * The definition should be one of the predefined version
308
+ * macros: %GDK_PIXBUF_VERSION_2_0, %GDK_PIXBUF_VERSION_2_2, ...
309
+ *
310
+ * This macro defines the upper bound for the GdkPixbuf API to use.
311
+ *
312
+ * If a function has been introduced in a newer version of GdkPixbuf,
313
+ * it is possible to use this symbol to get compiler warnings when
314
+ * trying to use that function.
315
+ *
316
+ * Since: 2.36
317
+ */
318
+ #ifndef GDK_PIXBUF_VERSION_MAX_ALLOWED
319
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED > GDK_PIXBUF_VERSION_PREV_STABLE
320
+ #define GDK_PIXBUF_VERSION_MAX_ALLOWED GDK_PIXBUF_VERSION_MIN_REQUIRED
321
+ #else
322
+ #define GDK_PIXBUF_VERSION_MAX_ALLOWED GDK_PIXBUF_VERSION_CUR_STABLE
323
+ #endif
324
+ #endif
325
+
326
+ /* sanity checks */
327
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_MIN_REQUIRED
328
+ #error "GDK_PIXBUF_VERSION_MAX_ALLOWED must be >= GDK_PIXBUF_VERSION_MIN_REQUIRED"
329
+ #endif
330
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED < GDK_PIXBUF_VERSION_2_0
331
+ #error "GDK_PIXBUF_VERSION_MIN_REQUIRED must be >= GDK_PIXBUF_VERSION_2_0"
332
+ #endif
333
+
334
+ #ifndef __GTK_DOC_IGNORE__
335
+ #define GDK_PIXBUF_AVAILABLE_IN_ALL _GDK_PIXBUF_EXTERN
336
+ #endif
337
+
338
+ /* Every new stable minor release should add a set of macros here */
339
+
340
+ #ifndef __GTK_DOC_IGNORE__
341
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_0
342
+ #define GDK_PIXBUF_DEPRECATED_IN_2_0 G_DEPRECATED _GDK_PIXBUF_EXTERN
343
+ #define GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
344
+ #else
345
+ #define GDK_PIXBUF_DEPRECATED_IN_2_0 _GDK_PIXBUF_EXTERN
346
+ #define GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(f) _GDK_PIXBUF_EXTERN
347
+ #endif
348
+ #endif /* __GTK_DOC_IGNORE__ */
349
+
350
+ #ifndef __GTK_DOC_IGNORE__
351
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_0
352
+ #define GDK_PIXBUF_AVAILABLE_IN_2_0 G_UNAVAILABLE(2, 0) _GDK_PIXBUF_EXTERN
353
+ #else
354
+ #define GDK_PIXBUF_AVAILABLE_IN_2_0 _GDK_PIXBUF_EXTERN
355
+ #endif
356
+ #endif /* __GTK_DOC_IGNORE__ */
357
+
358
+ #ifndef __GTK_DOC_IGNORE__
359
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_2
360
+ #define GDK_PIXBUF_DEPRECATED_IN_2_2 G_DEPRECATED _GDK_PIXBUF_EXTERN
361
+ #define GDK_PIXBUF_DEPRECATED_IN_2_2_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
362
+ #else
363
+ #define GDK_PIXBUF_DEPRECATED_IN_2_2 _GDK_PIXBUF_EXTERN
364
+ #define GDK_PIXBUF_DEPRECATED_IN_2_2_FOR(f) _GDK_PIXBUF_EXTERN
365
+ #endif
366
+ #endif /* __GTK_DOC_IGNORE__ */
367
+
368
+ #ifndef __GTK_DOC_IGNORE__
369
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_2
370
+ #define GDK_PIXBUF_AVAILABLE_IN_2_2 G_UNAVAILABLE(2, 2) _GDK_PIXBUF_EXTERN
371
+ #else
372
+ #define GDK_PIXBUF_AVAILABLE_IN_2_2 _GDK_PIXBUF_EXTERN
373
+ #endif
374
+ #endif /* __GTK_DOC_IGNORE__ */
375
+
376
+ #ifndef __GTK_DOC_IGNORE__
377
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_4
378
+ #define GDK_PIXBUF_DEPRECATED_IN_2_4 G_DEPRECATED _GDK_PIXBUF_EXTERN
379
+ #define GDK_PIXBUF_DEPRECATED_IN_2_4_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
380
+ #else
381
+ #define GDK_PIXBUF_DEPRECATED_IN_2_4 _GDK_PIXBUF_EXTERN
382
+ #define GDK_PIXBUF_DEPRECATED_IN_2_4_FOR(f) _GDK_PIXBUF_EXTERN
383
+ #endif
384
+ #endif /* __GTK_DOC_IGNORE__ */
385
+
386
+ #ifndef __GTK_DOC_IGNORE__
387
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_4
388
+ #define GDK_PIXBUF_AVAILABLE_IN_2_4 G_UNAVAILABLE(2, 4) _GDK_PIXBUF_EXTERN
389
+ #else
390
+ #define GDK_PIXBUF_AVAILABLE_IN_2_4 _GDK_PIXBUF_EXTERN
391
+ #endif
392
+ #endif /* __GTK_DOC_IGNORE__ */
393
+
394
+ #ifndef __GTK_DOC_IGNORE__
395
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_6
396
+ #define GDK_PIXBUF_DEPRECATED_IN_2_6 G_DEPRECATED _GDK_PIXBUF_EXTERN
397
+ #define GDK_PIXBUF_DEPRECATED_IN_2_6_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
398
+ #else
399
+ #define GDK_PIXBUF_DEPRECATED_IN_2_6 _GDK_PIXBUF_EXTERN
400
+ #define GDK_PIXBUF_DEPRECATED_IN_2_6_FOR(f) _GDK_PIXBUF_EXTERN
401
+ #endif
402
+ #endif /* __GTK_DOC_IGNORE__ */
403
+
404
+ #ifndef __GTK_DOC_IGNORE__
405
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_6
406
+ #define GDK_PIXBUF_AVAILABLE_IN_2_6 G_UNAVAILABLE(2, 6) _GDK_PIXBUF_EXTERN
407
+ #else
408
+ #define GDK_PIXBUF_AVAILABLE_IN_2_6 _GDK_PIXBUF_EXTERN
409
+ #endif
410
+ #endif /* __GTK_DOC_IGNORE__ */
411
+
412
+ #ifndef __GTK_DOC_IGNORE__
413
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_8
414
+ #define GDK_PIXBUF_DEPRECATED_IN_2_8 G_DEPRECATED _GDK_PIXBUF_EXTERN
415
+ #define GDK_PIXBUF_DEPRECATED_IN_2_8_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
416
+ #else
417
+ #define GDK_PIXBUF_DEPRECATED_IN_2_8 _GDK_PIXBUF_EXTERN
418
+ #define GDK_PIXBUF_DEPRECATED_IN_2_8_FOR(f) _GDK_PIXBUF_EXTERN
419
+ #endif
420
+ #endif /* __GTK_DOC_IGNORE__ */
421
+
422
+ #ifndef __GTK_DOC_IGNORE__
423
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_8
424
+ #define GDK_PIXBUF_AVAILABLE_IN_2_8 G_UNAVAILABLE(2, 8) _GDK_PIXBUF_EXTERN
425
+ #else
426
+ #define GDK_PIXBUF_AVAILABLE_IN_2_8 _GDK_PIXBUF_EXTERN
427
+ #endif
428
+ #endif /* __GTK_DOC_IGNORE__ */
429
+
430
+ #ifndef __GTK_DOC_IGNORE__
431
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_10
432
+ #define GDK_PIXBUF_DEPRECATED_IN_2_10 G_DEPRECATED _GDK_PIXBUF_EXTERN
433
+ #define GDK_PIXBUF_DEPRECATED_IN_2_10_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
434
+ #else
435
+ #define GDK_PIXBUF_DEPRECATED_IN_2_10 _GDK_PIXBUF_EXTERN
436
+ #define GDK_PIXBUF_DEPRECATED_IN_2_10_FOR(f) _GDK_PIXBUF_EXTERN
437
+ #endif
438
+ #endif /* __GTK_DOC_IGNORE__ */
439
+
440
+ #ifndef __GTK_DOC_IGNORE__
441
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_10
442
+ #define GDK_PIXBUF_AVAILABLE_IN_2_10 G_UNAVAILABLE(2, 10) _GDK_PIXBUF_EXTERN
443
+ #else
444
+ #define GDK_PIXBUF_AVAILABLE_IN_2_10 _GDK_PIXBUF_EXTERN
445
+ #endif
446
+ #endif /* __GTK_DOC_IGNORE__ */
447
+
448
+ #ifndef __GTK_DOC_IGNORE__
449
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_12
450
+ #define GDK_PIXBUF_DEPRECATED_IN_2_12 G_DEPRECATED _GDK_PIXBUF_EXTERN
451
+ #define GDK_PIXBUF_DEPRECATED_IN_2_12_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
452
+ #else
453
+ #define GDK_PIXBUF_DEPRECATED_IN_2_12 _GDK_PIXBUF_EXTERN
454
+ #define GDK_PIXBUF_DEPRECATED_IN_2_12_FOR(f) _GDK_PIXBUF_EXTERN
455
+ #endif
456
+ #endif /* __GTK_DOC_IGNORE__ */
457
+
458
+ #ifndef __GTK_DOC_IGNORE__
459
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_12
460
+ #define GDK_PIXBUF_AVAILABLE_IN_2_12 G_UNAVAILABLE(2, 12) _GDK_PIXBUF_EXTERN
461
+ #else
462
+ #define GDK_PIXBUF_AVAILABLE_IN_2_12 _GDK_PIXBUF_EXTERN
463
+ #endif
464
+ #endif /* __GTK_DOC_IGNORE__ */
465
+
466
+ #ifndef __GTK_DOC_IGNORE__
467
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_14
468
+ #define GDK_PIXBUF_DEPRECATED_IN_2_14 G_DEPRECATED _GDK_PIXBUF_EXTERN
469
+ #define GDK_PIXBUF_DEPRECATED_IN_2_14_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
470
+ #else
471
+ #define GDK_PIXBUF_DEPRECATED_IN_2_14 _GDK_PIXBUF_EXTERN
472
+ #define GDK_PIXBUF_DEPRECATED_IN_2_14_FOR(f) _GDK_PIXBUF_EXTERN
473
+ #endif
474
+ #endif /* __GTK_DOC_IGNORE__ */
475
+
476
+ #ifndef __GTK_DOC_IGNORE__
477
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_14
478
+ #define GDK_PIXBUF_AVAILABLE_IN_2_14 G_UNAVAILABLE(2, 14) _GDK_PIXBUF_EXTERN
479
+ #else
480
+ #define GDK_PIXBUF_AVAILABLE_IN_2_14 _GDK_PIXBUF_EXTERN
481
+ #endif
482
+ #endif /* __GTK_DOC_IGNORE__ */
483
+
484
+ #ifndef __GTK_DOC_IGNORE__
485
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_16
486
+ #define GDK_PIXBUF_DEPRECATED_IN_2_16 G_DEPRECATED _GDK_PIXBUF_EXTERN
487
+ #define GDK_PIXBUF_DEPRECATED_IN_2_16_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
488
+ #else
489
+ #define GDK_PIXBUF_DEPRECATED_IN_2_16 _GDK_PIXBUF_EXTERN
490
+ #define GDK_PIXBUF_DEPRECATED_IN_2_16_FOR(f) _GDK_PIXBUF_EXTERN
491
+ #endif
492
+ #endif /* __GTK_DOC_IGNORE__ */
493
+
494
+ #ifndef __GTK_DOC_IGNORE__
495
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_16
496
+ #define GDK_PIXBUF_AVAILABLE_IN_2_16 G_UNAVAILABLE(2, 16) _GDK_PIXBUF_EXTERN
497
+ #else
498
+ #define GDK_PIXBUF_AVAILABLE_IN_2_16 _GDK_PIXBUF_EXTERN
499
+ #endif
500
+ #endif /* __GTK_DOC_IGNORE__ */
501
+
502
+ #ifndef __GTK_DOC_IGNORE__
503
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_18
504
+ #define GDK_PIXBUF_DEPRECATED_IN_2_18 G_DEPRECATED _GDK_PIXBUF_EXTERN
505
+ #define GDK_PIXBUF_DEPRECATED_IN_2_18_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
506
+ #else
507
+ #define GDK_PIXBUF_DEPRECATED_IN_2_18 _GDK_PIXBUF_EXTERN
508
+ #define GDK_PIXBUF_DEPRECATED_IN_2_18_FOR(f) _GDK_PIXBUF_EXTERN
509
+ #endif
510
+ #endif /* __GTK_DOC_IGNORE__ */
511
+
512
+ #ifndef __GTK_DOC_IGNORE__
513
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_18
514
+ #define GDK_PIXBUF_AVAILABLE_IN_2_18 G_UNAVAILABLE(2, 18) _GDK_PIXBUF_EXTERN
515
+ #else
516
+ #define GDK_PIXBUF_AVAILABLE_IN_2_18 _GDK_PIXBUF_EXTERN
517
+ #endif
518
+ #endif /* __GTK_DOC_IGNORE__ */
519
+
520
+ #ifndef __GTK_DOC_IGNORE__
521
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_20
522
+ #define GDK_PIXBUF_DEPRECATED_IN_2_20 G_DEPRECATED _GDK_PIXBUF_EXTERN
523
+ #define GDK_PIXBUF_DEPRECATED_IN_2_20_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
524
+ #else
525
+ #define GDK_PIXBUF_DEPRECATED_IN_2_20 _GDK_PIXBUF_EXTERN
526
+ #define GDK_PIXBUF_DEPRECATED_IN_2_20_FOR(f) _GDK_PIXBUF_EXTERN
527
+ #endif
528
+ #endif /* __GTK_DOC_IGNORE__ */
529
+
530
+ #ifndef __GTK_DOC_IGNORE__
531
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_20
532
+ #define GDK_PIXBUF_AVAILABLE_IN_2_20 G_UNAVAILABLE(2, 20) _GDK_PIXBUF_EXTERN
533
+ #else
534
+ #define GDK_PIXBUF_AVAILABLE_IN_2_20 _GDK_PIXBUF_EXTERN
535
+ #endif
536
+ #endif /* __GTK_DOC_IGNORE__ */
537
+
538
+ #ifndef __GTK_DOC_IGNORE__
539
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_22
540
+ #define GDK_PIXBUF_DEPRECATED_IN_2_22 G_DEPRECATED _GDK_PIXBUF_EXTERN
541
+ #define GDK_PIXBUF_DEPRECATED_IN_2_22_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
542
+ #else
543
+ #define GDK_PIXBUF_DEPRECATED_IN_2_22 _GDK_PIXBUF_EXTERN
544
+ #define GDK_PIXBUF_DEPRECATED_IN_2_22_FOR(f) _GDK_PIXBUF_EXTERN
545
+ #endif
546
+ #endif /* __GTK_DOC_IGNORE__ */
547
+
548
+ #ifndef __GTK_DOC_IGNORE__
549
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_22
550
+ #define GDK_PIXBUF_AVAILABLE_IN_2_22 G_UNAVAILABLE(2, 22) _GDK_PIXBUF_EXTERN
551
+ #else
552
+ #define GDK_PIXBUF_AVAILABLE_IN_2_22 _GDK_PIXBUF_EXTERN
553
+ #endif
554
+ #endif /* __GTK_DOC_IGNORE__ */
555
+
556
+ #ifndef __GTK_DOC_IGNORE__
557
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_24
558
+ #define GDK_PIXBUF_DEPRECATED_IN_2_24 G_DEPRECATED _GDK_PIXBUF_EXTERN
559
+ #define GDK_PIXBUF_DEPRECATED_IN_2_24_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
560
+ #else
561
+ #define GDK_PIXBUF_DEPRECATED_IN_2_24 _GDK_PIXBUF_EXTERN
562
+ #define GDK_PIXBUF_DEPRECATED_IN_2_24_FOR(f) _GDK_PIXBUF_EXTERN
563
+ #endif
564
+ #endif /* __GTK_DOC_IGNORE__ */
565
+
566
+ #ifndef __GTK_DOC_IGNORE__
567
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_24
568
+ #define GDK_PIXBUF_AVAILABLE_IN_2_24 G_UNAVAILABLE(2, 24) _GDK_PIXBUF_EXTERN
569
+ #else
570
+ #define GDK_PIXBUF_AVAILABLE_IN_2_24 _GDK_PIXBUF_EXTERN
571
+ #endif
572
+ #endif /* __GTK_DOC_IGNORE__ */
573
+
574
+ #ifndef __GTK_DOC_IGNORE__
575
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_26
576
+ #define GDK_PIXBUF_DEPRECATED_IN_2_26 G_DEPRECATED _GDK_PIXBUF_EXTERN
577
+ #define GDK_PIXBUF_DEPRECATED_IN_2_26_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
578
+ #else
579
+ #define GDK_PIXBUF_DEPRECATED_IN_2_26 _GDK_PIXBUF_EXTERN
580
+ #define GDK_PIXBUF_DEPRECATED_IN_2_26_FOR(f) _GDK_PIXBUF_EXTERN
581
+ #endif
582
+ #endif /* __GTK_DOC_IGNORE__ */
583
+
584
+ #ifndef __GTK_DOC_IGNORE__
585
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_26
586
+ #define GDK_PIXBUF_AVAILABLE_IN_2_26 G_UNAVAILABLE(2, 26) _GDK_PIXBUF_EXTERN
587
+ #else
588
+ #define GDK_PIXBUF_AVAILABLE_IN_2_26 _GDK_PIXBUF_EXTERN
589
+ #endif
590
+ #endif /* __GTK_DOC_IGNORE__ */
591
+
592
+ #ifndef __GTK_DOC_IGNORE__
593
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_28
594
+ #define GDK_PIXBUF_DEPRECATED_IN_2_28 G_DEPRECATED _GDK_PIXBUF_EXTERN
595
+ #define GDK_PIXBUF_DEPRECATED_IN_2_28_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
596
+ #else
597
+ #define GDK_PIXBUF_DEPRECATED_IN_2_28 _GDK_PIXBUF_EXTERN
598
+ #define GDK_PIXBUF_DEPRECATED_IN_2_28_FOR(f) _GDK_PIXBUF_EXTERN
599
+ #endif
600
+ #endif /* __GTK_DOC_IGNORE__ */
601
+
602
+ #ifndef __GTK_DOC_IGNORE__
603
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_28
604
+ #define GDK_PIXBUF_AVAILABLE_IN_2_28 G_UNAVAILABLE(2, 28) _GDK_PIXBUF_EXTERN
605
+ #else
606
+ #define GDK_PIXBUF_AVAILABLE_IN_2_28 _GDK_PIXBUF_EXTERN
607
+ #endif
608
+ #endif /* __GTK_DOC_IGNORE__ */
609
+
610
+ #ifndef __GTK_DOC_IGNORE__
611
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_30
612
+ #define GDK_PIXBUF_DEPRECATED_IN_2_30 G_DEPRECATED _GDK_PIXBUF_EXTERN
613
+ #define GDK_PIXBUF_DEPRECATED_IN_2_30_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
614
+ #else
615
+ #define GDK_PIXBUF_DEPRECATED_IN_2_30 _GDK_PIXBUF_EXTERN
616
+ #define GDK_PIXBUF_DEPRECATED_IN_2_30_FOR(f) _GDK_PIXBUF_EXTERN
617
+ #endif
618
+ #endif /* __GTK_DOC_IGNORE__ */
619
+
620
+ #ifndef __GTK_DOC_IGNORE__
621
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_30
622
+ #define GDK_PIXBUF_AVAILABLE_IN_2_30 G_UNAVAILABLE(2, 30) _GDK_PIXBUF_EXTERN
623
+ #else
624
+ #define GDK_PIXBUF_AVAILABLE_IN_2_30 _GDK_PIXBUF_EXTERN
625
+ #endif
626
+ #endif /* __GTK_DOC_IGNORE__ */
627
+
628
+ #ifndef __GTK_DOC_IGNORE__
629
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_32
630
+ #define GDK_PIXBUF_DEPRECATED_IN_2_32 G_DEPRECATED _GDK_PIXBUF_EXTERN
631
+ #define GDK_PIXBUF_DEPRECATED_IN_2_32_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
632
+ #else
633
+ #define GDK_PIXBUF_DEPRECATED_IN_2_32 _GDK_PIXBUF_EXTERN
634
+ #define GDK_PIXBUF_DEPRECATED_IN_2_32_FOR(f) _GDK_PIXBUF_EXTERN
635
+ #endif
636
+ #endif /* __GTK_DOC_IGNORE__ */
637
+
638
+ #ifndef __GTK_DOC_IGNORE__
639
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_32
640
+ #define GDK_PIXBUF_AVAILABLE_IN_2_32 G_UNAVAILABLE(2, 32) _GDK_PIXBUF_EXTERN
641
+ #else
642
+ #define GDK_PIXBUF_AVAILABLE_IN_2_32 _GDK_PIXBUF_EXTERN
643
+ #endif
644
+ #endif /* __GTK_DOC_IGNORE__ */
645
+
646
+ #ifndef __GTK_DOC_IGNORE__
647
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_34
648
+ #define GDK_PIXBUF_DEPRECATED_IN_2_34 G_DEPRECATED _GDK_PIXBUF_EXTERN
649
+ #define GDK_PIXBUF_DEPRECATED_IN_2_34_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
650
+ #else
651
+ #define GDK_PIXBUF_DEPRECATED_IN_2_34 _GDK_PIXBUF_EXTERN
652
+ #define GDK_PIXBUF_DEPRECATED_IN_2_34_FOR(f) _GDK_PIXBUF_EXTERN
653
+ #endif
654
+ #endif /* __GTK_DOC_IGNORE__ */
655
+
656
+ #ifndef __GTK_DOC_IGNORE__
657
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_34
658
+ #define GDK_PIXBUF_AVAILABLE_IN_2_34 G_UNAVAILABLE(2, 34) _GDK_PIXBUF_EXTERN
659
+ #else
660
+ #define GDK_PIXBUF_AVAILABLE_IN_2_34 _GDK_PIXBUF_EXTERN
661
+ #endif
662
+ #endif /* __GTK_DOC_IGNORE__ */
663
+
664
+ #ifndef __GTK_DOC_IGNORE__
665
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_36
666
+ #define GDK_PIXBUF_DEPRECATED_IN_2_36 G_DEPRECATED _GDK_PIXBUF_EXTERN
667
+ #define GDK_PIXBUF_DEPRECATED_IN_2_36_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
668
+ #else
669
+ #define GDK_PIXBUF_DEPRECATED_IN_2_36 _GDK_PIXBUF_EXTERN
670
+ #define GDK_PIXBUF_DEPRECATED_IN_2_36_FOR(f) _GDK_PIXBUF_EXTERN
671
+ #endif
672
+ #endif /* __GTK_DOC_IGNORE__ */
673
+
674
+ #ifndef __GTK_DOC_IGNORE__
675
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_36
676
+ #define GDK_PIXBUF_AVAILABLE_IN_2_36 G_UNAVAILABLE(2, 36) _GDK_PIXBUF_EXTERN
677
+ #else
678
+ #define GDK_PIXBUF_AVAILABLE_IN_2_36 _GDK_PIXBUF_EXTERN
679
+ #endif
680
+ #endif /* __GTK_DOC_IGNORE__ */
681
+
682
+ #ifndef __GTK_DOC_IGNORE__
683
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_38
684
+ #define GDK_PIXBUF_DEPRECATED_IN_2_38 G_DEPRECATED _GDK_PIXBUF_EXTERN
685
+ #define GDK_PIXBUF_DEPRECATED_IN_2_38_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
686
+ #else
687
+ #define GDK_PIXBUF_DEPRECATED_IN_2_38 _GDK_PIXBUF_EXTERN
688
+ #define GDK_PIXBUF_DEPRECATED_IN_2_38_FOR(f) _GDK_PIXBUF_EXTERN
689
+ #endif
690
+ #endif /* __GTK_DOC_IGNORE__ */
691
+
692
+ #ifndef __GTK_DOC_IGNORE__
693
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_38
694
+ #define GDK_PIXBUF_AVAILABLE_IN_2_38 G_UNAVAILABLE(2, 38) _GDK_PIXBUF_EXTERN
695
+ #else
696
+ #define GDK_PIXBUF_AVAILABLE_IN_2_38 _GDK_PIXBUF_EXTERN
697
+ #endif
698
+ #endif /* __GTK_DOC_IGNORE__ */
699
+
700
+ #ifndef __GTK_DOC_IGNORE__
701
+ #if GDK_PIXBUF_VERSION_MIN_REQUIRED >= GDK_PIXBUF_VERSION_2_40
702
+ #define GDK_PIXBUF_DEPRECATED_IN_2_40 G_DEPRECATED _GDK_PIXBUF_EXTERN
703
+ #define GDK_PIXBUF_DEPRECATED_IN_2_40_FOR(f) G_DEPRECATED_FOR(f) _GDK_PIXBUF_EXTERN
704
+ #else
705
+ #define GDK_PIXBUF_DEPRECATED_IN_2_40 _GDK_PIXBUF_EXTERN
706
+ #define GDK_PIXBUF_DEPRECATED_IN_2_40_FOR(f) _GDK_PIXBUF_EXTERN
707
+ #endif
708
+ #endif /* __GTK_DOC_IGNORE__ */
709
+
710
+ #ifndef __GTK_DOC_IGNORE__
711
+ #if GDK_PIXBUF_VERSION_MAX_ALLOWED < GDK_PIXBUF_VERSION_2_40
712
+ #define GDK_PIXBUF_AVAILABLE_IN_2_40 G_UNAVAILABLE(2, 40) _GDK_PIXBUF_EXTERN
713
+ #else
714
+ #define GDK_PIXBUF_AVAILABLE_IN_2_40 _GDK_PIXBUF_EXTERN
715
+ #endif
716
+ #endif /* __GTK_DOC_IGNORE__ */
717
+
718
+ #endif /* GDK_PIXBUF_MACROS_H */
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-marshal.h ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* This file is generated by glib-genmarshal, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
2
+ #pragma once
3
+
4
+ #include <glib-object.h>
5
+
6
+ G_BEGIN_DECLS
7
+
8
+ /* VOID:VOID (../gdk-pixbuf/gdk-pixbuf-marshal.list:25) */
9
+ #define _gdk_pixbuf_marshal_VOID__VOID g_cclosure_marshal_VOID__VOID
10
+
11
+ /* VOID:INT,INT (../gdk-pixbuf/gdk-pixbuf-marshal.list:26) */
12
+ extern
13
+ void _gdk_pixbuf_marshal_VOID__INT_INT (GClosure *closure,
14
+ GValue *return_value,
15
+ guint n_param_values,
16
+ const GValue *param_values,
17
+ gpointer invocation_hint,
18
+ gpointer marshal_data);
19
+
20
+ /* VOID:INT,INT,INT,INT (../gdk-pixbuf/gdk-pixbuf-marshal.list:27) */
21
+ extern
22
+ void _gdk_pixbuf_marshal_VOID__INT_INT_INT_INT (GClosure *closure,
23
+ GValue *return_value,
24
+ guint n_param_values,
25
+ const GValue *param_values,
26
+ gpointer invocation_hint,
27
+ gpointer marshal_data);
28
+
29
+ /* VOID:POINTER (../gdk-pixbuf/gdk-pixbuf-marshal.list:28) */
30
+ #define _gdk_pixbuf_marshal_VOID__POINTER g_cclosure_marshal_VOID__POINTER
31
+
32
+
33
+ G_END_DECLS
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-simple-anim.h ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2
+ /* GdkPixbuf library - Simple frame-based animations
3
+ *
4
+ * Copyright (C) 2004 Dom Lachowicz
5
+ *
6
+ * Authors: Dom Lachowicz <cinamod@hotmail.com>
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+
22
+ #ifndef GDK_PIXBUF_SIMPLE_ANIM_H
23
+ #define GDK_PIXBUF_SIMPLE_ANIM_H
24
+
25
+ #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
26
+ #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
27
+ #endif
28
+
29
+ #include <gdk-pixbuf/gdk-pixbuf-animation.h>
30
+
31
+ G_BEGIN_DECLS
32
+
33
+ /**
34
+ * GdkPixbufSimpleAnim:
35
+ *
36
+ * An opaque struct representing a simple animation.
37
+ */
38
+ typedef struct _GdkPixbufSimpleAnim GdkPixbufSimpleAnim;
39
+ typedef struct _GdkPixbufSimpleAnimClass GdkPixbufSimpleAnimClass;
40
+
41
+ #define GDK_TYPE_PIXBUF_SIMPLE_ANIM (gdk_pixbuf_simple_anim_get_type ())
42
+ #define GDK_PIXBUF_SIMPLE_ANIM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_SIMPLE_ANIM, GdkPixbufSimpleAnim))
43
+ #define GDK_IS_PIXBUF_SIMPLE_ANIM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_SIMPLE_ANIM))
44
+
45
+ #define GDK_PIXBUF_SIMPLE_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_SIMPLE_ANIM, GdkPixbufSimpleAnimClass))
46
+ #define GDK_IS_PIXBUF_SIMPLE_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_SIMPLE_ANIM))
47
+ #define GDK_PIXBUF_SIMPLE_ANIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_SIMPLE_ANIM, GdkPixbufSimpleAnimClass))
48
+
49
+ GDK_PIXBUF_AVAILABLE_IN_ALL
50
+ GType gdk_pixbuf_simple_anim_get_type (void) G_GNUC_CONST;
51
+ GDK_PIXBUF_AVAILABLE_IN_ALL
52
+ GType gdk_pixbuf_simple_anim_iter_get_type (void) G_GNUC_CONST;
53
+
54
+ GDK_PIXBUF_AVAILABLE_IN_2_8
55
+ GdkPixbufSimpleAnim *gdk_pixbuf_simple_anim_new (gint width,
56
+ gint height,
57
+ gfloat rate);
58
+ GDK_PIXBUF_AVAILABLE_IN_2_8
59
+ void gdk_pixbuf_simple_anim_add_frame (GdkPixbufSimpleAnim *animation,
60
+ GdkPixbuf *pixbuf);
61
+ GDK_PIXBUF_AVAILABLE_IN_ALL
62
+ void gdk_pixbuf_simple_anim_set_loop (GdkPixbufSimpleAnim *animation,
63
+ gboolean loop);
64
+ GDK_PIXBUF_AVAILABLE_IN_ALL
65
+ gboolean gdk_pixbuf_simple_anim_get_loop (GdkPixbufSimpleAnim *animation);
66
+
67
+ G_END_DECLS
68
+
69
+
70
+ #endif /* GDK_PIXBUF_SIMPLE_ANIM_H */
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-transform.h ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GdkPixbuf library - transformations
2
+ *
3
+ * Copyright (C) 2003 The Free Software Foundation
4
+ *
5
+ * Authors: Mark Crichton <crichton@gimp.org>
6
+ * Miguel de Icaza <miguel@gnu.org>
7
+ * Federico Mena-Quintero <federico@gimp.org>
8
+ * Havoc Pennington <hp@redhat.com>
9
+ *
10
+ * This library is free software; you can redistribute it and/or
11
+ * modify it under the terms of the GNU Lesser General Public
12
+ * License as published by the Free Software Foundation; either
13
+ * version 2 of the License, or (at your option) any later version.
14
+ *
15
+ * This library is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ * Lesser General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU Lesser General Public
21
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
22
+ */
23
+
24
+ #ifndef GDK_PIXBUF_TRANSFORM_H
25
+ #define GDK_PIXBUF_TRANSFORM_H
26
+
27
+ #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
28
+ #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
29
+ #endif
30
+
31
+ #include <glib.h>
32
+ #include <gdk-pixbuf/gdk-pixbuf-core.h>
33
+
34
+
35
+ G_BEGIN_DECLS
36
+
37
+ /* Scaling */
38
+
39
+ /**
40
+ * GdkInterpType:
41
+ * @GDK_INTERP_NEAREST: Nearest neighbor sampling; this is the fastest
42
+ * and lowest quality mode. Quality is normally unacceptable when scaling
43
+ * down, but may be OK when scaling up.
44
+ * @GDK_INTERP_TILES: This is an accurate simulation of the PostScript
45
+ * image operator without any interpolation enabled. Each pixel is
46
+ * rendered as a tiny parallelogram of solid color, the edges of which
47
+ * are implemented with antialiasing. It resembles nearest neighbor for
48
+ * enlargement, and bilinear for reduction.
49
+ * @GDK_INTERP_BILINEAR: Best quality/speed balance; use this mode by
50
+ * default. Bilinear interpolation. For enlargement, it is
51
+ * equivalent to point-sampling the ideal bilinear-interpolated image.
52
+ * For reduction, it is equivalent to laying down small tiles and
53
+ * integrating over the coverage area.
54
+ * @GDK_INTERP_HYPER: This is the slowest and highest quality
55
+ * reconstruction function. It is derived from the hyperbolic filters in
56
+ * Wolberg's "Digital Image Warping", and is formally defined as the
57
+ * hyperbolic-filter sampling the ideal hyperbolic-filter interpolated
58
+ * image (the filter is designed to be idempotent for 1:1 pixel mapping).
59
+ * **Deprecated**: this interpolation filter is deprecated, as in reality
60
+ * it has a lower quality than the @GDK_INTERP_BILINEAR filter
61
+ * (Since: 2.38)
62
+ *
63
+ * Interpolation modes for scaling functions.
64
+ *
65
+ * The `GDK_INTERP_NEAREST` mode is the fastest scaling method, but has
66
+ * horrible quality when scaling down; `GDK_INTERP_BILINEAR` is the best
67
+ * choice if you aren't sure what to choose, it has a good speed/quality
68
+ * balance.
69
+ *
70
+ * **Note**: Cubic filtering is missing from the list; hyperbolic
71
+ * interpolation is just as fast and results in higher quality.
72
+ */
73
+ typedef enum {
74
+ GDK_INTERP_NEAREST,
75
+ GDK_INTERP_TILES,
76
+ GDK_INTERP_BILINEAR,
77
+ GDK_INTERP_HYPER
78
+ } GdkInterpType;
79
+
80
+ /**
81
+ * GdkPixbufRotation:
82
+ * @GDK_PIXBUF_ROTATE_NONE: No rotation.
83
+ * @GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE: Rotate by 90 degrees.
84
+ * @GDK_PIXBUF_ROTATE_UPSIDEDOWN: Rotate by 180 degrees.
85
+ * @GDK_PIXBUF_ROTATE_CLOCKWISE: Rotate by 270 degrees.
86
+ *
87
+ * The possible rotations which can be passed to gdk_pixbuf_rotate_simple().
88
+ *
89
+ * To make them easier to use, their numerical values are the actual degrees.
90
+ */
91
+ typedef enum {
92
+ GDK_PIXBUF_ROTATE_NONE = 0,
93
+ GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE = 90,
94
+ GDK_PIXBUF_ROTATE_UPSIDEDOWN = 180,
95
+ GDK_PIXBUF_ROTATE_CLOCKWISE = 270
96
+ } GdkPixbufRotation;
97
+
98
+ GDK_PIXBUF_AVAILABLE_IN_ALL
99
+ void gdk_pixbuf_scale (const GdkPixbuf *src,
100
+ GdkPixbuf *dest,
101
+ int dest_x,
102
+ int dest_y,
103
+ int dest_width,
104
+ int dest_height,
105
+ double offset_x,
106
+ double offset_y,
107
+ double scale_x,
108
+ double scale_y,
109
+ GdkInterpType interp_type);
110
+ GDK_PIXBUF_AVAILABLE_IN_ALL
111
+ void gdk_pixbuf_composite (const GdkPixbuf *src,
112
+ GdkPixbuf *dest,
113
+ int dest_x,
114
+ int dest_y,
115
+ int dest_width,
116
+ int dest_height,
117
+ double offset_x,
118
+ double offset_y,
119
+ double scale_x,
120
+ double scale_y,
121
+ GdkInterpType interp_type,
122
+ int overall_alpha);
123
+ GDK_PIXBUF_AVAILABLE_IN_ALL
124
+ void gdk_pixbuf_composite_color (const GdkPixbuf *src,
125
+ GdkPixbuf *dest,
126
+ int dest_x,
127
+ int dest_y,
128
+ int dest_width,
129
+ int dest_height,
130
+ double offset_x,
131
+ double offset_y,
132
+ double scale_x,
133
+ double scale_y,
134
+ GdkInterpType interp_type,
135
+ int overall_alpha,
136
+ int check_x,
137
+ int check_y,
138
+ int check_size,
139
+ guint32 color1,
140
+ guint32 color2);
141
+
142
+ GDK_PIXBUF_AVAILABLE_IN_ALL
143
+ GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
144
+ int dest_width,
145
+ int dest_height,
146
+ GdkInterpType interp_type);
147
+
148
+ GDK_PIXBUF_AVAILABLE_IN_ALL
149
+ GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
150
+ int dest_width,
151
+ int dest_height,
152
+ GdkInterpType interp_type,
153
+ int overall_alpha,
154
+ int check_size,
155
+ guint32 color1,
156
+ guint32 color2);
157
+
158
+ GDK_PIXBUF_AVAILABLE_IN_2_6
159
+ GdkPixbuf *gdk_pixbuf_rotate_simple (const GdkPixbuf *src,
160
+ GdkPixbufRotation angle);
161
+ GDK_PIXBUF_AVAILABLE_IN_2_6
162
+ GdkPixbuf *gdk_pixbuf_flip (const GdkPixbuf *src,
163
+ gboolean horizontal);
164
+
165
+ G_END_DECLS
166
+
167
+
168
+ #endif /* GDK_PIXBUF_TRANSFORM_H */
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf.h ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GdkPixbuf library - Main header file
2
+ *
3
+ * Copyright (C) 1999 The Free Software Foundation
4
+ *
5
+ * Authors: Mark Crichton <crichton@gimp.org>
6
+ * Miguel de Icaza <miguel@gnu.org>
7
+ * Federico Mena-Quintero <federico@gimp.org>
8
+ * Havoc Pennington <hp@redhat.com>
9
+ *
10
+ * This library is free software; you can redistribute it and/or
11
+ * modify it under the terms of the GNU Lesser General Public
12
+ * License as published by the Free Software Foundation; either
13
+ * version 2 of the License, or (at your option) any later version.
14
+ *
15
+ * This library is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ * Lesser General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU Lesser General Public
21
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
22
+ */
23
+
24
+ #ifndef GDK_PIXBUF_H
25
+ #define GDK_PIXBUF_H
26
+
27
+ #define GDK_PIXBUF_H_INSIDE
28
+
29
+ #include <glib.h>
30
+ #include <gdk-pixbuf/gdk-pixbuf-macros.h>
31
+ #include <gdk-pixbuf/gdk-pixbuf-features.h>
32
+ #include <glib-object.h>
33
+
34
+ #include <gdk-pixbuf/gdk-pixbuf-core.h>
35
+ #include <gdk-pixbuf/gdk-pixbuf-transform.h>
36
+ #include <gdk-pixbuf/gdk-pixbuf-animation.h>
37
+ #include <gdk-pixbuf/gdk-pixbuf-simple-anim.h>
38
+ #include <gdk-pixbuf/gdk-pixbuf-io.h>
39
+ #include <gdk-pixbuf/gdk-pixbuf-loader.h>
40
+ #include <gdk-pixbuf/gdk-pixbuf-enum-types.h>
41
+
42
+ #include <gdk-pixbuf/gdk-pixbuf-autocleanups.h>
43
+
44
+ #undef GDK_PIXBUF_H_INSIDE
45
+
46
+ #endif /* GDK_PIXBUF_H */
data/miniconda3/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixdata.h ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GdkPixbuf library - GdkPixdata - functions for inlined pixbuf handling
2
+ * Copyright (C) 1999, 2001 Tim Janik
3
+ *
4
+ * This library is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2 of the License, or (at your option) any later version.
8
+ *
9
+ * This 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 GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+ #ifndef __GDK_PIXDATA_H__
18
+ #define __GDK_PIXDATA_H__
19
+
20
+ #ifndef GDK_PIXBUF_DISABLE_DEPRECATED
21
+ #include <gdk-pixbuf/gdk-pixbuf.h>
22
+
23
+ G_BEGIN_DECLS
24
+
25
+ /**
26
+ * GDK_PIXBUF_MAGIC_NUMBER:
27
+ *
28
+ * Magic number for #GdkPixdata structures.
29
+ **/
30
+ #define GDK_PIXBUF_MAGIC_NUMBER (0x47646b50) /* 'GdkP' */
31
+
32
+ /**
33
+ * GdkPixdataType:
34
+ * @GDK_PIXDATA_COLOR_TYPE_RGB: each pixel has red, green and blue samples.
35
+ * @GDK_PIXDATA_COLOR_TYPE_RGBA: each pixel has red, green and blue samples
36
+ * and an alpha value.
37
+ * @GDK_PIXDATA_COLOR_TYPE_MASK: mask for the colortype flags of the enum.
38
+ * @GDK_PIXDATA_SAMPLE_WIDTH_8: each sample has 8 bits.
39
+ * @GDK_PIXDATA_SAMPLE_WIDTH_MASK: mask for the sample width flags of the enum.
40
+ * @GDK_PIXDATA_ENCODING_RAW: the pixel data is in raw form.
41
+ * @GDK_PIXDATA_ENCODING_RLE: the pixel data is run-length encoded. Runs may
42
+ * be up to 127 bytes long; their length is stored in a single byte
43
+ * preceding the pixel data for the run. If a run is constant, its length
44
+ * byte has the high bit set and the pixel data consists of a single pixel
45
+ * which must be repeated.
46
+ * @GDK_PIXDATA_ENCODING_MASK: mask for the encoding flags of the enum.
47
+ *
48
+ * An enumeration containing three sets of flags for a #GdkPixdata struct:
49
+ * one for the used colorspace, one for the width of the samples and one
50
+ * for the encoding of the pixel data.
51
+ *
52
+ * Deprecated: 2.32
53
+ **/
54
+ typedef enum
55
+ {
56
+ /* colorspace + alpha */
57
+ GDK_PIXDATA_COLOR_TYPE_RGB = 0x01,
58
+ GDK_PIXDATA_COLOR_TYPE_RGBA = 0x02,
59
+ GDK_PIXDATA_COLOR_TYPE_MASK = 0xff,
60
+ /* width, support 8bits only currently */
61
+ GDK_PIXDATA_SAMPLE_WIDTH_8 = 0x01 << 16,
62
+ GDK_PIXDATA_SAMPLE_WIDTH_MASK = 0x0f << 16,
63
+ /* encoding */
64
+ GDK_PIXDATA_ENCODING_RAW = 0x01 << 24,
65
+ GDK_PIXDATA_ENCODING_RLE = 0x02 << 24,
66
+ GDK_PIXDATA_ENCODING_MASK = 0x0f << 24
67
+ } GdkPixdataType;
68
+
69
+ typedef struct _GdkPixdata GdkPixdata;
70
+ struct _GdkPixdata
71
+ {
72
+ guint32 magic; /* GDK_PIXBUF_MAGIC_NUMBER */
73
+ gint32 length; /* <1 to disable length checks, otherwise:
74
+ * GDK_PIXDATA_HEADER_LENGTH + pixel_data length
75
+ */
76
+ guint32 pixdata_type; /* GdkPixdataType */
77
+ guint32 rowstride;
78
+ guint32 width;
79
+ guint32 height;
80
+ guint8 *pixel_data;
81
+ };
82
+
83
+ /**
84
+ * GDK_PIXDATA_HEADER_LENGTH:
85
+ *
86
+ * The length of a #GdkPixdata structure without the @pixel_data pointer.
87
+ *
88
+ * Deprecated: 2.32
89
+ **/
90
+ #define GDK_PIXDATA_HEADER_LENGTH (4 + 4 + 4 + 4 + 4 + 4)
91
+
92
+ /* the returned stream is plain htonl of GdkPixdata members + pixel_data */
93
+ GDK_PIXBUF_DEPRECATED_IN_2_32
94
+ guint8* gdk_pixdata_serialize (const GdkPixdata *pixdata,
95
+ guint *stream_length_p);
96
+ GDK_PIXBUF_DEPRECATED_IN_2_32
97
+ gboolean gdk_pixdata_deserialize (GdkPixdata *pixdata,
98
+ guint stream_length,
99
+ const guint8 *stream,
100
+ GError **error);
101
+ GDK_PIXBUF_DEPRECATED_IN_2_32
102
+ gpointer gdk_pixdata_from_pixbuf (GdkPixdata *pixdata,
103
+ const GdkPixbuf *pixbuf,
104
+ gboolean use_rle);
105
+ GDK_PIXBUF_DEPRECATED_IN_2_32
106
+ GdkPixbuf* gdk_pixbuf_from_pixdata (const GdkPixdata *pixdata,
107
+ gboolean copy_pixels,
108
+ GError **error);
109
+ /**
110
+ * GdkPixdataDumpType:
111
+ * @GDK_PIXDATA_DUMP_PIXDATA_STREAM: Generate pixbuf data stream (a single
112
+ * string containing a serialized #GdkPixdata structure in network byte
113
+ * order).
114
+ * @GDK_PIXDATA_DUMP_PIXDATA_STRUCT: Generate #GdkPixdata structure (needs
115
+ * the #GdkPixdata structure definition from gdk-pixdata.h).
116
+ * @GDK_PIXDATA_DUMP_MACROS: Generate <function>*_ROWSTRIDE</function>,
117
+ * <function>*_WIDTH</function>, <function>*_HEIGHT</function>,
118
+ * <function>*_BYTES_PER_PIXEL</function> and
119
+ * <function>*_RLE_PIXEL_DATA</function> or <function>*_PIXEL_DATA</function>
120
+ * macro definitions for the image.
121
+ * @GDK_PIXDATA_DUMP_GTYPES: Generate GLib data types instead of
122
+ * standard C data types.
123
+ * @GDK_PIXDATA_DUMP_CTYPES: Generate standard C data types instead of
124
+ * GLib data types.
125
+ * @GDK_PIXDATA_DUMP_STATIC: Generate static symbols.
126
+ * @GDK_PIXDATA_DUMP_CONST: Generate const symbols.
127
+ * @GDK_PIXDATA_DUMP_RLE_DECODER: Provide a <function>*_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp)</function>
128
+ * macro definition to decode run-length encoded image data.
129
+ *
130
+ * An enumeration which is used by gdk_pixdata_to_csource() to
131
+ * determine the form of C source to be generated. The three values
132
+ * @GDK_PIXDATA_DUMP_PIXDATA_STREAM, @GDK_PIXDATA_DUMP_PIXDATA_STRUCT
133
+ * and @GDK_PIXDATA_DUMP_MACROS are mutually exclusive, as are
134
+ * @GDK_PIXBUF_DUMP_GTYPES and @GDK_PIXBUF_DUMP_CTYPES. The remaining
135
+ * elements are optional flags that can be freely added.
136
+ *
137
+ * Deprecated: 2.32
138
+ **/
139
+ typedef enum
140
+ {
141
+ /* type of source to save */
142
+ GDK_PIXDATA_DUMP_PIXDATA_STREAM = 0,
143
+ GDK_PIXDATA_DUMP_PIXDATA_STRUCT = 1,
144
+ GDK_PIXDATA_DUMP_MACROS = 2,
145
+ /* type of variables to use */
146
+ GDK_PIXDATA_DUMP_GTYPES = 0,
147
+ GDK_PIXDATA_DUMP_CTYPES = 1 << 8,
148
+ GDK_PIXDATA_DUMP_STATIC = 1 << 9,
149
+ GDK_PIXDATA_DUMP_CONST = 1 << 10,
150
+ /* save RLE decoder macro? */
151
+ GDK_PIXDATA_DUMP_RLE_DECODER = 1 << 16
152
+ } GdkPixdataDumpType;
153
+
154
+
155
+ GDK_PIXBUF_DEPRECATED_IN_2_32
156
+ GString* gdk_pixdata_to_csource (GdkPixdata *pixdata,
157
+ const gchar *name,
158
+ GdkPixdataDumpType dump_type);
159
+
160
+
161
+ G_END_DECLS
162
+
163
+ #endif /* GDK_PIXBUF_DISABLE_DEPRECATED */
164
+
165
+ #endif /* __GDK_PIXDATA_H__ */
data/miniconda3/include/gtest/internal/custom/README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Customization Points
2
+
3
+ The custom directory is an injection point for custom user configurations.
4
+
5
+ ## Header `gtest.h`
6
+
7
+ ### The following macros can be defined:
8
+
9
+ * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of
10
+ `OsStackTraceGetterInterface`.
11
+ * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See
12
+ `testing::TempDir` for semantics and signature.
13
+
14
+ ## Header `gtest-port.h`
15
+
16
+ The following macros can be defined:
17
+
18
+ ### Flag related macros:
19
+
20
+ * `GTEST_FLAG(flag_name)`
21
+ * `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its
22
+ own flagfile flag parsing.
23
+ * `GTEST_DECLARE_bool_(name)`
24
+ * `GTEST_DECLARE_int32_(name)`
25
+ * `GTEST_DECLARE_string_(name)`
26
+ * `GTEST_DEFINE_bool_(name, default_val, doc)`
27
+ * `GTEST_DEFINE_int32_(name, default_val, doc)`
28
+ * `GTEST_DEFINE_string_(name, default_val, doc)`
29
+
30
+ ### Logging:
31
+
32
+ * `GTEST_LOG_(severity)`
33
+ * `GTEST_CHECK_(condition)`
34
+ * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too.
35
+
36
+ ### Threading:
37
+
38
+ * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided.
39
+ * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal`
40
+ are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)`
41
+ and `GTEST_DEFINE_STATIC_MUTEX_(mutex)`
42
+ * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)`
43
+ * `GTEST_LOCK_EXCLUDED_(locks)`
44
+
45
+ ### Underlying library support features
46
+
47
+ * `GTEST_HAS_CXXABI_H_`
48
+
49
+ ### Exporting API symbols:
50
+
51
+ * `GTEST_API_` - Specifier for exported symbols.
52
+
53
+ ## Header `gtest-printers.h`
54
+
55
+ * See documentation at `gtest/gtest-printers.h` for details on how to define a
56
+ custom printer.
data/miniconda3/include/gtest/internal/custom/gtest-port.h ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2015, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // Injection point for custom user configurations. See README for details
31
+ //
32
+ // ** Custom implementation starts here **
33
+
34
+ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
35
+ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
36
+
37
+ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
data/miniconda3/include/gtest/internal/custom/gtest-printers.h ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2015, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // This file provides an injection point for custom printers in a local
31
+ // installation of gTest.
32
+ // It will be included from gtest-printers.h and the overrides in this file
33
+ // will be visible to everyone.
34
+ //
35
+ // Injection point for custom user configurations. See README for details
36
+ //
37
+ // ** Custom implementation starts here **
38
+
39
+ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
40
+ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
41
+
42
+ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
data/miniconda3/include/gtest/internal/custom/gtest.h ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2015, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // Injection point for custom user configurations. See README for details
31
+ //
32
+ // ** Custom implementation starts here **
33
+
34
+ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
35
+ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
36
+
37
+ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
data/miniconda3/include/gtest/internal/gtest-death-test-internal.h ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2005, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // The Google C++ Testing and Mocking Framework (Google Test)
31
+ //
32
+ // This header file defines internal utilities needed for implementing
33
+ // death tests. They are subject to change without notice.
34
+ // GOOGLETEST_CM0001 DO NOT DELETE
35
+
36
+ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
37
+ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
38
+
39
+ #include "gtest/gtest-matchers.h"
40
+ #include "gtest/internal/gtest-internal.h"
41
+
42
+ #include <stdio.h>
43
+ #include <memory>
44
+
45
+ namespace testing {
46
+ namespace internal {
47
+
48
+ GTEST_DECLARE_string_(internal_run_death_test);
49
+
50
+ // Names of the flags (needed for parsing Google Test flags).
51
+ const char kDeathTestStyleFlag[] = "death_test_style";
52
+ const char kDeathTestUseFork[] = "death_test_use_fork";
53
+ const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
54
+
55
+ #if GTEST_HAS_DEATH_TEST
56
+
57
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
58
+ /* class A needs to have dll-interface to be used by clients of class B */)
59
+
60
+ // DeathTest is a class that hides much of the complexity of the
61
+ // GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
62
+ // returns a concrete class that depends on the prevailing death test
63
+ // style, as defined by the --gtest_death_test_style and/or
64
+ // --gtest_internal_run_death_test flags.
65
+
66
+ // In describing the results of death tests, these terms are used with
67
+ // the corresponding definitions:
68
+ //
69
+ // exit status: The integer exit information in the format specified
70
+ // by wait(2)
71
+ // exit code: The integer code passed to exit(3), _exit(2), or
72
+ // returned from main()
73
+ class GTEST_API_ DeathTest {
74
+ public:
75
+ // Create returns false if there was an error determining the
76
+ // appropriate action to take for the current death test; for example,
77
+ // if the gtest_death_test_style flag is set to an invalid value.
78
+ // The LastMessage method will return a more detailed message in that
79
+ // case. Otherwise, the DeathTest pointer pointed to by the "test"
80
+ // argument is set. If the death test should be skipped, the pointer
81
+ // is set to NULL; otherwise, it is set to the address of a new concrete
82
+ // DeathTest object that controls the execution of the current test.
83
+ static bool Create(const char* statement, Matcher<const std::string&> matcher,
84
+ const char* file, int line, DeathTest** test);
85
+ DeathTest();
86
+ virtual ~DeathTest() { }
87
+
88
+ // A helper class that aborts a death test when it's deleted.
89
+ class ReturnSentinel {
90
+ public:
91
+ explicit ReturnSentinel(DeathTest* test) : test_(test) { }
92
+ ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
93
+ private:
94
+ DeathTest* const test_;
95
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
96
+ } GTEST_ATTRIBUTE_UNUSED_;
97
+
98
+ // An enumeration of possible roles that may be taken when a death
99
+ // test is encountered. EXECUTE means that the death test logic should
100
+ // be executed immediately. OVERSEE means that the program should prepare
101
+ // the appropriate environment for a child process to execute the death
102
+ // test, then wait for it to complete.
103
+ enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
104
+
105
+ // An enumeration of the three reasons that a test might be aborted.
106
+ enum AbortReason {
107
+ TEST_ENCOUNTERED_RETURN_STATEMENT,
108
+ TEST_THREW_EXCEPTION,
109
+ TEST_DID_NOT_DIE
110
+ };
111
+
112
+ // Assumes one of the above roles.
113
+ virtual TestRole AssumeRole() = 0;
114
+
115
+ // Waits for the death test to finish and returns its status.
116
+ virtual int Wait() = 0;
117
+
118
+ // Returns true if the death test passed; that is, the test process
119
+ // exited during the test, its exit status matches a user-supplied
120
+ // predicate, and its stderr output matches a user-supplied regular
121
+ // expression.
122
+ // The user-supplied predicate may be a macro expression rather
123
+ // than a function pointer or functor, or else Wait and Passed could
124
+ // be combined.
125
+ virtual bool Passed(bool exit_status_ok) = 0;
126
+
127
+ // Signals that the death test did not die as expected.
128
+ virtual void Abort(AbortReason reason) = 0;
129
+
130
+ // Returns a human-readable outcome message regarding the outcome of
131
+ // the last death test.
132
+ static const char* LastMessage();
133
+
134
+ static void set_last_death_test_message(const std::string& message);
135
+
136
+ private:
137
+ // A string containing a description of the outcome of the last death test.
138
+ static std::string last_death_test_message_;
139
+
140
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
141
+ };
142
+
143
+ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
144
+
145
+ // Factory interface for death tests. May be mocked out for testing.
146
+ class DeathTestFactory {
147
+ public:
148
+ virtual ~DeathTestFactory() { }
149
+ virtual bool Create(const char* statement,
150
+ Matcher<const std::string&> matcher, const char* file,
151
+ int line, DeathTest** test) = 0;
152
+ };
153
+
154
+ // A concrete DeathTestFactory implementation for normal use.
155
+ class DefaultDeathTestFactory : public DeathTestFactory {
156
+ public:
157
+ bool Create(const char* statement, Matcher<const std::string&> matcher,
158
+ const char* file, int line, DeathTest** test) override;
159
+ };
160
+
161
+ // Returns true if exit_status describes a process that was terminated
162
+ // by a signal, or exited normally with a nonzero exit code.
163
+ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
164
+
165
+ // A string passed to EXPECT_DEATH (etc.) is caught by one of these overloads
166
+ // and interpreted as a regex (rather than an Eq matcher) for legacy
167
+ // compatibility.
168
+ inline Matcher<const ::std::string&> MakeDeathTestMatcher(
169
+ ::testing::internal::RE regex) {
170
+ return ContainsRegex(regex.pattern());
171
+ }
172
+ inline Matcher<const ::std::string&> MakeDeathTestMatcher(const char* regex) {
173
+ return ContainsRegex(regex);
174
+ }
175
+ inline Matcher<const ::std::string&> MakeDeathTestMatcher(
176
+ const ::std::string& regex) {
177
+ return ContainsRegex(regex);
178
+ }
179
+
180
+ // If a Matcher<const ::std::string&> is passed to EXPECT_DEATH (etc.), it's
181
+ // used directly.
182
+ inline Matcher<const ::std::string&> MakeDeathTestMatcher(
183
+ Matcher<const ::std::string&> matcher) {
184
+ return matcher;
185
+ }
186
+
187
+ // Traps C++ exceptions escaping statement and reports them as test
188
+ // failures. Note that trapping SEH exceptions is not implemented here.
189
+ # if GTEST_HAS_EXCEPTIONS
190
+ # define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
191
+ try { \
192
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
193
+ } catch (const ::std::exception& gtest_exception) { \
194
+ fprintf(\
195
+ stderr, \
196
+ "\n%s: Caught std::exception-derived exception escaping the " \
197
+ "death test statement. Exception message: %s\n", \
198
+ ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
199
+ gtest_exception.what()); \
200
+ fflush(stderr); \
201
+ death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
202
+ } catch (...) { \
203
+ death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
204
+ }
205
+
206
+ # else
207
+ # define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
208
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
209
+
210
+ # endif
211
+
212
+ // This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
213
+ // ASSERT_EXIT*, and EXPECT_EXIT*.
214
+ #define GTEST_DEATH_TEST_(statement, predicate, regex_or_matcher, fail) \
215
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
216
+ if (::testing::internal::AlwaysTrue()) { \
217
+ ::testing::internal::DeathTest* gtest_dt; \
218
+ if (!::testing::internal::DeathTest::Create( \
219
+ #statement, \
220
+ ::testing::internal::MakeDeathTestMatcher(regex_or_matcher), \
221
+ __FILE__, __LINE__, &gtest_dt)) { \
222
+ goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
223
+ } \
224
+ if (gtest_dt != nullptr) { \
225
+ std::unique_ptr< ::testing::internal::DeathTest> gtest_dt_ptr(gtest_dt); \
226
+ switch (gtest_dt->AssumeRole()) { \
227
+ case ::testing::internal::DeathTest::OVERSEE_TEST: \
228
+ if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
229
+ goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
230
+ } \
231
+ break; \
232
+ case ::testing::internal::DeathTest::EXECUTE_TEST: { \
233
+ ::testing::internal::DeathTest::ReturnSentinel gtest_sentinel( \
234
+ gtest_dt); \
235
+ GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
236
+ gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
237
+ break; \
238
+ } \
239
+ default: \
240
+ break; \
241
+ } \
242
+ } \
243
+ } else \
244
+ GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__) \
245
+ : fail(::testing::internal::DeathTest::LastMessage())
246
+ // The symbol "fail" here expands to something into which a message
247
+ // can be streamed.
248
+
249
+ // This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
250
+ // NDEBUG mode. In this case we need the statements to be executed and the macro
251
+ // must accept a streamed message even though the message is never printed.
252
+ // The regex object is not evaluated, but it is used to prevent "unused"
253
+ // warnings and to avoid an expression that doesn't compile in debug mode.
254
+ #define GTEST_EXECUTE_STATEMENT_(statement, regex_or_matcher) \
255
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
256
+ if (::testing::internal::AlwaysTrue()) { \
257
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
258
+ } else if (!::testing::internal::AlwaysTrue()) { \
259
+ ::testing::internal::MakeDeathTestMatcher(regex_or_matcher); \
260
+ } else \
261
+ ::testing::Message()
262
+
263
+ // A class representing the parsed contents of the
264
+ // --gtest_internal_run_death_test flag, as it existed when
265
+ // RUN_ALL_TESTS was called.
266
+ class InternalRunDeathTestFlag {
267
+ public:
268
+ InternalRunDeathTestFlag(const std::string& a_file,
269
+ int a_line,
270
+ int an_index,
271
+ int a_write_fd)
272
+ : file_(a_file), line_(a_line), index_(an_index),
273
+ write_fd_(a_write_fd) {}
274
+
275
+ ~InternalRunDeathTestFlag() {
276
+ if (write_fd_ >= 0)
277
+ posix::Close(write_fd_);
278
+ }
279
+
280
+ const std::string& file() const { return file_; }
281
+ int line() const { return line_; }
282
+ int index() const { return index_; }
283
+ int write_fd() const { return write_fd_; }
284
+
285
+ private:
286
+ std::string file_;
287
+ int line_;
288
+ int index_;
289
+ int write_fd_;
290
+
291
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
292
+ };
293
+
294
+ // Returns a newly created InternalRunDeathTestFlag object with fields
295
+ // initialized from the GTEST_FLAG(internal_run_death_test) flag if
296
+ // the flag is specified; otherwise returns NULL.
297
+ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
298
+
299
+ #endif // GTEST_HAS_DEATH_TEST
300
+
301
+ } // namespace internal
302
+ } // namespace testing
303
+
304
+ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
data/miniconda3/include/gtest/internal/gtest-filepath.h ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2008, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // Google Test filepath utilities
31
+ //
32
+ // This header file declares classes and functions used internally by
33
+ // Google Test. They are subject to change without notice.
34
+ //
35
+ // This file is #included in gtest/internal/gtest-internal.h.
36
+ // Do not include this header file separately!
37
+
38
+ // GOOGLETEST_CM0001 DO NOT DELETE
39
+
40
+ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
41
+ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
42
+
43
+ #include "gtest/internal/gtest-string.h"
44
+
45
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
46
+ /* class A needs to have dll-interface to be used by clients of class B */)
47
+
48
+ namespace testing {
49
+ namespace internal {
50
+
51
+ // FilePath - a class for file and directory pathname manipulation which
52
+ // handles platform-specific conventions (like the pathname separator).
53
+ // Used for helper functions for naming files in a directory for xml output.
54
+ // Except for Set methods, all methods are const or static, which provides an
55
+ // "immutable value object" -- useful for peace of mind.
56
+ // A FilePath with a value ending in a path separator ("like/this/") represents
57
+ // a directory, otherwise it is assumed to represent a file. In either case,
58
+ // it may or may not represent an actual file or directory in the file system.
59
+ // Names are NOT checked for syntax correctness -- no checking for illegal
60
+ // characters, malformed paths, etc.
61
+
62
+ class GTEST_API_ FilePath {
63
+ public:
64
+ FilePath() : pathname_("") { }
65
+ FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
66
+
67
+ explicit FilePath(const std::string& pathname) : pathname_(pathname) {
68
+ Normalize();
69
+ }
70
+
71
+ FilePath& operator=(const FilePath& rhs) {
72
+ Set(rhs);
73
+ return *this;
74
+ }
75
+
76
+ void Set(const FilePath& rhs) {
77
+ pathname_ = rhs.pathname_;
78
+ }
79
+
80
+ const std::string& string() const { return pathname_; }
81
+ const char* c_str() const { return pathname_.c_str(); }
82
+
83
+ // Returns the current working directory, or "" if unsuccessful.
84
+ static FilePath GetCurrentDir();
85
+
86
+ // Given directory = "dir", base_name = "test", number = 0,
87
+ // extension = "xml", returns "dir/test.xml". If number is greater
88
+ // than zero (e.g., 12), returns "dir/test_12.xml".
89
+ // On Windows platform, uses \ as the separator rather than /.
90
+ static FilePath MakeFileName(const FilePath& directory,
91
+ const FilePath& base_name,
92
+ int number,
93
+ const char* extension);
94
+
95
+ // Given directory = "dir", relative_path = "test.xml",
96
+ // returns "dir/test.xml".
97
+ // On Windows, uses \ as the separator rather than /.
98
+ static FilePath ConcatPaths(const FilePath& directory,
99
+ const FilePath& relative_path);
100
+
101
+ // Returns a pathname for a file that does not currently exist. The pathname
102
+ // will be directory/base_name.extension or
103
+ // directory/base_name_<number>.extension if directory/base_name.extension
104
+ // already exists. The number will be incremented until a pathname is found
105
+ // that does not already exist.
106
+ // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
107
+ // There could be a race condition if two or more processes are calling this
108
+ // function at the same time -- they could both pick the same filename.
109
+ static FilePath GenerateUniqueFileName(const FilePath& directory,
110
+ const FilePath& base_name,
111
+ const char* extension);
112
+
113
+ // Returns true if and only if the path is "".
114
+ bool IsEmpty() const { return pathname_.empty(); }
115
+
116
+ // If input name has a trailing separator character, removes it and returns
117
+ // the name, otherwise return the name string unmodified.
118
+ // On Windows platform, uses \ as the separator, other platforms use /.
119
+ FilePath RemoveTrailingPathSeparator() const;
120
+
121
+ // Returns a copy of the FilePath with the directory part removed.
122
+ // Example: FilePath("path/to/file").RemoveDirectoryName() returns
123
+ // FilePath("file"). If there is no directory part ("just_a_file"), it returns
124
+ // the FilePath unmodified. If there is no file part ("just_a_dir/") it
125
+ // returns an empty FilePath ("").
126
+ // On Windows platform, '\' is the path separator, otherwise it is '/'.
127
+ FilePath RemoveDirectoryName() const;
128
+
129
+ // RemoveFileName returns the directory path with the filename removed.
130
+ // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
131
+ // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
132
+ // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
133
+ // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
134
+ // On Windows platform, '\' is the path separator, otherwise it is '/'.
135
+ FilePath RemoveFileName() const;
136
+
137
+ // Returns a copy of the FilePath with the case-insensitive extension removed.
138
+ // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
139
+ // FilePath("dir/file"). If a case-insensitive extension is not
140
+ // found, returns a copy of the original FilePath.
141
+ FilePath RemoveExtension(const char* extension) const;
142
+
143
+ // Creates directories so that path exists. Returns true if successful or if
144
+ // the directories already exist; returns false if unable to create
145
+ // directories for any reason. Will also return false if the FilePath does
146
+ // not represent a directory (that is, it doesn't end with a path separator).
147
+ bool CreateDirectoriesRecursively() const;
148
+
149
+ // Create the directory so that path exists. Returns true if successful or
150
+ // if the directory already exists; returns false if unable to create the
151
+ // directory for any reason, including if the parent directory does not
152
+ // exist. Not named "CreateDirectory" because that's a macro on Windows.
153
+ bool CreateFolder() const;
154
+
155
+ // Returns true if FilePath describes something in the file-system,
156
+ // either a file, directory, or whatever, and that something exists.
157
+ bool FileOrDirectoryExists() const;
158
+
159
+ // Returns true if pathname describes a directory in the file-system
160
+ // that exists.
161
+ bool DirectoryExists() const;
162
+
163
+ // Returns true if FilePath ends with a path separator, which indicates that
164
+ // it is intended to represent a directory. Returns false otherwise.
165
+ // This does NOT check that a directory (or file) actually exists.
166
+ bool IsDirectory() const;
167
+
168
+ // Returns true if pathname describes a root directory. (Windows has one
169
+ // root directory per disk drive.)
170
+ bool IsRootDirectory() const;
171
+
172
+ // Returns true if pathname describes an absolute path.
173
+ bool IsAbsolutePath() const;
174
+
175
+ private:
176
+ // Replaces multiple consecutive separators with a single separator.
177
+ // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
178
+ // redundancies that might be in a pathname involving "." or "..".
179
+ //
180
+ // A pathname with multiple consecutive separators may occur either through
181
+ // user error or as a result of some scripts or APIs that generate a pathname
182
+ // with a trailing separator. On other platforms the same API or script
183
+ // may NOT generate a pathname with a trailing "/". Then elsewhere that
184
+ // pathname may have another "/" and pathname components added to it,
185
+ // without checking for the separator already being there.
186
+ // The script language and operating system may allow paths like "foo//bar"
187
+ // but some of the functions in FilePath will not handle that correctly. In
188
+ // particular, RemoveTrailingPathSeparator() only removes one separator, and
189
+ // it is called in CreateDirectoriesRecursively() assuming that it will change
190
+ // a pathname from directory syntax (trailing separator) to filename syntax.
191
+ //
192
+ // On Windows this method also replaces the alternate path separator '/' with
193
+ // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
194
+ // "bar\\foo".
195
+
196
+ void Normalize();
197
+
198
+ // Returns a pointer to the last occurrence of a valid path separator in
199
+ // the FilePath. On Windows, for example, both '/' and '\' are valid path
200
+ // separators. Returns NULL if no path separator was found.
201
+ const char* FindLastPathSeparator() const;
202
+
203
+ std::string pathname_;
204
+ }; // class FilePath
205
+
206
+ } // namespace internal
207
+ } // namespace testing
208
+
209
+ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
210
+
211
+ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
data/miniconda3/include/gtest/internal/gtest-internal.h ADDED
@@ -0,0 +1,1560 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2005, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // The Google C++ Testing and Mocking Framework (Google Test)
31
+ //
32
+ // This header file declares functions and macros used internally by
33
+ // Google Test. They are subject to change without notice.
34
+
35
+ // GOOGLETEST_CM0001 DO NOT DELETE
36
+
37
+ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
38
+ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
39
+
40
+ #include "gtest/internal/gtest-port.h"
41
+
42
+ #if GTEST_OS_LINUX
43
+ # include <stdlib.h>
44
+ # include <sys/types.h>
45
+ # include <sys/wait.h>
46
+ # include <unistd.h>
47
+ #endif // GTEST_OS_LINUX
48
+
49
+ #if GTEST_HAS_EXCEPTIONS
50
+ # include <stdexcept>
51
+ #endif
52
+
53
+ #include <ctype.h>
54
+ #include <float.h>
55
+ #include <string.h>
56
+ #include <cstdint>
57
+ #include <iomanip>
58
+ #include <limits>
59
+ #include <map>
60
+ #include <set>
61
+ #include <string>
62
+ #include <type_traits>
63
+ #include <vector>
64
+
65
+ #include "gtest/gtest-message.h"
66
+ #include "gtest/internal/gtest-filepath.h"
67
+ #include "gtest/internal/gtest-string.h"
68
+ #include "gtest/internal/gtest-type-util.h"
69
+
70
+ // Due to C++ preprocessor weirdness, we need double indirection to
71
+ // concatenate two tokens when one of them is __LINE__. Writing
72
+ //
73
+ // foo ## __LINE__
74
+ //
75
+ // will result in the token foo__LINE__, instead of foo followed by
76
+ // the current line number. For more details, see
77
+ // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
78
+ #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
79
+ #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
80
+
81
+ // Stringifies its argument.
82
+ // Work around a bug in visual studio which doesn't accept code like this:
83
+ //
84
+ // #define GTEST_STRINGIFY_(name) #name
85
+ // #define MACRO(a, b, c) ... GTEST_STRINGIFY_(a) ...
86
+ // MACRO(, x, y)
87
+ //
88
+ // Complaining about the argument to GTEST_STRINGIFY_ being empty.
89
+ // This is allowed by the spec.
90
+ #define GTEST_STRINGIFY_HELPER_(name, ...) #name
91
+ #define GTEST_STRINGIFY_(...) GTEST_STRINGIFY_HELPER_(__VA_ARGS__, )
92
+
93
+ namespace proto2 {
94
+ class MessageLite;
95
+ }
96
+
97
+ namespace testing {
98
+
99
+ // Forward declarations.
100
+
101
+ class AssertionResult; // Result of an assertion.
102
+ class Message; // Represents a failure message.
103
+ class Test; // Represents a test.
104
+ class TestInfo; // Information about a test.
105
+ class TestPartResult; // Result of a test part.
106
+ class UnitTest; // A collection of test suites.
107
+
108
+ template <typename T>
109
+ ::std::string PrintToString(const T& value);
110
+
111
+ namespace internal {
112
+
113
+ struct TraceInfo; // Information about a trace point.
114
+ class TestInfoImpl; // Opaque implementation of TestInfo
115
+ class UnitTestImpl; // Opaque implementation of UnitTest
116
+
117
+ // The text used in failure messages to indicate the start of the
118
+ // stack trace.
119
+ GTEST_API_ extern const char kStackTraceMarker[];
120
+
121
+ // An IgnoredValue object can be implicitly constructed from ANY value.
122
+ class IgnoredValue {
123
+ struct Sink {};
124
+ public:
125
+ // This constructor template allows any value to be implicitly
126
+ // converted to IgnoredValue. The object has no data member and
127
+ // doesn't try to remember anything about the argument. We
128
+ // deliberately omit the 'explicit' keyword in order to allow the
129
+ // conversion to be implicit.
130
+ // Disable the conversion if T already has a magical conversion operator.
131
+ // Otherwise we get ambiguity.
132
+ template <typename T,
133
+ typename std::enable_if<!std::is_convertible<T, Sink>::value,
134
+ int>::type = 0>
135
+ IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
136
+ };
137
+
138
+ // Appends the user-supplied message to the Google-Test-generated message.
139
+ GTEST_API_ std::string AppendUserMessage(
140
+ const std::string& gtest_msg, const Message& user_msg);
141
+
142
+ #if GTEST_HAS_EXCEPTIONS
143
+
144
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4275 \
145
+ /* an exported class was derived from a class that was not exported */)
146
+
147
+ // This exception is thrown by (and only by) a failed Google Test
148
+ // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
149
+ // are enabled). We derive it from std::runtime_error, which is for
150
+ // errors presumably detectable only at run time. Since
151
+ // std::runtime_error inherits from std::exception, many testing
152
+ // frameworks know how to extract and print the message inside it.
153
+ class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
154
+ public:
155
+ explicit GoogleTestFailureException(const TestPartResult& failure);
156
+ };
157
+
158
+ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4275
159
+
160
+ #endif // GTEST_HAS_EXCEPTIONS
161
+
162
+ namespace edit_distance {
163
+ // Returns the optimal edits to go from 'left' to 'right'.
164
+ // All edits cost the same, with replace having lower priority than
165
+ // add/remove.
166
+ // Simple implementation of the Wagner-Fischer algorithm.
167
+ // See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
168
+ enum EditType { kMatch, kAdd, kRemove, kReplace };
169
+ GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
170
+ const std::vector<size_t>& left, const std::vector<size_t>& right);
171
+
172
+ // Same as above, but the input is represented as strings.
173
+ GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
174
+ const std::vector<std::string>& left,
175
+ const std::vector<std::string>& right);
176
+
177
+ // Create a diff of the input strings in Unified diff format.
178
+ GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left,
179
+ const std::vector<std::string>& right,
180
+ size_t context = 2);
181
+
182
+ } // namespace edit_distance
183
+
184
+ // Calculate the diff between 'left' and 'right' and return it in unified diff
185
+ // format.
186
+ // If not null, stores in 'total_line_count' the total number of lines found
187
+ // in left + right.
188
+ GTEST_API_ std::string DiffStrings(const std::string& left,
189
+ const std::string& right,
190
+ size_t* total_line_count);
191
+
192
+ // Constructs and returns the message for an equality assertion
193
+ // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
194
+ //
195
+ // The first four parameters are the expressions used in the assertion
196
+ // and their values, as strings. For example, for ASSERT_EQ(foo, bar)
197
+ // where foo is 5 and bar is 6, we have:
198
+ //
199
+ // expected_expression: "foo"
200
+ // actual_expression: "bar"
201
+ // expected_value: "5"
202
+ // actual_value: "6"
203
+ //
204
+ // The ignoring_case parameter is true if and only if the assertion is a
205
+ // *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
206
+ // be inserted into the message.
207
+ GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
208
+ const char* actual_expression,
209
+ const std::string& expected_value,
210
+ const std::string& actual_value,
211
+ bool ignoring_case);
212
+
213
+ // Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
214
+ GTEST_API_ std::string GetBoolAssertionFailureMessage(
215
+ const AssertionResult& assertion_result,
216
+ const char* expression_text,
217
+ const char* actual_predicate_value,
218
+ const char* expected_predicate_value);
219
+
220
+ // This template class represents an IEEE floating-point number
221
+ // (either single-precision or double-precision, depending on the
222
+ // template parameters).
223
+ //
224
+ // The purpose of this class is to do more sophisticated number
225
+ // comparison. (Due to round-off error, etc, it's very unlikely that
226
+ // two floating-points will be equal exactly. Hence a naive
227
+ // comparison by the == operation often doesn't work.)
228
+ //
229
+ // Format of IEEE floating-point:
230
+ //
231
+ // The most-significant bit being the leftmost, an IEEE
232
+ // floating-point looks like
233
+ //
234
+ // sign_bit exponent_bits fraction_bits
235
+ //
236
+ // Here, sign_bit is a single bit that designates the sign of the
237
+ // number.
238
+ //
239
+ // For float, there are 8 exponent bits and 23 fraction bits.
240
+ //
241
+ // For double, there are 11 exponent bits and 52 fraction bits.
242
+ //
243
+ // More details can be found at
244
+ // http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
245
+ //
246
+ // Template parameter:
247
+ //
248
+ // RawType: the raw floating-point type (either float or double)
249
+ template <typename RawType>
250
+ class FloatingPoint {
251
+ public:
252
+ // Defines the unsigned integer type that has the same size as the
253
+ // floating point number.
254
+ typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
255
+
256
+ // Constants.
257
+
258
+ // # of bits in a number.
259
+ static const size_t kBitCount = 8*sizeof(RawType);
260
+
261
+ // # of fraction bits in a number.
262
+ static const size_t kFractionBitCount =
263
+ std::numeric_limits<RawType>::digits - 1;
264
+
265
+ // # of exponent bits in a number.
266
+ static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
267
+
268
+ // The mask for the sign bit.
269
+ static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
270
+
271
+ // The mask for the fraction bits.
272
+ static const Bits kFractionBitMask =
273
+ ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
274
+
275
+ // The mask for the exponent bits.
276
+ static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
277
+
278
+ // How many ULP's (Units in the Last Place) we want to tolerate when
279
+ // comparing two numbers. The larger the value, the more error we
280
+ // allow. A 0 value means that two numbers must be exactly the same
281
+ // to be considered equal.
282
+ //
283
+ // The maximum error of a single floating-point operation is 0.5
284
+ // units in the last place. On Intel CPU's, all floating-point
285
+ // calculations are done with 80-bit precision, while double has 64
286
+ // bits. Therefore, 4 should be enough for ordinary use.
287
+ //
288
+ // See the following article for more details on ULP:
289
+ // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
290
+ static const uint32_t kMaxUlps = 4;
291
+
292
+ // Constructs a FloatingPoint from a raw floating-point number.
293
+ //
294
+ // On an Intel CPU, passing a non-normalized NAN (Not a Number)
295
+ // around may change its bits, although the new value is guaranteed
296
+ // to be also a NAN. Therefore, don't expect this constructor to
297
+ // preserve the bits in x when x is a NAN.
298
+ explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
299
+
300
+ // Static methods
301
+
302
+ // Reinterprets a bit pattern as a floating-point number.
303
+ //
304
+ // This function is needed to test the AlmostEquals() method.
305
+ static RawType ReinterpretBits(const Bits bits) {
306
+ FloatingPoint fp(0);
307
+ fp.u_.bits_ = bits;
308
+ return fp.u_.value_;
309
+ }
310
+
311
+ // Returns the floating-point number that represent positive infinity.
312
+ static RawType Infinity() {
313
+ return ReinterpretBits(kExponentBitMask);
314
+ }
315
+
316
+ // Returns the maximum representable finite floating-point number.
317
+ static RawType Max();
318
+
319
+ // Non-static methods
320
+
321
+ // Returns the bits that represents this number.
322
+ const Bits &bits() const { return u_.bits_; }
323
+
324
+ // Returns the exponent bits of this number.
325
+ Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
326
+
327
+ // Returns the fraction bits of this number.
328
+ Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
329
+
330
+ // Returns the sign bit of this number.
331
+ Bits sign_bit() const { return kSignBitMask & u_.bits_; }
332
+
333
+ // Returns true if and only if this is NAN (not a number).
334
+ bool is_nan() const {
335
+ // It's a NAN if the exponent bits are all ones and the fraction
336
+ // bits are not entirely zeros.
337
+ return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
338
+ }
339
+
340
+ // Returns true if and only if this number is at most kMaxUlps ULP's away
341
+ // from rhs. In particular, this function:
342
+ //
343
+ // - returns false if either number is (or both are) NAN.
344
+ // - treats really large numbers as almost equal to infinity.
345
+ // - thinks +0.0 and -0.0 are 0 DLP's apart.
346
+ bool AlmostEquals(const FloatingPoint& rhs) const {
347
+ // The IEEE standard says that any comparison operation involving
348
+ // a NAN must return false.
349
+ if (is_nan() || rhs.is_nan()) return false;
350
+
351
+ return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
352
+ <= kMaxUlps;
353
+ }
354
+
355
+ private:
356
+ // The data type used to store the actual floating-point number.
357
+ union FloatingPointUnion {
358
+ RawType value_; // The raw floating-point number.
359
+ Bits bits_; // The bits that represent the number.
360
+ };
361
+
362
+ // Converts an integer from the sign-and-magnitude representation to
363
+ // the biased representation. More precisely, let N be 2 to the
364
+ // power of (kBitCount - 1), an integer x is represented by the
365
+ // unsigned number x + N.
366
+ //
367
+ // For instance,
368
+ //
369
+ // -N + 1 (the most negative number representable using
370
+ // sign-and-magnitude) is represented by 1;
371
+ // 0 is represented by N; and
372
+ // N - 1 (the biggest number representable using
373
+ // sign-and-magnitude) is represented by 2N - 1.
374
+ //
375
+ // Read http://en.wikipedia.org/wiki/Signed_number_representations
376
+ // for more details on signed number representations.
377
+ static Bits SignAndMagnitudeToBiased(const Bits &sam) {
378
+ if (kSignBitMask & sam) {
379
+ // sam represents a negative number.
380
+ return ~sam + 1;
381
+ } else {
382
+ // sam represents a positive number.
383
+ return kSignBitMask | sam;
384
+ }
385
+ }
386
+
387
+ // Given two numbers in the sign-and-magnitude representation,
388
+ // returns the distance between them as an unsigned number.
389
+ static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
390
+ const Bits &sam2) {
391
+ const Bits biased1 = SignAndMagnitudeToBiased(sam1);
392
+ const Bits biased2 = SignAndMagnitudeToBiased(sam2);
393
+ return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
394
+ }
395
+
396
+ FloatingPointUnion u_;
397
+ };
398
+
399
+ // We cannot use std::numeric_limits<T>::max() as it clashes with the max()
400
+ // macro defined by <windows.h>.
401
+ template <>
402
+ inline float FloatingPoint<float>::Max() { return FLT_MAX; }
403
+ template <>
404
+ inline double FloatingPoint<double>::Max() { return DBL_MAX; }
405
+
406
+ // Typedefs the instances of the FloatingPoint template class that we
407
+ // care to use.
408
+ typedef FloatingPoint<float> Float;
409
+ typedef FloatingPoint<double> Double;
410
+
411
+ // In order to catch the mistake of putting tests that use different
412
+ // test fixture classes in the same test suite, we need to assign
413
+ // unique IDs to fixture classes and compare them. The TypeId type is
414
+ // used to hold such IDs. The user should treat TypeId as an opaque
415
+ // type: the only operation allowed on TypeId values is to compare
416
+ // them for equality using the == operator.
417
+ typedef const void* TypeId;
418
+
419
+ template <typename T>
420
+ class TypeIdHelper {
421
+ public:
422
+ // dummy_ must not have a const type. Otherwise an overly eager
423
+ // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
424
+ // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
425
+ static bool dummy_;
426
+ };
427
+
428
+ template <typename T>
429
+ bool TypeIdHelper<T>::dummy_ = false;
430
+
431
+ // GetTypeId<T>() returns the ID of type T. Different values will be
432
+ // returned for different types. Calling the function twice with the
433
+ // same type argument is guaranteed to return the same ID.
434
+ template <typename T>
435
+ TypeId GetTypeId() {
436
+ // The compiler is required to allocate a different
437
+ // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
438
+ // the template. Therefore, the address of dummy_ is guaranteed to
439
+ // be unique.
440
+ return &(TypeIdHelper<T>::dummy_);
441
+ }
442
+
443
+ // Returns the type ID of ::testing::Test. Always call this instead
444
+ // of GetTypeId< ::testing::Test>() to get the type ID of
445
+ // ::testing::Test, as the latter may give the wrong result due to a
446
+ // suspected linker bug when compiling Google Test as a Mac OS X
447
+ // framework.
448
+ GTEST_API_ TypeId GetTestTypeId();
449
+
450
+ // Defines the abstract factory interface that creates instances
451
+ // of a Test object.
452
+ class TestFactoryBase {
453
+ public:
454
+ virtual ~TestFactoryBase() {}
455
+
456
+ // Creates a test instance to run. The instance is both created and destroyed
457
+ // within TestInfoImpl::Run()
458
+ virtual Test* CreateTest() = 0;
459
+
460
+ protected:
461
+ TestFactoryBase() {}
462
+
463
+ private:
464
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
465
+ };
466
+
467
+ // This class provides implementation of TeastFactoryBase interface.
468
+ // It is used in TEST and TEST_F macros.
469
+ template <class TestClass>
470
+ class TestFactoryImpl : public TestFactoryBase {
471
+ public:
472
+ Test* CreateTest() override { return new TestClass; }
473
+ };
474
+
475
+ #if GTEST_OS_WINDOWS
476
+
477
+ // Predicate-formatters for implementing the HRESULT checking macros
478
+ // {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
479
+ // We pass a long instead of HRESULT to avoid causing an
480
+ // include dependency for the HRESULT type.
481
+ GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
482
+ long hr); // NOLINT
483
+ GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
484
+ long hr); // NOLINT
485
+
486
+ #endif // GTEST_OS_WINDOWS
487
+
488
+ // Types of SetUpTestSuite() and TearDownTestSuite() functions.
489
+ using SetUpTestSuiteFunc = void (*)();
490
+ using TearDownTestSuiteFunc = void (*)();
491
+
492
+ struct CodeLocation {
493
+ CodeLocation(const std::string& a_file, int a_line)
494
+ : file(a_file), line(a_line) {}
495
+
496
+ std::string file;
497
+ int line;
498
+ };
499
+
500
+ // Helper to identify which setup function for TestCase / TestSuite to call.
501
+ // Only one function is allowed, either TestCase or TestSute but not both.
502
+
503
+ // Utility functions to help SuiteApiResolver
504
+ using SetUpTearDownSuiteFuncType = void (*)();
505
+
506
+ inline SetUpTearDownSuiteFuncType GetNotDefaultOrNull(
507
+ SetUpTearDownSuiteFuncType a, SetUpTearDownSuiteFuncType def) {
508
+ return a == def ? nullptr : a;
509
+ }
510
+
511
+ template <typename T>
512
+ // Note that SuiteApiResolver inherits from T because
513
+ // SetUpTestSuite()/TearDownTestSuite() could be protected. Ths way
514
+ // SuiteApiResolver can access them.
515
+ struct SuiteApiResolver : T {
516
+ // testing::Test is only forward declared at this point. So we make it a
517
+ // dependend class for the compiler to be OK with it.
518
+ using Test =
519
+ typename std::conditional<sizeof(T) != 0, ::testing::Test, void>::type;
520
+
521
+ static SetUpTearDownSuiteFuncType GetSetUpCaseOrSuite(const char* filename,
522
+ int line_num) {
523
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
524
+ SetUpTearDownSuiteFuncType test_case_fp =
525
+ GetNotDefaultOrNull(&T::SetUpTestCase, &Test::SetUpTestCase);
526
+ SetUpTearDownSuiteFuncType test_suite_fp =
527
+ GetNotDefaultOrNull(&T::SetUpTestSuite, &Test::SetUpTestSuite);
528
+
529
+ GTEST_CHECK_(!test_case_fp || !test_suite_fp)
530
+ << "Test can not provide both SetUpTestSuite and SetUpTestCase, please "
531
+ "make sure there is only one present at "
532
+ << filename << ":" << line_num;
533
+
534
+ return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
535
+ #else
536
+ (void)(filename);
537
+ (void)(line_num);
538
+ return &T::SetUpTestSuite;
539
+ #endif
540
+ }
541
+
542
+ static SetUpTearDownSuiteFuncType GetTearDownCaseOrSuite(const char* filename,
543
+ int line_num) {
544
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
545
+ SetUpTearDownSuiteFuncType test_case_fp =
546
+ GetNotDefaultOrNull(&T::TearDownTestCase, &Test::TearDownTestCase);
547
+ SetUpTearDownSuiteFuncType test_suite_fp =
548
+ GetNotDefaultOrNull(&T::TearDownTestSuite, &Test::TearDownTestSuite);
549
+
550
+ GTEST_CHECK_(!test_case_fp || !test_suite_fp)
551
+ << "Test can not provide both TearDownTestSuite and TearDownTestCase,"
552
+ " please make sure there is only one present at"
553
+ << filename << ":" << line_num;
554
+
555
+ return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
556
+ #else
557
+ (void)(filename);
558
+ (void)(line_num);
559
+ return &T::TearDownTestSuite;
560
+ #endif
561
+ }
562
+ };
563
+
564
+ // Creates a new TestInfo object and registers it with Google Test;
565
+ // returns the created object.
566
+ //
567
+ // Arguments:
568
+ //
569
+ // test_suite_name: name of the test suite
570
+ // name: name of the test
571
+ // type_param: the name of the test's type parameter, or NULL if
572
+ // this is not a typed or a type-parameterized test.
573
+ // value_param: text representation of the test's value parameter,
574
+ // or NULL if this is not a type-parameterized test.
575
+ // code_location: code location where the test is defined
576
+ // fixture_class_id: ID of the test fixture class
577
+ // set_up_tc: pointer to the function that sets up the test suite
578
+ // tear_down_tc: pointer to the function that tears down the test suite
579
+ // factory: pointer to the factory that creates a test object.
580
+ // The newly created TestInfo instance will assume
581
+ // ownership of the factory object.
582
+ GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
583
+ const char* test_suite_name, const char* name, const char* type_param,
584
+ const char* value_param, CodeLocation code_location,
585
+ TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc,
586
+ TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory);
587
+
588
+ // If *pstr starts with the given prefix, modifies *pstr to be right
589
+ // past the prefix and returns true; otherwise leaves *pstr unchanged
590
+ // and returns false. None of pstr, *pstr, and prefix can be NULL.
591
+ GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
592
+
593
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
594
+ /* class A needs to have dll-interface to be used by clients of class B */)
595
+
596
+ // State of the definition of a type-parameterized test suite.
597
+ class GTEST_API_ TypedTestSuitePState {
598
+ public:
599
+ TypedTestSuitePState() : registered_(false) {}
600
+
601
+ // Adds the given test name to defined_test_names_ and return true
602
+ // if the test suite hasn't been registered; otherwise aborts the
603
+ // program.
604
+ bool AddTestName(const char* file, int line, const char* case_name,
605
+ const char* test_name) {
606
+ if (registered_) {
607
+ fprintf(stderr,
608
+ "%s Test %s must be defined before "
609
+ "REGISTER_TYPED_TEST_SUITE_P(%s, ...).\n",
610
+ FormatFileLocation(file, line).c_str(), test_name, case_name);
611
+ fflush(stderr);
612
+ posix::Abort();
613
+ }
614
+ registered_tests_.insert(
615
+ ::std::make_pair(test_name, CodeLocation(file, line)));
616
+ return true;
617
+ }
618
+
619
+ bool TestExists(const std::string& test_name) const {
620
+ return registered_tests_.count(test_name) > 0;
621
+ }
622
+
623
+ const CodeLocation& GetCodeLocation(const std::string& test_name) const {
624
+ RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
625
+ GTEST_CHECK_(it != registered_tests_.end());
626
+ return it->second;
627
+ }
628
+
629
+ // Verifies that registered_tests match the test names in
630
+ // defined_test_names_; returns registered_tests if successful, or
631
+ // aborts the program otherwise.
632
+ const char* VerifyRegisteredTestNames(const char* test_suite_name,
633
+ const char* file, int line,
634
+ const char* registered_tests);
635
+
636
+ private:
637
+ typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap;
638
+
639
+ bool registered_;
640
+ RegisteredTestsMap registered_tests_;
641
+ };
642
+
643
+ // Legacy API is deprecated but still available
644
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
645
+ using TypedTestCasePState = TypedTestSuitePState;
646
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
647
+
648
+ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
649
+
650
+ // Skips to the first non-space char after the first comma in 'str';
651
+ // returns NULL if no comma is found in 'str'.
652
+ inline const char* SkipComma(const char* str) {
653
+ const char* comma = strchr(str, ',');
654
+ if (comma == nullptr) {
655
+ return nullptr;
656
+ }
657
+ while (IsSpace(*(++comma))) {}
658
+ return comma;
659
+ }
660
+
661
+ // Returns the prefix of 'str' before the first comma in it; returns
662
+ // the entire string if it contains no comma.
663
+ inline std::string GetPrefixUntilComma(const char* str) {
664
+ const char* comma = strchr(str, ',');
665
+ return comma == nullptr ? str : std::string(str, comma);
666
+ }
667
+
668
+ // Splits a given string on a given delimiter, populating a given
669
+ // vector with the fields.
670
+ void SplitString(const ::std::string& str, char delimiter,
671
+ ::std::vector< ::std::string>* dest);
672
+
673
+ // The default argument to the template below for the case when the user does
674
+ // not provide a name generator.
675
+ struct DefaultNameGenerator {
676
+ template <typename T>
677
+ static std::string GetName(int i) {
678
+ return StreamableToString(i);
679
+ }
680
+ };
681
+
682
+ template <typename Provided = DefaultNameGenerator>
683
+ struct NameGeneratorSelector {
684
+ typedef Provided type;
685
+ };
686
+
687
+ template <typename NameGenerator>
688
+ void GenerateNamesRecursively(internal::None, std::vector<std::string>*, int) {}
689
+
690
+ template <typename NameGenerator, typename Types>
691
+ void GenerateNamesRecursively(Types, std::vector<std::string>* result, int i) {
692
+ result->push_back(NameGenerator::template GetName<typename Types::Head>(i));
693
+ GenerateNamesRecursively<NameGenerator>(typename Types::Tail(), result,
694
+ i + 1);
695
+ }
696
+
697
+ template <typename NameGenerator, typename Types>
698
+ std::vector<std::string> GenerateNames() {
699
+ std::vector<std::string> result;
700
+ GenerateNamesRecursively<NameGenerator>(Types(), &result, 0);
701
+ return result;
702
+ }
703
+
704
+ // TypeParameterizedTest<Fixture, TestSel, Types>::Register()
705
+ // registers a list of type-parameterized tests with Google Test. The
706
+ // return value is insignificant - we just need to return something
707
+ // such that we can call this function in a namespace scope.
708
+ //
709
+ // Implementation note: The GTEST_TEMPLATE_ macro declares a template
710
+ // template parameter. It's defined in gtest-type-util.h.
711
+ template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
712
+ class TypeParameterizedTest {
713
+ public:
714
+ // 'index' is the index of the test in the type list 'Types'
715
+ // specified in INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, TestSuite,
716
+ // Types). Valid values for 'index' are [0, N - 1] where N is the
717
+ // length of Types.
718
+ static bool Register(const char* prefix, const CodeLocation& code_location,
719
+ const char* case_name, const char* test_names, int index,
720
+ const std::vector<std::string>& type_names =
721
+ GenerateNames<DefaultNameGenerator, Types>()) {
722
+ typedef typename Types::Head Type;
723
+ typedef Fixture<Type> FixtureClass;
724
+ typedef typename GTEST_BIND_(TestSel, Type) TestClass;
725
+
726
+ // First, registers the first type-parameterized test in the type
727
+ // list.
728
+ MakeAndRegisterTestInfo(
729
+ (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name +
730
+ "/" + type_names[static_cast<size_t>(index)])
731
+ .c_str(),
732
+ StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(),
733
+ GetTypeName<Type>().c_str(),
734
+ nullptr, // No value parameter.
735
+ code_location, GetTypeId<FixtureClass>(),
736
+ SuiteApiResolver<TestClass>::GetSetUpCaseOrSuite(
737
+ code_location.file.c_str(), code_location.line),
738
+ SuiteApiResolver<TestClass>::GetTearDownCaseOrSuite(
739
+ code_location.file.c_str(), code_location.line),
740
+ new TestFactoryImpl<TestClass>);
741
+
742
+ // Next, recurses (at compile time) with the tail of the type list.
743
+ return TypeParameterizedTest<Fixture, TestSel,
744
+ typename Types::Tail>::Register(prefix,
745
+ code_location,
746
+ case_name,
747
+ test_names,
748
+ index + 1,
749
+ type_names);
750
+ }
751
+ };
752
+
753
+ // The base case for the compile time recursion.
754
+ template <GTEST_TEMPLATE_ Fixture, class TestSel>
755
+ class TypeParameterizedTest<Fixture, TestSel, internal::None> {
756
+ public:
757
+ static bool Register(const char* /*prefix*/, const CodeLocation&,
758
+ const char* /*case_name*/, const char* /*test_names*/,
759
+ int /*index*/,
760
+ const std::vector<std::string>& =
761
+ std::vector<std::string>() /*type_names*/) {
762
+ return true;
763
+ }
764
+ };
765
+
766
+ GTEST_API_ void RegisterTypeParameterizedTestSuite(const char* test_suite_name,
767
+ CodeLocation code_location);
768
+ GTEST_API_ void RegisterTypeParameterizedTestSuiteInstantiation(
769
+ const char* case_name);
770
+
771
+ // TypeParameterizedTestSuite<Fixture, Tests, Types>::Register()
772
+ // registers *all combinations* of 'Tests' and 'Types' with Google
773
+ // Test. The return value is insignificant - we just need to return
774
+ // something such that we can call this function in a namespace scope.
775
+ template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
776
+ class TypeParameterizedTestSuite {
777
+ public:
778
+ static bool Register(const char* prefix, CodeLocation code_location,
779
+ const TypedTestSuitePState* state, const char* case_name,
780
+ const char* test_names,
781
+ const std::vector<std::string>& type_names =
782
+ GenerateNames<DefaultNameGenerator, Types>()) {
783
+ RegisterTypeParameterizedTestSuiteInstantiation(case_name);
784
+ std::string test_name = StripTrailingSpaces(
785
+ GetPrefixUntilComma(test_names));
786
+ if (!state->TestExists(test_name)) {
787
+ fprintf(stderr, "Failed to get code location for test %s.%s at %s.",
788
+ case_name, test_name.c_str(),
789
+ FormatFileLocation(code_location.file.c_str(),
790
+ code_location.line).c_str());
791
+ fflush(stderr);
792
+ posix::Abort();
793
+ }
794
+ const CodeLocation& test_location = state->GetCodeLocation(test_name);
795
+
796
+ typedef typename Tests::Head Head;
797
+
798
+ // First, register the first test in 'Test' for each type in 'Types'.
799
+ TypeParameterizedTest<Fixture, Head, Types>::Register(
800
+ prefix, test_location, case_name, test_names, 0, type_names);
801
+
802
+ // Next, recurses (at compile time) with the tail of the test list.
803
+ return TypeParameterizedTestSuite<Fixture, typename Tests::Tail,
804
+ Types>::Register(prefix, code_location,
805
+ state, case_name,
806
+ SkipComma(test_names),
807
+ type_names);
808
+ }
809
+ };
810
+
811
+ // The base case for the compile time recursion.
812
+ template <GTEST_TEMPLATE_ Fixture, typename Types>
813
+ class TypeParameterizedTestSuite<Fixture, internal::None, Types> {
814
+ public:
815
+ static bool Register(const char* /*prefix*/, const CodeLocation&,
816
+ const TypedTestSuitePState* /*state*/,
817
+ const char* /*case_name*/, const char* /*test_names*/,
818
+ const std::vector<std::string>& =
819
+ std::vector<std::string>() /*type_names*/) {
820
+ return true;
821
+ }
822
+ };
823
+
824
+ // Returns the current OS stack trace as an std::string.
825
+ //
826
+ // The maximum number of stack frames to be included is specified by
827
+ // the gtest_stack_trace_depth flag. The skip_count parameter
828
+ // specifies the number of top frames to be skipped, which doesn't
829
+ // count against the number of frames to be included.
830
+ //
831
+ // For example, if Foo() calls Bar(), which in turn calls
832
+ // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
833
+ // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
834
+ GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
835
+ UnitTest* unit_test, int skip_count);
836
+
837
+ // Helpers for suppressing warnings on unreachable code or constant
838
+ // condition.
839
+
840
+ // Always returns true.
841
+ GTEST_API_ bool AlwaysTrue();
842
+
843
+ // Always returns false.
844
+ inline bool AlwaysFalse() { return !AlwaysTrue(); }
845
+
846
+ // Helper for suppressing false warning from Clang on a const char*
847
+ // variable declared in a conditional expression always being NULL in
848
+ // the else branch.
849
+ struct GTEST_API_ ConstCharPtr {
850
+ ConstCharPtr(const char* str) : value(str) {}
851
+ operator bool() const { return true; }
852
+ const char* value;
853
+ };
854
+
855
+ // Helper for declaring std::string within 'if' statement
856
+ // in pre C++17 build environment.
857
+ struct TrueWithString {
858
+ TrueWithString() = default;
859
+ explicit TrueWithString(const char* str) : value(str) {}
860
+ explicit TrueWithString(const std::string& str) : value(str) {}
861
+ explicit operator bool() const { return true; }
862
+ std::string value;
863
+ };
864
+
865
+ // A simple Linear Congruential Generator for generating random
866
+ // numbers with a uniform distribution. Unlike rand() and srand(), it
867
+ // doesn't use global state (and therefore can't interfere with user
868
+ // code). Unlike rand_r(), it's portable. An LCG isn't very random,
869
+ // but it's good enough for our purposes.
870
+ class GTEST_API_ Random {
871
+ public:
872
+ static const uint32_t kMaxRange = 1u << 31;
873
+
874
+ explicit Random(uint32_t seed) : state_(seed) {}
875
+
876
+ void Reseed(uint32_t seed) { state_ = seed; }
877
+
878
+ // Generates a random number from [0, range). Crashes if 'range' is
879
+ // 0 or greater than kMaxRange.
880
+ uint32_t Generate(uint32_t range);
881
+
882
+ private:
883
+ uint32_t state_;
884
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
885
+ };
886
+
887
+ // Turns const U&, U&, const U, and U all into U.
888
+ #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
889
+ typename std::remove_const<typename std::remove_reference<T>::type>::type
890
+
891
+ // HasDebugStringAndShortDebugString<T>::value is a compile-time bool constant
892
+ // that's true if and only if T has methods DebugString() and ShortDebugString()
893
+ // that return std::string.
894
+ template <typename T>
895
+ class HasDebugStringAndShortDebugString {
896
+ private:
897
+ template <typename C>
898
+ static auto CheckDebugString(C*) -> typename std::is_same<
899
+ std::string, decltype(std::declval<const C>().DebugString())>::type;
900
+ template <typename>
901
+ static std::false_type CheckDebugString(...);
902
+
903
+ template <typename C>
904
+ static auto CheckShortDebugString(C*) -> typename std::is_same<
905
+ std::string, decltype(std::declval<const C>().ShortDebugString())>::type;
906
+ template <typename>
907
+ static std::false_type CheckShortDebugString(...);
908
+
909
+ using HasDebugStringType = decltype(CheckDebugString<T>(nullptr));
910
+ using HasShortDebugStringType = decltype(CheckShortDebugString<T>(nullptr));
911
+
912
+ public:
913
+ static constexpr bool value =
914
+ HasDebugStringType::value && HasShortDebugStringType::value;
915
+ };
916
+
917
+ template <typename T>
918
+ constexpr bool HasDebugStringAndShortDebugString<T>::value;
919
+
920
+ // When the compiler sees expression IsContainerTest<C>(0), if C is an
921
+ // STL-style container class, the first overload of IsContainerTest
922
+ // will be viable (since both C::iterator* and C::const_iterator* are
923
+ // valid types and NULL can be implicitly converted to them). It will
924
+ // be picked over the second overload as 'int' is a perfect match for
925
+ // the type of argument 0. If C::iterator or C::const_iterator is not
926
+ // a valid type, the first overload is not viable, and the second
927
+ // overload will be picked. Therefore, we can determine whether C is
928
+ // a container class by checking the type of IsContainerTest<C>(0).
929
+ // The value of the expression is insignificant.
930
+ //
931
+ // In C++11 mode we check the existence of a const_iterator and that an
932
+ // iterator is properly implemented for the container.
933
+ //
934
+ // For pre-C++11 that we look for both C::iterator and C::const_iterator.
935
+ // The reason is that C++ injects the name of a class as a member of the
936
+ // class itself (e.g. you can refer to class iterator as either
937
+ // 'iterator' or 'iterator::iterator'). If we look for C::iterator
938
+ // only, for example, we would mistakenly think that a class named
939
+ // iterator is an STL container.
940
+ //
941
+ // Also note that the simpler approach of overloading
942
+ // IsContainerTest(typename C::const_iterator*) and
943
+ // IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
944
+ typedef int IsContainer;
945
+ template <class C,
946
+ class Iterator = decltype(::std::declval<const C&>().begin()),
947
+ class = decltype(::std::declval<const C&>().end()),
948
+ class = decltype(++::std::declval<Iterator&>()),
949
+ class = decltype(*::std::declval<Iterator>()),
950
+ class = typename C::const_iterator>
951
+ IsContainer IsContainerTest(int /* dummy */) {
952
+ return 0;
953
+ }
954
+
955
+ typedef char IsNotContainer;
956
+ template <class C>
957
+ IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
958
+
959
+ // Trait to detect whether a type T is a hash table.
960
+ // The heuristic used is that the type contains an inner type `hasher` and does
961
+ // not contain an inner type `reverse_iterator`.
962
+ // If the container is iterable in reverse, then order might actually matter.
963
+ template <typename T>
964
+ struct IsHashTable {
965
+ private:
966
+ template <typename U>
967
+ static char test(typename U::hasher*, typename U::reverse_iterator*);
968
+ template <typename U>
969
+ static int test(typename U::hasher*, ...);
970
+ template <typename U>
971
+ static char test(...);
972
+
973
+ public:
974
+ static const bool value = sizeof(test<T>(nullptr, nullptr)) == sizeof(int);
975
+ };
976
+
977
+ template <typename T>
978
+ const bool IsHashTable<T>::value;
979
+
980
+ template <typename C,
981
+ bool = sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer)>
982
+ struct IsRecursiveContainerImpl;
983
+
984
+ template <typename C>
985
+ struct IsRecursiveContainerImpl<C, false> : public std::false_type {};
986
+
987
+ // Since the IsRecursiveContainerImpl depends on the IsContainerTest we need to
988
+ // obey the same inconsistencies as the IsContainerTest, namely check if
989
+ // something is a container is relying on only const_iterator in C++11 and
990
+ // is relying on both const_iterator and iterator otherwise
991
+ template <typename C>
992
+ struct IsRecursiveContainerImpl<C, true> {
993
+ using value_type = decltype(*std::declval<typename C::const_iterator>());
994
+ using type =
995
+ std::is_same<typename std::remove_const<
996
+ typename std::remove_reference<value_type>::type>::type,
997
+ C>;
998
+ };
999
+
1000
+ // IsRecursiveContainer<Type> is a unary compile-time predicate that
1001
+ // evaluates whether C is a recursive container type. A recursive container
1002
+ // type is a container type whose value_type is equal to the container type
1003
+ // itself. An example for a recursive container type is
1004
+ // boost::filesystem::path, whose iterator has a value_type that is equal to
1005
+ // boost::filesystem::path.
1006
+ template <typename C>
1007
+ struct IsRecursiveContainer : public IsRecursiveContainerImpl<C>::type {};
1008
+
1009
+ // Utilities for native arrays.
1010
+
1011
+ // ArrayEq() compares two k-dimensional native arrays using the
1012
+ // elements' operator==, where k can be any integer >= 0. When k is
1013
+ // 0, ArrayEq() degenerates into comparing a single pair of values.
1014
+
1015
+ template <typename T, typename U>
1016
+ bool ArrayEq(const T* lhs, size_t size, const U* rhs);
1017
+
1018
+ // This generic version is used when k is 0.
1019
+ template <typename T, typename U>
1020
+ inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
1021
+
1022
+ // This overload is used when k >= 1.
1023
+ template <typename T, typename U, size_t N>
1024
+ inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
1025
+ return internal::ArrayEq(lhs, N, rhs);
1026
+ }
1027
+
1028
+ // This helper reduces code bloat. If we instead put its logic inside
1029
+ // the previous ArrayEq() function, arrays with different sizes would
1030
+ // lead to different copies of the template code.
1031
+ template <typename T, typename U>
1032
+ bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
1033
+ for (size_t i = 0; i != size; i++) {
1034
+ if (!internal::ArrayEq(lhs[i], rhs[i]))
1035
+ return false;
1036
+ }
1037
+ return true;
1038
+ }
1039
+
1040
+ // Finds the first element in the iterator range [begin, end) that
1041
+ // equals elem. Element may be a native array type itself.
1042
+ template <typename Iter, typename Element>
1043
+ Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
1044
+ for (Iter it = begin; it != end; ++it) {
1045
+ if (internal::ArrayEq(*it, elem))
1046
+ return it;
1047
+ }
1048
+ return end;
1049
+ }
1050
+
1051
+ // CopyArray() copies a k-dimensional native array using the elements'
1052
+ // operator=, where k can be any integer >= 0. When k is 0,
1053
+ // CopyArray() degenerates into copying a single value.
1054
+
1055
+ template <typename T, typename U>
1056
+ void CopyArray(const T* from, size_t size, U* to);
1057
+
1058
+ // This generic version is used when k is 0.
1059
+ template <typename T, typename U>
1060
+ inline void CopyArray(const T& from, U* to) { *to = from; }
1061
+
1062
+ // This overload is used when k >= 1.
1063
+ template <typename T, typename U, size_t N>
1064
+ inline void CopyArray(const T(&from)[N], U(*to)[N]) {
1065
+ internal::CopyArray(from, N, *to);
1066
+ }
1067
+
1068
+ // This helper reduces code bloat. If we instead put its logic inside
1069
+ // the previous CopyArray() function, arrays with different sizes
1070
+ // would lead to different copies of the template code.
1071
+ template <typename T, typename U>
1072
+ void CopyArray(const T* from, size_t size, U* to) {
1073
+ for (size_t i = 0; i != size; i++) {
1074
+ internal::CopyArray(from[i], to + i);
1075
+ }
1076
+ }
1077
+
1078
+ // The relation between an NativeArray object (see below) and the
1079
+ // native array it represents.
1080
+ // We use 2 different structs to allow non-copyable types to be used, as long
1081
+ // as RelationToSourceReference() is passed.
1082
+ struct RelationToSourceReference {};
1083
+ struct RelationToSourceCopy {};
1084
+
1085
+ // Adapts a native array to a read-only STL-style container. Instead
1086
+ // of the complete STL container concept, this adaptor only implements
1087
+ // members useful for Google Mock's container matchers. New members
1088
+ // should be added as needed. To simplify the implementation, we only
1089
+ // support Element being a raw type (i.e. having no top-level const or
1090
+ // reference modifier). It's the client's responsibility to satisfy
1091
+ // this requirement. Element can be an array type itself (hence
1092
+ // multi-dimensional arrays are supported).
1093
+ template <typename Element>
1094
+ class NativeArray {
1095
+ public:
1096
+ // STL-style container typedefs.
1097
+ typedef Element value_type;
1098
+ typedef Element* iterator;
1099
+ typedef const Element* const_iterator;
1100
+
1101
+ // Constructs from a native array. References the source.
1102
+ NativeArray(const Element* array, size_t count, RelationToSourceReference) {
1103
+ InitRef(array, count);
1104
+ }
1105
+
1106
+ // Constructs from a native array. Copies the source.
1107
+ NativeArray(const Element* array, size_t count, RelationToSourceCopy) {
1108
+ InitCopy(array, count);
1109
+ }
1110
+
1111
+ // Copy constructor.
1112
+ NativeArray(const NativeArray& rhs) {
1113
+ (this->*rhs.clone_)(rhs.array_, rhs.size_);
1114
+ }
1115
+
1116
+ ~NativeArray() {
1117
+ if (clone_ != &NativeArray::InitRef)
1118
+ delete[] array_;
1119
+ }
1120
+
1121
+ // STL-style container methods.
1122
+ size_t size() const { return size_; }
1123
+ const_iterator begin() const { return array_; }
1124
+ const_iterator end() const { return array_ + size_; }
1125
+ bool operator==(const NativeArray& rhs) const {
1126
+ return size() == rhs.size() &&
1127
+ ArrayEq(begin(), size(), rhs.begin());
1128
+ }
1129
+
1130
+ private:
1131
+ static_assert(!std::is_const<Element>::value, "Type must not be const");
1132
+ static_assert(!std::is_reference<Element>::value,
1133
+ "Type must not be a reference");
1134
+
1135
+ // Initializes this object with a copy of the input.
1136
+ void InitCopy(const Element* array, size_t a_size) {
1137
+ Element* const copy = new Element[a_size];
1138
+ CopyArray(array, a_size, copy);
1139
+ array_ = copy;
1140
+ size_ = a_size;
1141
+ clone_ = &NativeArray::InitCopy;
1142
+ }
1143
+
1144
+ // Initializes this object with a reference of the input.
1145
+ void InitRef(const Element* array, size_t a_size) {
1146
+ array_ = array;
1147
+ size_ = a_size;
1148
+ clone_ = &NativeArray::InitRef;
1149
+ }
1150
+
1151
+ const Element* array_;
1152
+ size_t size_;
1153
+ void (NativeArray::*clone_)(const Element*, size_t);
1154
+ };
1155
+
1156
+ // Backport of std::index_sequence.
1157
+ template <size_t... Is>
1158
+ struct IndexSequence {
1159
+ using type = IndexSequence;
1160
+ };
1161
+
1162
+ // Double the IndexSequence, and one if plus_one is true.
1163
+ template <bool plus_one, typename T, size_t sizeofT>
1164
+ struct DoubleSequence;
1165
+ template <size_t... I, size_t sizeofT>
1166
+ struct DoubleSequence<true, IndexSequence<I...>, sizeofT> {
1167
+ using type = IndexSequence<I..., (sizeofT + I)..., 2 * sizeofT>;
1168
+ };
1169
+ template <size_t... I, size_t sizeofT>
1170
+ struct DoubleSequence<false, IndexSequence<I...>, sizeofT> {
1171
+ using type = IndexSequence<I..., (sizeofT + I)...>;
1172
+ };
1173
+
1174
+ // Backport of std::make_index_sequence.
1175
+ // It uses O(ln(N)) instantiation depth.
1176
+ template <size_t N>
1177
+ struct MakeIndexSequenceImpl
1178
+ : DoubleSequence<N % 2 == 1, typename MakeIndexSequenceImpl<N / 2>::type,
1179
+ N / 2>::type {};
1180
+
1181
+ template <>
1182
+ struct MakeIndexSequenceImpl<0> : IndexSequence<> {};
1183
+
1184
+ template <size_t N>
1185
+ using MakeIndexSequence = typename MakeIndexSequenceImpl<N>::type;
1186
+
1187
+ template <typename... T>
1188
+ using IndexSequenceFor = typename MakeIndexSequence<sizeof...(T)>::type;
1189
+
1190
+ template <size_t>
1191
+ struct Ignore {
1192
+ Ignore(...); // NOLINT
1193
+ };
1194
+
1195
+ template <typename>
1196
+ struct ElemFromListImpl;
1197
+ template <size_t... I>
1198
+ struct ElemFromListImpl<IndexSequence<I...>> {
1199
+ // We make Ignore a template to solve a problem with MSVC.
1200
+ // A non-template Ignore would work fine with `decltype(Ignore(I))...`, but
1201
+ // MSVC doesn't understand how to deal with that pack expansion.
1202
+ // Use `0 * I` to have a single instantiation of Ignore.
1203
+ template <typename R>
1204
+ static R Apply(Ignore<0 * I>..., R (*)(), ...);
1205
+ };
1206
+
1207
+ template <size_t N, typename... T>
1208
+ struct ElemFromList {
1209
+ using type =
1210
+ decltype(ElemFromListImpl<typename MakeIndexSequence<N>::type>::Apply(
1211
+ static_cast<T (*)()>(nullptr)...));
1212
+ };
1213
+
1214
+ struct FlatTupleConstructTag {};
1215
+
1216
+ template <typename... T>
1217
+ class FlatTuple;
1218
+
1219
+ template <typename Derived, size_t I>
1220
+ struct FlatTupleElemBase;
1221
+
1222
+ template <typename... T, size_t I>
1223
+ struct FlatTupleElemBase<FlatTuple<T...>, I> {
1224
+ using value_type = typename ElemFromList<I, T...>::type;
1225
+ FlatTupleElemBase() = default;
1226
+ template <typename Arg>
1227
+ explicit FlatTupleElemBase(FlatTupleConstructTag, Arg&& t)
1228
+ : value(std::forward<Arg>(t)) {}
1229
+ value_type value;
1230
+ };
1231
+
1232
+ template <typename Derived, typename Idx>
1233
+ struct FlatTupleBase;
1234
+
1235
+ template <size_t... Idx, typename... T>
1236
+ struct FlatTupleBase<FlatTuple<T...>, IndexSequence<Idx...>>
1237
+ : FlatTupleElemBase<FlatTuple<T...>, Idx>... {
1238
+ using Indices = IndexSequence<Idx...>;
1239
+ FlatTupleBase() = default;
1240
+ template <typename... Args>
1241
+ explicit FlatTupleBase(FlatTupleConstructTag, Args&&... args)
1242
+ : FlatTupleElemBase<FlatTuple<T...>, Idx>(FlatTupleConstructTag{},
1243
+ std::forward<Args>(args))... {}
1244
+
1245
+ template <size_t I>
1246
+ const typename ElemFromList<I, T...>::type& Get() const {
1247
+ return FlatTupleElemBase<FlatTuple<T...>, I>::value;
1248
+ }
1249
+
1250
+ template <size_t I>
1251
+ typename ElemFromList<I, T...>::type& Get() {
1252
+ return FlatTupleElemBase<FlatTuple<T...>, I>::value;
1253
+ }
1254
+
1255
+ template <typename F>
1256
+ auto Apply(F&& f) -> decltype(std::forward<F>(f)(this->Get<Idx>()...)) {
1257
+ return std::forward<F>(f)(Get<Idx>()...);
1258
+ }
1259
+
1260
+ template <typename F>
1261
+ auto Apply(F&& f) const -> decltype(std::forward<F>(f)(this->Get<Idx>()...)) {
1262
+ return std::forward<F>(f)(Get<Idx>()...);
1263
+ }
1264
+ };
1265
+
1266
+ // Analog to std::tuple but with different tradeoffs.
1267
+ // This class minimizes the template instantiation depth, thus allowing more
1268
+ // elements than std::tuple would. std::tuple has been seen to require an
1269
+ // instantiation depth of more than 10x the number of elements in some
1270
+ // implementations.
1271
+ // FlatTuple and ElemFromList are not recursive and have a fixed depth
1272
+ // regardless of T...
1273
+ // MakeIndexSequence, on the other hand, it is recursive but with an
1274
+ // instantiation depth of O(ln(N)).
1275
+ template <typename... T>
1276
+ class FlatTuple
1277
+ : private FlatTupleBase<FlatTuple<T...>,
1278
+ typename MakeIndexSequence<sizeof...(T)>::type> {
1279
+ using Indices = typename FlatTupleBase<
1280
+ FlatTuple<T...>, typename MakeIndexSequence<sizeof...(T)>::type>::Indices;
1281
+
1282
+ public:
1283
+ FlatTuple() = default;
1284
+ template <typename... Args>
1285
+ explicit FlatTuple(FlatTupleConstructTag tag, Args&&... args)
1286
+ : FlatTuple::FlatTupleBase(tag, std::forward<Args>(args)...) {}
1287
+
1288
+ using FlatTuple::FlatTupleBase::Apply;
1289
+ using FlatTuple::FlatTupleBase::Get;
1290
+ };
1291
+
1292
+ // Utility functions to be called with static_assert to induce deprecation
1293
+ // warnings.
1294
+ GTEST_INTERNAL_DEPRECATED(
1295
+ "INSTANTIATE_TEST_CASE_P is deprecated, please use "
1296
+ "INSTANTIATE_TEST_SUITE_P")
1297
+ constexpr bool InstantiateTestCase_P_IsDeprecated() { return true; }
1298
+
1299
+ GTEST_INTERNAL_DEPRECATED(
1300
+ "TYPED_TEST_CASE_P is deprecated, please use "
1301
+ "TYPED_TEST_SUITE_P")
1302
+ constexpr bool TypedTestCase_P_IsDeprecated() { return true; }
1303
+
1304
+ GTEST_INTERNAL_DEPRECATED(
1305
+ "TYPED_TEST_CASE is deprecated, please use "
1306
+ "TYPED_TEST_SUITE")
1307
+ constexpr bool TypedTestCaseIsDeprecated() { return true; }
1308
+
1309
+ GTEST_INTERNAL_DEPRECATED(
1310
+ "REGISTER_TYPED_TEST_CASE_P is deprecated, please use "
1311
+ "REGISTER_TYPED_TEST_SUITE_P")
1312
+ constexpr bool RegisterTypedTestCase_P_IsDeprecated() { return true; }
1313
+
1314
+ GTEST_INTERNAL_DEPRECATED(
1315
+ "INSTANTIATE_TYPED_TEST_CASE_P is deprecated, please use "
1316
+ "INSTANTIATE_TYPED_TEST_SUITE_P")
1317
+ constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; }
1318
+
1319
+ } // namespace internal
1320
+ } // namespace testing
1321
+
1322
+ namespace std {
1323
+ // Some standard library implementations use `struct tuple_size` and some use
1324
+ // `class tuple_size`. Clang warns about the mismatch.
1325
+ // https://reviews.llvm.org/D55466
1326
+ #ifdef __clang__
1327
+ #pragma clang diagnostic push
1328
+ #pragma clang diagnostic ignored "-Wmismatched-tags"
1329
+ #endif
1330
+ template <typename... Ts>
1331
+ struct tuple_size<testing::internal::FlatTuple<Ts...>>
1332
+ : std::integral_constant<size_t, sizeof...(Ts)> {};
1333
+ #ifdef __clang__
1334
+ #pragma clang diagnostic pop
1335
+ #endif
1336
+ } // namespace std
1337
+
1338
+ #define GTEST_MESSAGE_AT_(file, line, message, result_type) \
1339
+ ::testing::internal::AssertHelper(result_type, file, line, message) \
1340
+ = ::testing::Message()
1341
+
1342
+ #define GTEST_MESSAGE_(message, result_type) \
1343
+ GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
1344
+
1345
+ #define GTEST_FATAL_FAILURE_(message) \
1346
+ return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
1347
+
1348
+ #define GTEST_NONFATAL_FAILURE_(message) \
1349
+ GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
1350
+
1351
+ #define GTEST_SUCCESS_(message) \
1352
+ GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
1353
+
1354
+ #define GTEST_SKIP_(message) \
1355
+ return GTEST_MESSAGE_(message, ::testing::TestPartResult::kSkip)
1356
+
1357
+ // Suppress MSVC warning 4072 (unreachable code) for the code following
1358
+ // statement if it returns or throws (or doesn't return or throw in some
1359
+ // situations).
1360
+ // NOTE: The "else" is important to keep this expansion to prevent a top-level
1361
+ // "else" from attaching to our "if".
1362
+ #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
1363
+ if (::testing::internal::AlwaysTrue()) { \
1364
+ statement; \
1365
+ } else /* NOLINT */ \
1366
+ static_assert(true, "") // User must have a semicolon after expansion.
1367
+
1368
+ #if GTEST_HAS_EXCEPTIONS
1369
+
1370
+ namespace testing {
1371
+ namespace internal {
1372
+
1373
+ class NeverThrown {
1374
+ public:
1375
+ const char* what() const noexcept {
1376
+ return "this exception should never be thrown";
1377
+ }
1378
+ };
1379
+
1380
+ } // namespace internal
1381
+ } // namespace testing
1382
+
1383
+ #if GTEST_HAS_RTTI
1384
+
1385
+ #define GTEST_EXCEPTION_TYPE_(e) ::testing::internal::GetTypeName(typeid(e))
1386
+
1387
+ #else // GTEST_HAS_RTTI
1388
+
1389
+ #define GTEST_EXCEPTION_TYPE_(e) \
1390
+ std::string { "an std::exception-derived error" }
1391
+
1392
+ #endif // GTEST_HAS_RTTI
1393
+
1394
+ #define GTEST_TEST_THROW_CATCH_STD_EXCEPTION_(statement, expected_exception) \
1395
+ catch (typename std::conditional< \
1396
+ std::is_same<typename std::remove_cv<typename std::remove_reference< \
1397
+ expected_exception>::type>::type, \
1398
+ std::exception>::value, \
1399
+ const ::testing::internal::NeverThrown&, const std::exception&>::type \
1400
+ e) { \
1401
+ gtest_msg.value = "Expected: " #statement \
1402
+ " throws an exception of type " #expected_exception \
1403
+ ".\n Actual: it throws "; \
1404
+ gtest_msg.value += GTEST_EXCEPTION_TYPE_(e); \
1405
+ gtest_msg.value += " with description \""; \
1406
+ gtest_msg.value += e.what(); \
1407
+ gtest_msg.value += "\"."; \
1408
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
1409
+ }
1410
+
1411
+ #else // GTEST_HAS_EXCEPTIONS
1412
+
1413
+ #define GTEST_TEST_THROW_CATCH_STD_EXCEPTION_(statement, expected_exception)
1414
+
1415
+ #endif // GTEST_HAS_EXCEPTIONS
1416
+
1417
+ #define GTEST_TEST_THROW_(statement, expected_exception, fail) \
1418
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1419
+ if (::testing::internal::TrueWithString gtest_msg{}) { \
1420
+ bool gtest_caught_expected = false; \
1421
+ try { \
1422
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
1423
+ } catch (expected_exception const&) { \
1424
+ gtest_caught_expected = true; \
1425
+ } \
1426
+ GTEST_TEST_THROW_CATCH_STD_EXCEPTION_(statement, expected_exception) \
1427
+ catch (...) { \
1428
+ gtest_msg.value = "Expected: " #statement \
1429
+ " throws an exception of type " #expected_exception \
1430
+ ".\n Actual: it throws a different type."; \
1431
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
1432
+ } \
1433
+ if (!gtest_caught_expected) { \
1434
+ gtest_msg.value = "Expected: " #statement \
1435
+ " throws an exception of type " #expected_exception \
1436
+ ".\n Actual: it throws nothing."; \
1437
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
1438
+ } \
1439
+ } else /*NOLINT*/ \
1440
+ GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__) \
1441
+ : fail(gtest_msg.value.c_str())
1442
+
1443
+ #if GTEST_HAS_EXCEPTIONS
1444
+
1445
+ #define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \
1446
+ catch (std::exception const& e) { \
1447
+ gtest_msg.value = "it throws "; \
1448
+ gtest_msg.value += GTEST_EXCEPTION_TYPE_(e); \
1449
+ gtest_msg.value += " with description \""; \
1450
+ gtest_msg.value += e.what(); \
1451
+ gtest_msg.value += "\"."; \
1452
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
1453
+ }
1454
+
1455
+ #else // GTEST_HAS_EXCEPTIONS
1456
+
1457
+ #define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_()
1458
+
1459
+ #endif // GTEST_HAS_EXCEPTIONS
1460
+
1461
+ #define GTEST_TEST_NO_THROW_(statement, fail) \
1462
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1463
+ if (::testing::internal::TrueWithString gtest_msg{}) { \
1464
+ try { \
1465
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
1466
+ } \
1467
+ GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \
1468
+ catch (...) { \
1469
+ gtest_msg.value = "it throws."; \
1470
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
1471
+ } \
1472
+ } else \
1473
+ GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
1474
+ fail(("Expected: " #statement " doesn't throw an exception.\n" \
1475
+ " Actual: " + gtest_msg.value).c_str())
1476
+
1477
+ #define GTEST_TEST_ANY_THROW_(statement, fail) \
1478
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1479
+ if (::testing::internal::AlwaysTrue()) { \
1480
+ bool gtest_caught_any = false; \
1481
+ try { \
1482
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
1483
+ } \
1484
+ catch (...) { \
1485
+ gtest_caught_any = true; \
1486
+ } \
1487
+ if (!gtest_caught_any) { \
1488
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
1489
+ } \
1490
+ } else \
1491
+ GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
1492
+ fail("Expected: " #statement " throws an exception.\n" \
1493
+ " Actual: it doesn't.")
1494
+
1495
+
1496
+ // Implements Boolean test assertions such as EXPECT_TRUE. expression can be
1497
+ // either a boolean expression or an AssertionResult. text is a textual
1498
+ // representation of expression as it was passed into the EXPECT_TRUE.
1499
+ #define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
1500
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1501
+ if (const ::testing::AssertionResult gtest_ar_ = \
1502
+ ::testing::AssertionResult(expression)) \
1503
+ ; \
1504
+ else \
1505
+ fail(::testing::internal::GetBoolAssertionFailureMessage(\
1506
+ gtest_ar_, text, #actual, #expected).c_str())
1507
+
1508
+ #define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
1509
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1510
+ if (::testing::internal::AlwaysTrue()) { \
1511
+ ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
1512
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
1513
+ if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
1514
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
1515
+ } \
1516
+ } else \
1517
+ GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
1518
+ fail("Expected: " #statement " doesn't generate new fatal " \
1519
+ "failures in the current thread.\n" \
1520
+ " Actual: it does.")
1521
+
1522
+ // Expands to the name of the class that implements the given test.
1523
+ #define GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
1524
+ test_suite_name##_##test_name##_Test
1525
+
1526
+ // Helper macro for defining tests.
1527
+ #define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) \
1528
+ static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \
1529
+ "test_suite_name must not be empty"); \
1530
+ static_assert(sizeof(GTEST_STRINGIFY_(test_name)) > 1, \
1531
+ "test_name must not be empty"); \
1532
+ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
1533
+ : public parent_class { \
1534
+ public: \
1535
+ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() = default; \
1536
+ ~GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() override = default; \
1537
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
1538
+ test_name)); \
1539
+ GTEST_DISALLOW_MOVE_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
1540
+ test_name)); \
1541
+ \
1542
+ private: \
1543
+ void TestBody() override; \
1544
+ static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_; \
1545
+ }; \
1546
+ \
1547
+ ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_suite_name, \
1548
+ test_name)::test_info_ = \
1549
+ ::testing::internal::MakeAndRegisterTestInfo( \
1550
+ #test_suite_name, #test_name, nullptr, nullptr, \
1551
+ ::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \
1552
+ ::testing::internal::SuiteApiResolver< \
1553
+ parent_class>::GetSetUpCaseOrSuite(__FILE__, __LINE__), \
1554
+ ::testing::internal::SuiteApiResolver< \
1555
+ parent_class>::GetTearDownCaseOrSuite(__FILE__, __LINE__), \
1556
+ new ::testing::internal::TestFactoryImpl<GTEST_TEST_CLASS_NAME_( \
1557
+ test_suite_name, test_name)>); \
1558
+ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
1559
+
1560
+ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
data/miniconda3/include/gtest/internal/gtest-param-util.h ADDED
@@ -0,0 +1,947 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2008 Google Inc.
2
+ // All Rights Reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+
31
+ // Type and function utilities for implementing parameterized tests.
32
+
33
+ // GOOGLETEST_CM0001 DO NOT DELETE
34
+
35
+ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
36
+ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
37
+
38
+ #include <ctype.h>
39
+
40
+ #include <cassert>
41
+ #include <iterator>
42
+ #include <memory>
43
+ #include <set>
44
+ #include <tuple>
45
+ #include <type_traits>
46
+ #include <utility>
47
+ #include <vector>
48
+
49
+ #include "gtest/internal/gtest-internal.h"
50
+ #include "gtest/internal/gtest-port.h"
51
+ #include "gtest/gtest-printers.h"
52
+ #include "gtest/gtest-test-part.h"
53
+
54
+ namespace testing {
55
+ // Input to a parameterized test name generator, describing a test parameter.
56
+ // Consists of the parameter value and the integer parameter index.
57
+ template <class ParamType>
58
+ struct TestParamInfo {
59
+ TestParamInfo(const ParamType& a_param, size_t an_index) :
60
+ param(a_param),
61
+ index(an_index) {}
62
+ ParamType param;
63
+ size_t index;
64
+ };
65
+
66
+ // A builtin parameterized test name generator which returns the result of
67
+ // testing::PrintToString.
68
+ struct PrintToStringParamName {
69
+ template <class ParamType>
70
+ std::string operator()(const TestParamInfo<ParamType>& info) const {
71
+ return PrintToString(info.param);
72
+ }
73
+ };
74
+
75
+ namespace internal {
76
+
77
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
78
+ // Utility Functions
79
+
80
+ // Outputs a message explaining invalid registration of different
81
+ // fixture class for the same test suite. This may happen when
82
+ // TEST_P macro is used to define two tests with the same name
83
+ // but in different namespaces.
84
+ GTEST_API_ void ReportInvalidTestSuiteType(const char* test_suite_name,
85
+ CodeLocation code_location);
86
+
87
+ template <typename> class ParamGeneratorInterface;
88
+ template <typename> class ParamGenerator;
89
+
90
+ // Interface for iterating over elements provided by an implementation
91
+ // of ParamGeneratorInterface<T>.
92
+ template <typename T>
93
+ class ParamIteratorInterface {
94
+ public:
95
+ virtual ~ParamIteratorInterface() {}
96
+ // A pointer to the base generator instance.
97
+ // Used only for the purposes of iterator comparison
98
+ // to make sure that two iterators belong to the same generator.
99
+ virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
100
+ // Advances iterator to point to the next element
101
+ // provided by the generator. The caller is responsible
102
+ // for not calling Advance() on an iterator equal to
103
+ // BaseGenerator()->End().
104
+ virtual void Advance() = 0;
105
+ // Clones the iterator object. Used for implementing copy semantics
106
+ // of ParamIterator<T>.
107
+ virtual ParamIteratorInterface* Clone() const = 0;
108
+ // Dereferences the current iterator and provides (read-only) access
109
+ // to the pointed value. It is the caller's responsibility not to call
110
+ // Current() on an iterator equal to BaseGenerator()->End().
111
+ // Used for implementing ParamGenerator<T>::operator*().
112
+ virtual const T* Current() const = 0;
113
+ // Determines whether the given iterator and other point to the same
114
+ // element in the sequence generated by the generator.
115
+ // Used for implementing ParamGenerator<T>::operator==().
116
+ virtual bool Equals(const ParamIteratorInterface& other) const = 0;
117
+ };
118
+
119
+ // Class iterating over elements provided by an implementation of
120
+ // ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
121
+ // and implements the const forward iterator concept.
122
+ template <typename T>
123
+ class ParamIterator {
124
+ public:
125
+ typedef T value_type;
126
+ typedef const T& reference;
127
+ typedef ptrdiff_t difference_type;
128
+
129
+ // ParamIterator assumes ownership of the impl_ pointer.
130
+ ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
131
+ ParamIterator& operator=(const ParamIterator& other) {
132
+ if (this != &other)
133
+ impl_.reset(other.impl_->Clone());
134
+ return *this;
135
+ }
136
+
137
+ const T& operator*() const { return *impl_->Current(); }
138
+ const T* operator->() const { return impl_->Current(); }
139
+ // Prefix version of operator++.
140
+ ParamIterator& operator++() {
141
+ impl_->Advance();
142
+ return *this;
143
+ }
144
+ // Postfix version of operator++.
145
+ ParamIterator operator++(int /*unused*/) {
146
+ ParamIteratorInterface<T>* clone = impl_->Clone();
147
+ impl_->Advance();
148
+ return ParamIterator(clone);
149
+ }
150
+ bool operator==(const ParamIterator& other) const {
151
+ return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
152
+ }
153
+ bool operator!=(const ParamIterator& other) const {
154
+ return !(*this == other);
155
+ }
156
+
157
+ private:
158
+ friend class ParamGenerator<T>;
159
+ explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
160
+ std::unique_ptr<ParamIteratorInterface<T> > impl_;
161
+ };
162
+
163
+ // ParamGeneratorInterface<T> is the binary interface to access generators
164
+ // defined in other translation units.
165
+ template <typename T>
166
+ class ParamGeneratorInterface {
167
+ public:
168
+ typedef T ParamType;
169
+
170
+ virtual ~ParamGeneratorInterface() {}
171
+
172
+ // Generator interface definition
173
+ virtual ParamIteratorInterface<T>* Begin() const = 0;
174
+ virtual ParamIteratorInterface<T>* End() const = 0;
175
+ };
176
+
177
+ // Wraps ParamGeneratorInterface<T> and provides general generator syntax
178
+ // compatible with the STL Container concept.
179
+ // This class implements copy initialization semantics and the contained
180
+ // ParamGeneratorInterface<T> instance is shared among all copies
181
+ // of the original object. This is possible because that instance is immutable.
182
+ template<typename T>
183
+ class ParamGenerator {
184
+ public:
185
+ typedef ParamIterator<T> iterator;
186
+
187
+ explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
188
+ ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
189
+
190
+ ParamGenerator& operator=(const ParamGenerator& other) {
191
+ impl_ = other.impl_;
192
+ return *this;
193
+ }
194
+
195
+ iterator begin() const { return iterator(impl_->Begin()); }
196
+ iterator end() const { return iterator(impl_->End()); }
197
+
198
+ private:
199
+ std::shared_ptr<const ParamGeneratorInterface<T> > impl_;
200
+ };
201
+
202
+ // Generates values from a range of two comparable values. Can be used to
203
+ // generate sequences of user-defined types that implement operator+() and
204
+ // operator<().
205
+ // This class is used in the Range() function.
206
+ template <typename T, typename IncrementT>
207
+ class RangeGenerator : public ParamGeneratorInterface<T> {
208
+ public:
209
+ RangeGenerator(T begin, T end, IncrementT step)
210
+ : begin_(begin), end_(end),
211
+ step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
212
+ ~RangeGenerator() override {}
213
+
214
+ ParamIteratorInterface<T>* Begin() const override {
215
+ return new Iterator(this, begin_, 0, step_);
216
+ }
217
+ ParamIteratorInterface<T>* End() const override {
218
+ return new Iterator(this, end_, end_index_, step_);
219
+ }
220
+
221
+ private:
222
+ class Iterator : public ParamIteratorInterface<T> {
223
+ public:
224
+ Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
225
+ IncrementT step)
226
+ : base_(base), value_(value), index_(index), step_(step) {}
227
+ ~Iterator() override {}
228
+
229
+ const ParamGeneratorInterface<T>* BaseGenerator() const override {
230
+ return base_;
231
+ }
232
+ void Advance() override {
233
+ value_ = static_cast<T>(value_ + step_);
234
+ index_++;
235
+ }
236
+ ParamIteratorInterface<T>* Clone() const override {
237
+ return new Iterator(*this);
238
+ }
239
+ const T* Current() const override { return &value_; }
240
+ bool Equals(const ParamIteratorInterface<T>& other) const override {
241
+ // Having the same base generator guarantees that the other
242
+ // iterator is of the same type and we can downcast.
243
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
244
+ << "The program attempted to compare iterators "
245
+ << "from different generators." << std::endl;
246
+ const int other_index =
247
+ CheckedDowncastToActualType<const Iterator>(&other)->index_;
248
+ return index_ == other_index;
249
+ }
250
+
251
+ private:
252
+ Iterator(const Iterator& other)
253
+ : ParamIteratorInterface<T>(),
254
+ base_(other.base_), value_(other.value_), index_(other.index_),
255
+ step_(other.step_) {}
256
+
257
+ // No implementation - assignment is unsupported.
258
+ void operator=(const Iterator& other);
259
+
260
+ const ParamGeneratorInterface<T>* const base_;
261
+ T value_;
262
+ int index_;
263
+ const IncrementT step_;
264
+ }; // class RangeGenerator::Iterator
265
+
266
+ static int CalculateEndIndex(const T& begin,
267
+ const T& end,
268
+ const IncrementT& step) {
269
+ int end_index = 0;
270
+ for (T i = begin; i < end; i = static_cast<T>(i + step))
271
+ end_index++;
272
+ return end_index;
273
+ }
274
+
275
+ // No implementation - assignment is unsupported.
276
+ void operator=(const RangeGenerator& other);
277
+
278
+ const T begin_;
279
+ const T end_;
280
+ const IncrementT step_;
281
+ // The index for the end() iterator. All the elements in the generated
282
+ // sequence are indexed (0-based) to aid iterator comparison.
283
+ const int end_index_;
284
+ }; // class RangeGenerator
285
+
286
+
287
+ // Generates values from a pair of STL-style iterators. Used in the
288
+ // ValuesIn() function. The elements are copied from the source range
289
+ // since the source can be located on the stack, and the generator
290
+ // is likely to persist beyond that stack frame.
291
+ template <typename T>
292
+ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
293
+ public:
294
+ template <typename ForwardIterator>
295
+ ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
296
+ : container_(begin, end) {}
297
+ ~ValuesInIteratorRangeGenerator() override {}
298
+
299
+ ParamIteratorInterface<T>* Begin() const override {
300
+ return new Iterator(this, container_.begin());
301
+ }
302
+ ParamIteratorInterface<T>* End() const override {
303
+ return new Iterator(this, container_.end());
304
+ }
305
+
306
+ private:
307
+ typedef typename ::std::vector<T> ContainerType;
308
+
309
+ class Iterator : public ParamIteratorInterface<T> {
310
+ public:
311
+ Iterator(const ParamGeneratorInterface<T>* base,
312
+ typename ContainerType::const_iterator iterator)
313
+ : base_(base), iterator_(iterator) {}
314
+ ~Iterator() override {}
315
+
316
+ const ParamGeneratorInterface<T>* BaseGenerator() const override {
317
+ return base_;
318
+ }
319
+ void Advance() override {
320
+ ++iterator_;
321
+ value_.reset();
322
+ }
323
+ ParamIteratorInterface<T>* Clone() const override {
324
+ return new Iterator(*this);
325
+ }
326
+ // We need to use cached value referenced by iterator_ because *iterator_
327
+ // can return a temporary object (and of type other then T), so just
328
+ // having "return &*iterator_;" doesn't work.
329
+ // value_ is updated here and not in Advance() because Advance()
330
+ // can advance iterator_ beyond the end of the range, and we cannot
331
+ // detect that fact. The client code, on the other hand, is
332
+ // responsible for not calling Current() on an out-of-range iterator.
333
+ const T* Current() const override {
334
+ if (value_.get() == nullptr) value_.reset(new T(*iterator_));
335
+ return value_.get();
336
+ }
337
+ bool Equals(const ParamIteratorInterface<T>& other) const override {
338
+ // Having the same base generator guarantees that the other
339
+ // iterator is of the same type and we can downcast.
340
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
341
+ << "The program attempted to compare iterators "
342
+ << "from different generators." << std::endl;
343
+ return iterator_ ==
344
+ CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
345
+ }
346
+
347
+ private:
348
+ Iterator(const Iterator& other)
349
+ // The explicit constructor call suppresses a false warning
350
+ // emitted by gcc when supplied with the -Wextra option.
351
+ : ParamIteratorInterface<T>(),
352
+ base_(other.base_),
353
+ iterator_(other.iterator_) {}
354
+
355
+ const ParamGeneratorInterface<T>* const base_;
356
+ typename ContainerType::const_iterator iterator_;
357
+ // A cached value of *iterator_. We keep it here to allow access by
358
+ // pointer in the wrapping iterator's operator->().
359
+ // value_ needs to be mutable to be accessed in Current().
360
+ // Use of std::unique_ptr helps manage cached value's lifetime,
361
+ // which is bound by the lifespan of the iterator itself.
362
+ mutable std::unique_ptr<const T> value_;
363
+ }; // class ValuesInIteratorRangeGenerator::Iterator
364
+
365
+ // No implementation - assignment is unsupported.
366
+ void operator=(const ValuesInIteratorRangeGenerator& other);
367
+
368
+ const ContainerType container_;
369
+ }; // class ValuesInIteratorRangeGenerator
370
+
371
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
372
+ //
373
+ // Default parameterized test name generator, returns a string containing the
374
+ // integer test parameter index.
375
+ template <class ParamType>
376
+ std::string DefaultParamName(const TestParamInfo<ParamType>& info) {
377
+ Message name_stream;
378
+ name_stream << info.index;
379
+ return name_stream.GetString();
380
+ }
381
+
382
+ template <typename T = int>
383
+ void TestNotEmpty() {
384
+ static_assert(sizeof(T) == 0, "Empty arguments are not allowed.");
385
+ }
386
+ template <typename T = int>
387
+ void TestNotEmpty(const T&) {}
388
+
389
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
390
+ //
391
+ // Stores a parameter value and later creates tests parameterized with that
392
+ // value.
393
+ template <class TestClass>
394
+ class ParameterizedTestFactory : public TestFactoryBase {
395
+ public:
396
+ typedef typename TestClass::ParamType ParamType;
397
+ explicit ParameterizedTestFactory(ParamType parameter) :
398
+ parameter_(parameter) {}
399
+ Test* CreateTest() override {
400
+ TestClass::SetParam(&parameter_);
401
+ return new TestClass();
402
+ }
403
+
404
+ private:
405
+ const ParamType parameter_;
406
+
407
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
408
+ };
409
+
410
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
411
+ //
412
+ // TestMetaFactoryBase is a base class for meta-factories that create
413
+ // test factories for passing into MakeAndRegisterTestInfo function.
414
+ template <class ParamType>
415
+ class TestMetaFactoryBase {
416
+ public:
417
+ virtual ~TestMetaFactoryBase() {}
418
+
419
+ virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
420
+ };
421
+
422
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
423
+ //
424
+ // TestMetaFactory creates test factories for passing into
425
+ // MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
426
+ // ownership of test factory pointer, same factory object cannot be passed
427
+ // into that method twice. But ParameterizedTestSuiteInfo is going to call
428
+ // it for each Test/Parameter value combination. Thus it needs meta factory
429
+ // creator class.
430
+ template <class TestSuite>
431
+ class TestMetaFactory
432
+ : public TestMetaFactoryBase<typename TestSuite::ParamType> {
433
+ public:
434
+ using ParamType = typename TestSuite::ParamType;
435
+
436
+ TestMetaFactory() {}
437
+
438
+ TestFactoryBase* CreateTestFactory(ParamType parameter) override {
439
+ return new ParameterizedTestFactory<TestSuite>(parameter);
440
+ }
441
+
442
+ private:
443
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
444
+ };
445
+
446
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
447
+ //
448
+ // ParameterizedTestSuiteInfoBase is a generic interface
449
+ // to ParameterizedTestSuiteInfo classes. ParameterizedTestSuiteInfoBase
450
+ // accumulates test information provided by TEST_P macro invocations
451
+ // and generators provided by INSTANTIATE_TEST_SUITE_P macro invocations
452
+ // and uses that information to register all resulting test instances
453
+ // in RegisterTests method. The ParameterizeTestSuiteRegistry class holds
454
+ // a collection of pointers to the ParameterizedTestSuiteInfo objects
455
+ // and calls RegisterTests() on each of them when asked.
456
+ class ParameterizedTestSuiteInfoBase {
457
+ public:
458
+ virtual ~ParameterizedTestSuiteInfoBase() {}
459
+
460
+ // Base part of test suite name for display purposes.
461
+ virtual const std::string& GetTestSuiteName() const = 0;
462
+ // Test suite id to verify identity.
463
+ virtual TypeId GetTestSuiteTypeId() const = 0;
464
+ // UnitTest class invokes this method to register tests in this
465
+ // test suite right before running them in RUN_ALL_TESTS macro.
466
+ // This method should not be called more than once on any single
467
+ // instance of a ParameterizedTestSuiteInfoBase derived class.
468
+ virtual void RegisterTests() = 0;
469
+
470
+ protected:
471
+ ParameterizedTestSuiteInfoBase() {}
472
+
473
+ private:
474
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfoBase);
475
+ };
476
+
477
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
478
+ //
479
+ // Report a the name of a test_suit as safe to ignore
480
+ // as the side effect of construction of this type.
481
+ struct GTEST_API_ MarkAsIgnored {
482
+ explicit MarkAsIgnored(const char* test_suite);
483
+ };
484
+
485
+ GTEST_API_ void InsertSyntheticTestCase(const std::string& name,
486
+ CodeLocation location, bool has_test_p);
487
+
488
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
489
+ //
490
+ // ParameterizedTestSuiteInfo accumulates tests obtained from TEST_P
491
+ // macro invocations for a particular test suite and generators
492
+ // obtained from INSTANTIATE_TEST_SUITE_P macro invocations for that
493
+ // test suite. It registers tests with all values generated by all
494
+ // generators when asked.
495
+ template <class TestSuite>
496
+ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
497
+ public:
498
+ // ParamType and GeneratorCreationFunc are private types but are required
499
+ // for declarations of public methods AddTestPattern() and
500
+ // AddTestSuiteInstantiation().
501
+ using ParamType = typename TestSuite::ParamType;
502
+ // A function that returns an instance of appropriate generator type.
503
+ typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
504
+ using ParamNameGeneratorFunc = std::string(const TestParamInfo<ParamType>&);
505
+
506
+ explicit ParameterizedTestSuiteInfo(const char* name,
507
+ CodeLocation code_location)
508
+ : test_suite_name_(name), code_location_(code_location) {}
509
+
510
+ // Test suite base name for display purposes.
511
+ const std::string& GetTestSuiteName() const override {
512
+ return test_suite_name_;
513
+ }
514
+ // Test suite id to verify identity.
515
+ TypeId GetTestSuiteTypeId() const override { return GetTypeId<TestSuite>(); }
516
+ // TEST_P macro uses AddTestPattern() to record information
517
+ // about a single test in a LocalTestInfo structure.
518
+ // test_suite_name is the base name of the test suite (without invocation
519
+ // prefix). test_base_name is the name of an individual test without
520
+ // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
521
+ // test suite base name and DoBar is test base name.
522
+ void AddTestPattern(const char* test_suite_name, const char* test_base_name,
523
+ TestMetaFactoryBase<ParamType>* meta_factory,
524
+ CodeLocation code_location) {
525
+ tests_.push_back(std::shared_ptr<TestInfo>(new TestInfo(
526
+ test_suite_name, test_base_name, meta_factory, code_location)));
527
+ }
528
+ // INSTANTIATE_TEST_SUITE_P macro uses AddGenerator() to record information
529
+ // about a generator.
530
+ int AddTestSuiteInstantiation(const std::string& instantiation_name,
531
+ GeneratorCreationFunc* func,
532
+ ParamNameGeneratorFunc* name_func,
533
+ const char* file, int line) {
534
+ instantiations_.push_back(
535
+ InstantiationInfo(instantiation_name, func, name_func, file, line));
536
+ return 0; // Return value used only to run this method in namespace scope.
537
+ }
538
+ // UnitTest class invokes this method to register tests in this test suite
539
+ // right before running tests in RUN_ALL_TESTS macro.
540
+ // This method should not be called more than once on any single
541
+ // instance of a ParameterizedTestSuiteInfoBase derived class.
542
+ // UnitTest has a guard to prevent from calling this method more than once.
543
+ void RegisterTests() override {
544
+ bool generated_instantiations = false;
545
+
546
+ for (typename TestInfoContainer::iterator test_it = tests_.begin();
547
+ test_it != tests_.end(); ++test_it) {
548
+ std::shared_ptr<TestInfo> test_info = *test_it;
549
+ for (typename InstantiationContainer::iterator gen_it =
550
+ instantiations_.begin(); gen_it != instantiations_.end();
551
+ ++gen_it) {
552
+ const std::string& instantiation_name = gen_it->name;
553
+ ParamGenerator<ParamType> generator((*gen_it->generator)());
554
+ ParamNameGeneratorFunc* name_func = gen_it->name_func;
555
+ const char* file = gen_it->file;
556
+ int line = gen_it->line;
557
+
558
+ std::string test_suite_name;
559
+ if ( !instantiation_name.empty() )
560
+ test_suite_name = instantiation_name + "/";
561
+ test_suite_name += test_info->test_suite_base_name;
562
+
563
+ size_t i = 0;
564
+ std::set<std::string> test_param_names;
565
+ for (typename ParamGenerator<ParamType>::iterator param_it =
566
+ generator.begin();
567
+ param_it != generator.end(); ++param_it, ++i) {
568
+ generated_instantiations = true;
569
+
570
+ Message test_name_stream;
571
+
572
+ std::string param_name = name_func(
573
+ TestParamInfo<ParamType>(*param_it, i));
574
+
575
+ GTEST_CHECK_(IsValidParamName(param_name))
576
+ << "Parameterized test name '" << param_name
577
+ << "' is invalid, in " << file
578
+ << " line " << line << std::endl;
579
+
580
+ GTEST_CHECK_(test_param_names.count(param_name) == 0)
581
+ << "Duplicate parameterized test name '" << param_name
582
+ << "', in " << file << " line " << line << std::endl;
583
+
584
+ test_param_names.insert(param_name);
585
+
586
+ if (!test_info->test_base_name.empty()) {
587
+ test_name_stream << test_info->test_base_name << "/";
588
+ }
589
+ test_name_stream << param_name;
590
+ MakeAndRegisterTestInfo(
591
+ test_suite_name.c_str(), test_name_stream.GetString().c_str(),
592
+ nullptr, // No type parameter.
593
+ PrintToString(*param_it).c_str(), test_info->code_location,
594
+ GetTestSuiteTypeId(),
595
+ SuiteApiResolver<TestSuite>::GetSetUpCaseOrSuite(file, line),
596
+ SuiteApiResolver<TestSuite>::GetTearDownCaseOrSuite(file, line),
597
+ test_info->test_meta_factory->CreateTestFactory(*param_it));
598
+ } // for param_it
599
+ } // for gen_it
600
+ } // for test_it
601
+
602
+ if (!generated_instantiations) {
603
+ // There are no generaotrs, or they all generate nothing ...
604
+ InsertSyntheticTestCase(GetTestSuiteName(), code_location_,
605
+ !tests_.empty());
606
+ }
607
+ } // RegisterTests
608
+
609
+ private:
610
+ // LocalTestInfo structure keeps information about a single test registered
611
+ // with TEST_P macro.
612
+ struct TestInfo {
613
+ TestInfo(const char* a_test_suite_base_name, const char* a_test_base_name,
614
+ TestMetaFactoryBase<ParamType>* a_test_meta_factory,
615
+ CodeLocation a_code_location)
616
+ : test_suite_base_name(a_test_suite_base_name),
617
+ test_base_name(a_test_base_name),
618
+ test_meta_factory(a_test_meta_factory),
619
+ code_location(a_code_location) {}
620
+
621
+ const std::string test_suite_base_name;
622
+ const std::string test_base_name;
623
+ const std::unique_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
624
+ const CodeLocation code_location;
625
+ };
626
+ using TestInfoContainer = ::std::vector<std::shared_ptr<TestInfo> >;
627
+ // Records data received from INSTANTIATE_TEST_SUITE_P macros:
628
+ // <Instantiation name, Sequence generator creation function,
629
+ // Name generator function, Source file, Source line>
630
+ struct InstantiationInfo {
631
+ InstantiationInfo(const std::string &name_in,
632
+ GeneratorCreationFunc* generator_in,
633
+ ParamNameGeneratorFunc* name_func_in,
634
+ const char* file_in,
635
+ int line_in)
636
+ : name(name_in),
637
+ generator(generator_in),
638
+ name_func(name_func_in),
639
+ file(file_in),
640
+ line(line_in) {}
641
+
642
+ std::string name;
643
+ GeneratorCreationFunc* generator;
644
+ ParamNameGeneratorFunc* name_func;
645
+ const char* file;
646
+ int line;
647
+ };
648
+ typedef ::std::vector<InstantiationInfo> InstantiationContainer;
649
+
650
+ static bool IsValidParamName(const std::string& name) {
651
+ // Check for empty string
652
+ if (name.empty())
653
+ return false;
654
+
655
+ // Check for invalid characters
656
+ for (std::string::size_type index = 0; index < name.size(); ++index) {
657
+ if (!IsAlNum(name[index]) && name[index] != '_')
658
+ return false;
659
+ }
660
+
661
+ return true;
662
+ }
663
+
664
+ const std::string test_suite_name_;
665
+ CodeLocation code_location_;
666
+ TestInfoContainer tests_;
667
+ InstantiationContainer instantiations_;
668
+
669
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfo);
670
+ }; // class ParameterizedTestSuiteInfo
671
+
672
+ // Legacy API is deprecated but still available
673
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
674
+ template <class TestCase>
675
+ using ParameterizedTestCaseInfo = ParameterizedTestSuiteInfo<TestCase>;
676
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
677
+
678
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
679
+ //
680
+ // ParameterizedTestSuiteRegistry contains a map of
681
+ // ParameterizedTestSuiteInfoBase classes accessed by test suite names. TEST_P
682
+ // and INSTANTIATE_TEST_SUITE_P macros use it to locate their corresponding
683
+ // ParameterizedTestSuiteInfo descriptors.
684
+ class ParameterizedTestSuiteRegistry {
685
+ public:
686
+ ParameterizedTestSuiteRegistry() {}
687
+ ~ParameterizedTestSuiteRegistry() {
688
+ for (auto& test_suite_info : test_suite_infos_) {
689
+ delete test_suite_info;
690
+ }
691
+ }
692
+
693
+ // Looks up or creates and returns a structure containing information about
694
+ // tests and instantiations of a particular test suite.
695
+ template <class TestSuite>
696
+ ParameterizedTestSuiteInfo<TestSuite>* GetTestSuitePatternHolder(
697
+ const char* test_suite_name, CodeLocation code_location) {
698
+ ParameterizedTestSuiteInfo<TestSuite>* typed_test_info = nullptr;
699
+ for (auto& test_suite_info : test_suite_infos_) {
700
+ if (test_suite_info->GetTestSuiteName() == test_suite_name) {
701
+ if (test_suite_info->GetTestSuiteTypeId() != GetTypeId<TestSuite>()) {
702
+ // Complain about incorrect usage of Google Test facilities
703
+ // and terminate the program since we cannot guaranty correct
704
+ // test suite setup and tear-down in this case.
705
+ ReportInvalidTestSuiteType(test_suite_name, code_location);
706
+ posix::Abort();
707
+ } else {
708
+ // At this point we are sure that the object we found is of the same
709
+ // type we are looking for, so we downcast it to that type
710
+ // without further checks.
711
+ typed_test_info = CheckedDowncastToActualType<
712
+ ParameterizedTestSuiteInfo<TestSuite> >(test_suite_info);
713
+ }
714
+ break;
715
+ }
716
+ }
717
+ if (typed_test_info == nullptr) {
718
+ typed_test_info = new ParameterizedTestSuiteInfo<TestSuite>(
719
+ test_suite_name, code_location);
720
+ test_suite_infos_.push_back(typed_test_info);
721
+ }
722
+ return typed_test_info;
723
+ }
724
+ void RegisterTests() {
725
+ for (auto& test_suite_info : test_suite_infos_) {
726
+ test_suite_info->RegisterTests();
727
+ }
728
+ }
729
+ // Legacy API is deprecated but still available
730
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
731
+ template <class TestCase>
732
+ ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
733
+ const char* test_case_name, CodeLocation code_location) {
734
+ return GetTestSuitePatternHolder<TestCase>(test_case_name, code_location);
735
+ }
736
+
737
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
738
+
739
+ private:
740
+ using TestSuiteInfoContainer = ::std::vector<ParameterizedTestSuiteInfoBase*>;
741
+
742
+ TestSuiteInfoContainer test_suite_infos_;
743
+
744
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteRegistry);
745
+ };
746
+
747
+ // Keep track of what type-parameterized test suite are defined and
748
+ // where as well as which are intatiated. This allows susequently
749
+ // identifying suits that are defined but never used.
750
+ class TypeParameterizedTestSuiteRegistry {
751
+ public:
752
+ // Add a suite definition
753
+ void RegisterTestSuite(const char* test_suite_name,
754
+ CodeLocation code_location);
755
+
756
+ // Add an instantiation of a suit.
757
+ void RegisterInstantiation(const char* test_suite_name);
758
+
759
+ // For each suit repored as defined but not reported as instantiation,
760
+ // emit a test that reports that fact (configurably, as an error).
761
+ void CheckForInstantiations();
762
+
763
+ private:
764
+ struct TypeParameterizedTestSuiteInfo {
765
+ explicit TypeParameterizedTestSuiteInfo(CodeLocation c)
766
+ : code_location(c), instantiated(false) {}
767
+
768
+ CodeLocation code_location;
769
+ bool instantiated;
770
+ };
771
+
772
+ std::map<std::string, TypeParameterizedTestSuiteInfo> suites_;
773
+ };
774
+
775
+ } // namespace internal
776
+
777
+ // Forward declarations of ValuesIn(), which is implemented in
778
+ // include/gtest/gtest-param-test.h.
779
+ template <class Container>
780
+ internal::ParamGenerator<typename Container::value_type> ValuesIn(
781
+ const Container& container);
782
+
783
+ namespace internal {
784
+ // Used in the Values() function to provide polymorphic capabilities.
785
+
786
+ #ifdef _MSC_VER
787
+ #pragma warning(push)
788
+ #pragma warning(disable : 4100)
789
+ #endif
790
+
791
+ template <typename... Ts>
792
+ class ValueArray {
793
+ public:
794
+ explicit ValueArray(Ts... v) : v_(FlatTupleConstructTag{}, std::move(v)...) {}
795
+
796
+ template <typename T>
797
+ operator ParamGenerator<T>() const { // NOLINT
798
+ return ValuesIn(MakeVector<T>(MakeIndexSequence<sizeof...(Ts)>()));
799
+ }
800
+
801
+ private:
802
+ template <typename T, size_t... I>
803
+ std::vector<T> MakeVector(IndexSequence<I...>) const {
804
+ return std::vector<T>{static_cast<T>(v_.template Get<I>())...};
805
+ }
806
+
807
+ FlatTuple<Ts...> v_;
808
+ };
809
+
810
+ #ifdef _MSC_VER
811
+ #pragma warning(pop)
812
+ #endif
813
+
814
+ template <typename... T>
815
+ class CartesianProductGenerator
816
+ : public ParamGeneratorInterface<::std::tuple<T...>> {
817
+ public:
818
+ typedef ::std::tuple<T...> ParamType;
819
+
820
+ CartesianProductGenerator(const std::tuple<ParamGenerator<T>...>& g)
821
+ : generators_(g) {}
822
+ ~CartesianProductGenerator() override {}
823
+
824
+ ParamIteratorInterface<ParamType>* Begin() const override {
825
+ return new Iterator(this, generators_, false);
826
+ }
827
+ ParamIteratorInterface<ParamType>* End() const override {
828
+ return new Iterator(this, generators_, true);
829
+ }
830
+
831
+ private:
832
+ template <class I>
833
+ class IteratorImpl;
834
+ template <size_t... I>
835
+ class IteratorImpl<IndexSequence<I...>>
836
+ : public ParamIteratorInterface<ParamType> {
837
+ public:
838
+ IteratorImpl(const ParamGeneratorInterface<ParamType>* base,
839
+ const std::tuple<ParamGenerator<T>...>& generators, bool is_end)
840
+ : base_(base),
841
+ begin_(std::get<I>(generators).begin()...),
842
+ end_(std::get<I>(generators).end()...),
843
+ current_(is_end ? end_ : begin_) {
844
+ ComputeCurrentValue();
845
+ }
846
+ ~IteratorImpl() override {}
847
+
848
+ const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
849
+ return base_;
850
+ }
851
+ // Advance should not be called on beyond-of-range iterators
852
+ // so no component iterators must be beyond end of range, either.
853
+ void Advance() override {
854
+ assert(!AtEnd());
855
+ // Advance the last iterator.
856
+ ++std::get<sizeof...(T) - 1>(current_);
857
+ // if that reaches end, propagate that up.
858
+ AdvanceIfEnd<sizeof...(T) - 1>();
859
+ ComputeCurrentValue();
860
+ }
861
+ ParamIteratorInterface<ParamType>* Clone() const override {
862
+ return new IteratorImpl(*this);
863
+ }
864
+
865
+ const ParamType* Current() const override { return current_value_.get(); }
866
+
867
+ bool Equals(const ParamIteratorInterface<ParamType>& other) const override {
868
+ // Having the same base generator guarantees that the other
869
+ // iterator is of the same type and we can downcast.
870
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
871
+ << "The program attempted to compare iterators "
872
+ << "from different generators." << std::endl;
873
+ const IteratorImpl* typed_other =
874
+ CheckedDowncastToActualType<const IteratorImpl>(&other);
875
+
876
+ // We must report iterators equal if they both point beyond their
877
+ // respective ranges. That can happen in a variety of fashions,
878
+ // so we have to consult AtEnd().
879
+ if (AtEnd() && typed_other->AtEnd()) return true;
880
+
881
+ bool same = true;
882
+ bool dummy[] = {
883
+ (same = same && std::get<I>(current_) ==
884
+ std::get<I>(typed_other->current_))...};
885
+ (void)dummy;
886
+ return same;
887
+ }
888
+
889
+ private:
890
+ template <size_t ThisI>
891
+ void AdvanceIfEnd() {
892
+ if (std::get<ThisI>(current_) != std::get<ThisI>(end_)) return;
893
+
894
+ bool last = ThisI == 0;
895
+ if (last) {
896
+ // We are done. Nothing else to propagate.
897
+ return;
898
+ }
899
+
900
+ constexpr size_t NextI = ThisI - (ThisI != 0);
901
+ std::get<ThisI>(current_) = std::get<ThisI>(begin_);
902
+ ++std::get<NextI>(current_);
903
+ AdvanceIfEnd<NextI>();
904
+ }
905
+
906
+ void ComputeCurrentValue() {
907
+ if (!AtEnd())
908
+ current_value_ = std::make_shared<ParamType>(*std::get<I>(current_)...);
909
+ }
910
+ bool AtEnd() const {
911
+ bool at_end = false;
912
+ bool dummy[] = {
913
+ (at_end = at_end || std::get<I>(current_) == std::get<I>(end_))...};
914
+ (void)dummy;
915
+ return at_end;
916
+ }
917
+
918
+ const ParamGeneratorInterface<ParamType>* const base_;
919
+ std::tuple<typename ParamGenerator<T>::iterator...> begin_;
920
+ std::tuple<typename ParamGenerator<T>::iterator...> end_;
921
+ std::tuple<typename ParamGenerator<T>::iterator...> current_;
922
+ std::shared_ptr<ParamType> current_value_;
923
+ };
924
+
925
+ using Iterator = IteratorImpl<typename MakeIndexSequence<sizeof...(T)>::type>;
926
+
927
+ std::tuple<ParamGenerator<T>...> generators_;
928
+ };
929
+
930
+ template <class... Gen>
931
+ class CartesianProductHolder {
932
+ public:
933
+ CartesianProductHolder(const Gen&... g) : generators_(g...) {}
934
+ template <typename... T>
935
+ operator ParamGenerator<::std::tuple<T...>>() const {
936
+ return ParamGenerator<::std::tuple<T...>>(
937
+ new CartesianProductGenerator<T...>(generators_));
938
+ }
939
+
940
+ private:
941
+ std::tuple<Gen...> generators_;
942
+ };
943
+
944
+ } // namespace internal
945
+ } // namespace testing
946
+
947
+ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
data/miniconda3/include/gtest/internal/gtest-port-arch.h ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2015, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // The Google C++ Testing and Mocking Framework (Google Test)
31
+ //
32
+ // This header file defines the GTEST_OS_* macro.
33
+ // It is separate from gtest-port.h so that custom/gtest-port.h can include it.
34
+
35
+ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
36
+ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
37
+
38
+ // Determines the platform on which Google Test is compiled.
39
+ #ifdef __CYGWIN__
40
+ # define GTEST_OS_CYGWIN 1
41
+ # elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
42
+ # define GTEST_OS_WINDOWS_MINGW 1
43
+ # define GTEST_OS_WINDOWS 1
44
+ #elif defined _WIN32
45
+ # define GTEST_OS_WINDOWS 1
46
+ # ifdef _WIN32_WCE
47
+ # define GTEST_OS_WINDOWS_MOBILE 1
48
+ # elif defined(WINAPI_FAMILY)
49
+ # include <winapifamily.h>
50
+ # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
51
+ # define GTEST_OS_WINDOWS_DESKTOP 1
52
+ # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
53
+ # define GTEST_OS_WINDOWS_PHONE 1
54
+ # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
55
+ # define GTEST_OS_WINDOWS_RT 1
56
+ # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)
57
+ # define GTEST_OS_WINDOWS_PHONE 1
58
+ # define GTEST_OS_WINDOWS_TV_TITLE 1
59
+ # else
60
+ // WINAPI_FAMILY defined but no known partition matched.
61
+ // Default to desktop.
62
+ # define GTEST_OS_WINDOWS_DESKTOP 1
63
+ # endif
64
+ # else
65
+ # define GTEST_OS_WINDOWS_DESKTOP 1
66
+ # endif // _WIN32_WCE
67
+ #elif defined __OS2__
68
+ # define GTEST_OS_OS2 1
69
+ #elif defined __APPLE__
70
+ # define GTEST_OS_MAC 1
71
+ # include <TargetConditionals.h>
72
+ # if TARGET_OS_IPHONE
73
+ # define GTEST_OS_IOS 1
74
+ # endif
75
+ #elif defined __DragonFly__
76
+ # define GTEST_OS_DRAGONFLY 1
77
+ #elif defined __FreeBSD__
78
+ # define GTEST_OS_FREEBSD 1
79
+ #elif defined __Fuchsia__
80
+ # define GTEST_OS_FUCHSIA 1
81
+ #elif defined(__GLIBC__) && defined(__FreeBSD_kernel__)
82
+ # define GTEST_OS_GNU_KFREEBSD 1
83
+ #elif defined __linux__
84
+ # define GTEST_OS_LINUX 1
85
+ # if defined __ANDROID__
86
+ # define GTEST_OS_LINUX_ANDROID 1
87
+ # endif
88
+ #elif defined __MVS__
89
+ # define GTEST_OS_ZOS 1
90
+ #elif defined(__sun) && defined(__SVR4)
91
+ # define GTEST_OS_SOLARIS 1
92
+ #elif defined(_AIX)
93
+ # define GTEST_OS_AIX 1
94
+ #elif defined(__hpux)
95
+ # define GTEST_OS_HPUX 1
96
+ #elif defined __native_client__
97
+ # define GTEST_OS_NACL 1
98
+ #elif defined __NetBSD__
99
+ # define GTEST_OS_NETBSD 1
100
+ #elif defined __OpenBSD__
101
+ # define GTEST_OS_OPENBSD 1
102
+ #elif defined __QNX__
103
+ # define GTEST_OS_QNX 1
104
+ #elif defined(__HAIKU__)
105
+ #define GTEST_OS_HAIKU 1
106
+ #elif defined ESP8266
107
+ #define GTEST_OS_ESP8266 1
108
+ #elif defined ESP32
109
+ #define GTEST_OS_ESP32 1
110
+ #elif defined(__XTENSA__)
111
+ #define GTEST_OS_XTENSA 1
112
+ #endif // __CYGWIN__
113
+
114
+ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
data/miniconda3/include/gtest/internal/gtest-port.h ADDED
@@ -0,0 +1,2389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2005, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // Low-level types and utilities for porting Google Test to various
31
+ // platforms. All macros ending with _ and symbols defined in an
32
+ // internal namespace are subject to change without notice. Code
33
+ // outside Google Test MUST NOT USE THEM DIRECTLY. Macros that don't
34
+ // end with _ are part of Google Test's public API and can be used by
35
+ // code outside Google Test.
36
+ //
37
+ // This file is fundamental to Google Test. All other Google Test source
38
+ // files are expected to #include this. Therefore, it cannot #include
39
+ // any other Google Test header.
40
+
41
+ // GOOGLETEST_CM0001 DO NOT DELETE
42
+
43
+ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
44
+ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
45
+
46
+ // Environment-describing macros
47
+ // -----------------------------
48
+ //
49
+ // Google Test can be used in many different environments. Macros in
50
+ // this section tell Google Test what kind of environment it is being
51
+ // used in, such that Google Test can provide environment-specific
52
+ // features and implementations.
53
+ //
54
+ // Google Test tries to automatically detect the properties of its
55
+ // environment, so users usually don't need to worry about these
56
+ // macros. However, the automatic detection is not perfect.
57
+ // Sometimes it's necessary for a user to define some of the following
58
+ // macros in the build script to override Google Test's decisions.
59
+ //
60
+ // If the user doesn't define a macro in the list, Google Test will
61
+ // provide a default definition. After this header is #included, all
62
+ // macros in this list will be defined to either 1 or 0.
63
+ //
64
+ // Notes to maintainers:
65
+ // - Each macro here is a user-tweakable knob; do not grow the list
66
+ // lightly.
67
+ // - Use #if to key off these macros. Don't use #ifdef or "#if
68
+ // defined(...)", which will not work as these macros are ALWAYS
69
+ // defined.
70
+ //
71
+ // GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2)
72
+ // is/isn't available.
73
+ // GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions
74
+ // are enabled.
75
+ // GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular
76
+ // expressions are/aren't available.
77
+ // GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
78
+ // is/isn't available.
79
+ // GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
80
+ // enabled.
81
+ // GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
82
+ // std::wstring does/doesn't work (Google Test can
83
+ // be used where std::wstring is unavailable).
84
+ // GTEST_HAS_SEH - Define it to 1/0 to indicate whether the
85
+ // compiler supports Microsoft's "Structured
86
+ // Exception Handling".
87
+ // GTEST_HAS_STREAM_REDIRECTION
88
+ // - Define it to 1/0 to indicate whether the
89
+ // platform supports I/O stream redirection using
90
+ // dup() and dup2().
91
+ // GTEST_LINKED_AS_SHARED_LIBRARY
92
+ // - Define to 1 when compiling tests that use
93
+ // Google Test as a shared library (known as
94
+ // DLL on Windows).
95
+ // GTEST_CREATE_SHARED_LIBRARY
96
+ // - Define to 1 when compiling Google Test itself
97
+ // as a shared library.
98
+ // GTEST_DEFAULT_DEATH_TEST_STYLE
99
+ // - The default value of --gtest_death_test_style.
100
+ // The legacy default has been "fast" in the open
101
+ // source version since 2008. The recommended value
102
+ // is "threadsafe", and can be set in
103
+ // custom/gtest-port.h.
104
+
105
+ // Platform-indicating macros
106
+ // --------------------------
107
+ //
108
+ // Macros indicating the platform on which Google Test is being used
109
+ // (a macro is defined to 1 if compiled on the given platform;
110
+ // otherwise UNDEFINED -- it's never defined to 0.). Google Test
111
+ // defines these macros automatically. Code outside Google Test MUST
112
+ // NOT define them.
113
+ //
114
+ // GTEST_OS_AIX - IBM AIX
115
+ // GTEST_OS_CYGWIN - Cygwin
116
+ // GTEST_OS_DRAGONFLY - DragonFlyBSD
117
+ // GTEST_OS_FREEBSD - FreeBSD
118
+ // GTEST_OS_FUCHSIA - Fuchsia
119
+ // GTEST_OS_GNU_KFREEBSD - GNU/kFreeBSD
120
+ // GTEST_OS_HAIKU - Haiku
121
+ // GTEST_OS_HPUX - HP-UX
122
+ // GTEST_OS_LINUX - Linux
123
+ // GTEST_OS_LINUX_ANDROID - Google Android
124
+ // GTEST_OS_MAC - Mac OS X
125
+ // GTEST_OS_IOS - iOS
126
+ // GTEST_OS_NACL - Google Native Client (NaCl)
127
+ // GTEST_OS_NETBSD - NetBSD
128
+ // GTEST_OS_OPENBSD - OpenBSD
129
+ // GTEST_OS_OS2 - OS/2
130
+ // GTEST_OS_QNX - QNX
131
+ // GTEST_OS_SOLARIS - Sun Solaris
132
+ // GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile)
133
+ // GTEST_OS_WINDOWS_DESKTOP - Windows Desktop
134
+ // GTEST_OS_WINDOWS_MINGW - MinGW
135
+ // GTEST_OS_WINDOWS_MOBILE - Windows Mobile
136
+ // GTEST_OS_WINDOWS_PHONE - Windows Phone
137
+ // GTEST_OS_WINDOWS_RT - Windows Store App/WinRT
138
+ // GTEST_OS_ZOS - z/OS
139
+ //
140
+ // Among the platforms, Cygwin, Linux, Mac OS X, and Windows have the
141
+ // most stable support. Since core members of the Google Test project
142
+ // don't have access to other platforms, support for them may be less
143
+ // stable. If you notice any problems on your platform, please notify
144
+ // googletestframework@googlegroups.com (patches for fixing them are
145
+ // even more welcome!).
146
+ //
147
+ // It is possible that none of the GTEST_OS_* macros are defined.
148
+
149
+ // Feature-indicating macros
150
+ // -------------------------
151
+ //
152
+ // Macros indicating which Google Test features are available (a macro
153
+ // is defined to 1 if the corresponding feature is supported;
154
+ // otherwise UNDEFINED -- it's never defined to 0.). Google Test
155
+ // defines these macros automatically. Code outside Google Test MUST
156
+ // NOT define them.
157
+ //
158
+ // These macros are public so that portable tests can be written.
159
+ // Such tests typically surround code using a feature with an #if
160
+ // which controls that code. For example:
161
+ //
162
+ // #if GTEST_HAS_DEATH_TEST
163
+ // EXPECT_DEATH(DoSomethingDeadly());
164
+ // #endif
165
+ //
166
+ // GTEST_HAS_DEATH_TEST - death tests
167
+ // GTEST_HAS_TYPED_TEST - typed tests
168
+ // GTEST_HAS_TYPED_TEST_P - type-parameterized tests
169
+ // GTEST_IS_THREADSAFE - Google Test is thread-safe.
170
+ // GOOGLETEST_CM0007 DO NOT DELETE
171
+ // GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with
172
+ // GTEST_HAS_POSIX_RE (see above) which users can
173
+ // define themselves.
174
+ // GTEST_USES_SIMPLE_RE - our own simple regex is used;
175
+ // the above RE\b(s) are mutually exclusive.
176
+
177
+ // Misc public macros
178
+ // ------------------
179
+ //
180
+ // GTEST_FLAG(flag_name) - references the variable corresponding to
181
+ // the given Google Test flag.
182
+
183
+ // Internal utilities
184
+ // ------------------
185
+ //
186
+ // The following macros and utilities are for Google Test's INTERNAL
187
+ // use only. Code outside Google Test MUST NOT USE THEM DIRECTLY.
188
+ //
189
+ // Macros for basic C++ coding:
190
+ // GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
191
+ // GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a
192
+ // variable don't have to be used.
193
+ // GTEST_DISALLOW_ASSIGN_ - disables copy operator=.
194
+ // GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
195
+ // GTEST_DISALLOW_MOVE_ASSIGN_ - disables move operator=.
196
+ // GTEST_DISALLOW_MOVE_AND_ASSIGN_ - disables move ctor and operator=.
197
+ // GTEST_MUST_USE_RESULT_ - declares that a function's result must be used.
198
+ // GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is
199
+ // suppressed (constant conditional).
200
+ // GTEST_INTENTIONAL_CONST_COND_POP_ - finish code section where MSVC C4127
201
+ // is suppressed.
202
+ // GTEST_INTERNAL_HAS_ANY - for enabling UniversalPrinter<std::any> or
203
+ // UniversalPrinter<absl::any> specializations.
204
+ // GTEST_INTERNAL_HAS_OPTIONAL - for enabling UniversalPrinter<std::optional>
205
+ // or
206
+ // UniversalPrinter<absl::optional>
207
+ // specializations.
208
+ // GTEST_INTERNAL_HAS_STRING_VIEW - for enabling Matcher<std::string_view> or
209
+ // Matcher<absl::string_view>
210
+ // specializations.
211
+ // GTEST_INTERNAL_HAS_VARIANT - for enabling UniversalPrinter<std::variant> or
212
+ // UniversalPrinter<absl::variant>
213
+ // specializations.
214
+ //
215
+ // Synchronization:
216
+ // Mutex, MutexLock, ThreadLocal, GetThreadCount()
217
+ // - synchronization primitives.
218
+ //
219
+ // Regular expressions:
220
+ // RE - a simple regular expression class using the POSIX
221
+ // Extended Regular Expression syntax on UNIX-like platforms
222
+ // GOOGLETEST_CM0008 DO NOT DELETE
223
+ // or a reduced regular exception syntax on other
224
+ // platforms, including Windows.
225
+ // Logging:
226
+ // GTEST_LOG_() - logs messages at the specified severity level.
227
+ // LogToStderr() - directs all log messages to stderr.
228
+ // FlushInfoLog() - flushes informational log messages.
229
+ //
230
+ // Stdout and stderr capturing:
231
+ // CaptureStdout() - starts capturing stdout.
232
+ // GetCapturedStdout() - stops capturing stdout and returns the captured
233
+ // string.
234
+ // CaptureStderr() - starts capturing stderr.
235
+ // GetCapturedStderr() - stops capturing stderr and returns the captured
236
+ // string.
237
+ //
238
+ // Integer types:
239
+ // TypeWithSize - maps an integer to a int type.
240
+ // TimeInMillis - integers of known sizes.
241
+ // BiggestInt - the biggest signed integer type.
242
+ //
243
+ // Command-line utilities:
244
+ // GTEST_DECLARE_*() - declares a flag.
245
+ // GTEST_DEFINE_*() - defines a flag.
246
+ // GetInjectableArgvs() - returns the command line as a vector of strings.
247
+ //
248
+ // Environment variable utilities:
249
+ // GetEnv() - gets the value of an environment variable.
250
+ // BoolFromGTestEnv() - parses a bool environment variable.
251
+ // Int32FromGTestEnv() - parses an int32_t environment variable.
252
+ // StringFromGTestEnv() - parses a string environment variable.
253
+ //
254
+ // Deprecation warnings:
255
+ // GTEST_INTERNAL_DEPRECATED(message) - attribute marking a function as
256
+ // deprecated; calling a marked function
257
+ // should generate a compiler warning
258
+
259
+ #include <ctype.h> // for isspace, etc
260
+ #include <stddef.h> // for ptrdiff_t
261
+ #include <stdio.h>
262
+ #include <stdlib.h>
263
+ #include <string.h>
264
+
265
+ #include <cerrno>
266
+ #include <cstdint>
267
+ #include <limits>
268
+ #include <type_traits>
269
+
270
+ #ifndef _WIN32_WCE
271
+ # include <sys/types.h>
272
+ # include <sys/stat.h>
273
+ #endif // !_WIN32_WCE
274
+
275
+ #if defined __APPLE__
276
+ # include <AvailabilityMacros.h>
277
+ # include <TargetConditionals.h>
278
+ #endif
279
+
280
+ #include <iostream> // NOLINT
281
+ #include <locale>
282
+ #include <memory>
283
+ #include <string> // NOLINT
284
+ #include <tuple>
285
+ #include <vector> // NOLINT
286
+
287
+ #include "gtest/internal/custom/gtest-port.h"
288
+ #include "gtest/internal/gtest-port-arch.h"
289
+
290
+ #if !defined(GTEST_DEV_EMAIL_)
291
+ # define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
292
+ # define GTEST_FLAG_PREFIX_ "gtest_"
293
+ # define GTEST_FLAG_PREFIX_DASH_ "gtest-"
294
+ # define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
295
+ # define GTEST_NAME_ "Google Test"
296
+ # define GTEST_PROJECT_URL_ "https://github.com/google/googletest/"
297
+ #endif // !defined(GTEST_DEV_EMAIL_)
298
+
299
+ #if !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
300
+ # define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest"
301
+ #endif // !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
302
+
303
+ // Determines the version of gcc that is used to compile this.
304
+ #ifdef __GNUC__
305
+ // 40302 means version 4.3.2.
306
+ # define GTEST_GCC_VER_ \
307
+ (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
308
+ #endif // __GNUC__
309
+
310
+ // Macros for disabling Microsoft Visual C++ warnings.
311
+ //
312
+ // GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385)
313
+ // /* code that triggers warnings C4800 and C4385 */
314
+ // GTEST_DISABLE_MSC_WARNINGS_POP_()
315
+ #if defined(_MSC_VER)
316
+ # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \
317
+ __pragma(warning(push)) \
318
+ __pragma(warning(disable: warnings))
319
+ # define GTEST_DISABLE_MSC_WARNINGS_POP_() \
320
+ __pragma(warning(pop))
321
+ #else
322
+ // Not all compilers are MSVC
323
+ # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
324
+ # define GTEST_DISABLE_MSC_WARNINGS_POP_()
325
+ #endif
326
+
327
+ // Clang on Windows does not understand MSVC's pragma warning.
328
+ // We need clang-specific way to disable function deprecation warning.
329
+ #ifdef __clang__
330
+ # define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
331
+ _Pragma("clang diagnostic push") \
332
+ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
333
+ _Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"")
334
+ #define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
335
+ _Pragma("clang diagnostic pop")
336
+ #else
337
+ # define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
338
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
339
+ # define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
340
+ GTEST_DISABLE_MSC_WARNINGS_POP_()
341
+ #endif
342
+
343
+ // Brings in definitions for functions used in the testing::internal::posix
344
+ // namespace (read, write, close, chdir, isatty, stat). We do not currently
345
+ // use them on Windows Mobile.
346
+ #if GTEST_OS_WINDOWS
347
+ # if !GTEST_OS_WINDOWS_MOBILE
348
+ # include <direct.h>
349
+ # include <io.h>
350
+ # endif
351
+ // In order to avoid having to include <windows.h>, use forward declaration
352
+ #if GTEST_OS_WINDOWS_MINGW && !defined(__MINGW64_VERSION_MAJOR)
353
+ // MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two
354
+ // separate (equivalent) structs, instead of using typedef
355
+ typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
356
+ #else
357
+ // Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
358
+ // This assumption is verified by
359
+ // WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
360
+ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
361
+ #endif
362
+ #elif GTEST_OS_XTENSA
363
+ #include <unistd.h>
364
+ // Xtensa toolchains define strcasecmp in the string.h header instead of
365
+ // strings.h. string.h is already included.
366
+ #else
367
+ // This assumes that non-Windows OSes provide unistd.h. For OSes where this
368
+ // is not the case, we need to include headers that provide the functions
369
+ // mentioned above.
370
+ # include <unistd.h>
371
+ # include <strings.h>
372
+ #endif // GTEST_OS_WINDOWS
373
+
374
+ #if GTEST_OS_LINUX_ANDROID
375
+ // Used to define __ANDROID_API__ matching the target NDK API level.
376
+ # include <android/api-level.h> // NOLINT
377
+ #endif
378
+
379
+ // Defines this to true if and only if Google Test can use POSIX regular
380
+ // expressions.
381
+ #ifndef GTEST_HAS_POSIX_RE
382
+ # if GTEST_OS_LINUX_ANDROID
383
+ // On Android, <regex.h> is only available starting with Gingerbread.
384
+ # define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
385
+ # else
386
+ #define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS && !GTEST_OS_XTENSA)
387
+ # endif
388
+ #endif
389
+
390
+ #if GTEST_USES_PCRE
391
+ // The appropriate headers have already been included.
392
+
393
+ #elif GTEST_HAS_POSIX_RE
394
+
395
+ // On some platforms, <regex.h> needs someone to define size_t, and
396
+ // won't compile otherwise. We can #include it here as we already
397
+ // included <stdlib.h>, which is guaranteed to define size_t through
398
+ // <stddef.h>.
399
+ # include <regex.h> // NOLINT
400
+
401
+ # define GTEST_USES_POSIX_RE 1
402
+
403
+ #elif GTEST_OS_WINDOWS
404
+
405
+ // <regex.h> is not available on Windows. Use our own simple regex
406
+ // implementation instead.
407
+ # define GTEST_USES_SIMPLE_RE 1
408
+
409
+ #else
410
+
411
+ // <regex.h> may not be available on this platform. Use our own
412
+ // simple regex implementation instead.
413
+ # define GTEST_USES_SIMPLE_RE 1
414
+
415
+ #endif // GTEST_USES_PCRE
416
+
417
+ #ifndef GTEST_HAS_EXCEPTIONS
418
+ // The user didn't tell us whether exceptions are enabled, so we need
419
+ // to figure it out.
420
+ # if defined(_MSC_VER) && defined(_CPPUNWIND)
421
+ // MSVC defines _CPPUNWIND to 1 if and only if exceptions are enabled.
422
+ # define GTEST_HAS_EXCEPTIONS 1
423
+ # elif defined(__BORLANDC__)
424
+ // C++Builder's implementation of the STL uses the _HAS_EXCEPTIONS
425
+ // macro to enable exceptions, so we'll do the same.
426
+ // Assumes that exceptions are enabled by default.
427
+ # ifndef _HAS_EXCEPTIONS
428
+ # define _HAS_EXCEPTIONS 1
429
+ # endif // _HAS_EXCEPTIONS
430
+ # define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
431
+ # elif defined(__clang__)
432
+ // clang defines __EXCEPTIONS if and only if exceptions are enabled before clang
433
+ // 220714, but if and only if cleanups are enabled after that. In Obj-C++ files,
434
+ // there can be cleanups for ObjC exceptions which also need cleanups, even if
435
+ // C++ exceptions are disabled. clang has __has_feature(cxx_exceptions) which
436
+ // checks for C++ exceptions starting at clang r206352, but which checked for
437
+ // cleanups prior to that. To reliably check for C++ exception availability with
438
+ // clang, check for
439
+ // __EXCEPTIONS && __has_feature(cxx_exceptions).
440
+ # define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions))
441
+ # elif defined(__GNUC__) && __EXCEPTIONS
442
+ // gcc defines __EXCEPTIONS to 1 if and only if exceptions are enabled.
443
+ # define GTEST_HAS_EXCEPTIONS 1
444
+ # elif defined(__SUNPRO_CC)
445
+ // Sun Pro CC supports exceptions. However, there is no compile-time way of
446
+ // detecting whether they are enabled or not. Therefore, we assume that
447
+ // they are enabled unless the user tells us otherwise.
448
+ # define GTEST_HAS_EXCEPTIONS 1
449
+ # elif defined(__IBMCPP__) && __EXCEPTIONS
450
+ // xlC defines __EXCEPTIONS to 1 if and only if exceptions are enabled.
451
+ # define GTEST_HAS_EXCEPTIONS 1
452
+ # elif defined(__HP_aCC)
453
+ // Exception handling is in effect by default in HP aCC compiler. It has to
454
+ // be turned of by +noeh compiler option if desired.
455
+ # define GTEST_HAS_EXCEPTIONS 1
456
+ # else
457
+ // For other compilers, we assume exceptions are disabled to be
458
+ // conservative.
459
+ # define GTEST_HAS_EXCEPTIONS 0
460
+ # endif // defined(_MSC_VER) || defined(__BORLANDC__)
461
+ #endif // GTEST_HAS_EXCEPTIONS
462
+
463
+ #ifndef GTEST_HAS_STD_WSTRING
464
+ // The user didn't tell us whether ::std::wstring is available, so we need
465
+ // to figure it out.
466
+ // Cygwin 1.7 and below doesn't support ::std::wstring.
467
+ // Solaris' libc++ doesn't support it either. Android has
468
+ // no support for it at least as recent as Froyo (2.2).
469
+ #define GTEST_HAS_STD_WSTRING \
470
+ (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
471
+ GTEST_OS_HAIKU || GTEST_OS_ESP32 || GTEST_OS_ESP8266 || GTEST_OS_XTENSA))
472
+
473
+ #endif // GTEST_HAS_STD_WSTRING
474
+
475
+ // Determines whether RTTI is available.
476
+ #ifndef GTEST_HAS_RTTI
477
+ // The user didn't tell us whether RTTI is enabled, so we need to
478
+ // figure it out.
479
+
480
+ # ifdef _MSC_VER
481
+
482
+ #ifdef _CPPRTTI // MSVC defines this macro if and only if RTTI is enabled.
483
+ # define GTEST_HAS_RTTI 1
484
+ # else
485
+ # define GTEST_HAS_RTTI 0
486
+ # endif
487
+
488
+ // Starting with version 4.3.2, gcc defines __GXX_RTTI if and only if RTTI is
489
+ // enabled.
490
+ # elif defined(__GNUC__)
491
+
492
+ # ifdef __GXX_RTTI
493
+ // When building against STLport with the Android NDK and with
494
+ // -frtti -fno-exceptions, the build fails at link time with undefined
495
+ // references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
496
+ // so disable RTTI when detected.
497
+ # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
498
+ !defined(__EXCEPTIONS)
499
+ # define GTEST_HAS_RTTI 0
500
+ # else
501
+ # define GTEST_HAS_RTTI 1
502
+ # endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
503
+ # else
504
+ # define GTEST_HAS_RTTI 0
505
+ # endif // __GXX_RTTI
506
+
507
+ // Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
508
+ // using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
509
+ // first version with C++ support.
510
+ # elif defined(__clang__)
511
+
512
+ # define GTEST_HAS_RTTI __has_feature(cxx_rtti)
513
+
514
+ // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
515
+ // both the typeid and dynamic_cast features are present.
516
+ # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
517
+
518
+ # ifdef __RTTI_ALL__
519
+ # define GTEST_HAS_RTTI 1
520
+ # else
521
+ # define GTEST_HAS_RTTI 0
522
+ # endif
523
+
524
+ # else
525
+
526
+ // For all other compilers, we assume RTTI is enabled.
527
+ # define GTEST_HAS_RTTI 1
528
+
529
+ # endif // _MSC_VER
530
+
531
+ #endif // GTEST_HAS_RTTI
532
+
533
+ // It's this header's responsibility to #include <typeinfo> when RTTI
534
+ // is enabled.
535
+ #if GTEST_HAS_RTTI
536
+ # include <typeinfo>
537
+ #endif
538
+
539
+ // Determines whether Google Test can use the pthreads library.
540
+ #ifndef GTEST_HAS_PTHREAD
541
+ // The user didn't tell us explicitly, so we make reasonable assumptions about
542
+ // which platforms have pthreads support.
543
+ //
544
+ // To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
545
+ // to your compiler flags.
546
+ #define GTEST_HAS_PTHREAD \
547
+ (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX || GTEST_OS_QNX || \
548
+ GTEST_OS_FREEBSD || GTEST_OS_NACL || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA || \
549
+ GTEST_OS_DRAGONFLY || GTEST_OS_GNU_KFREEBSD || GTEST_OS_OPENBSD || \
550
+ GTEST_OS_HAIKU)
551
+ #endif // GTEST_HAS_PTHREAD
552
+
553
+ #if GTEST_HAS_PTHREAD
554
+ // gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
555
+ // true.
556
+ # include <pthread.h> // NOLINT
557
+
558
+ // For timespec and nanosleep, used below.
559
+ # include <time.h> // NOLINT
560
+ #endif
561
+
562
+ // Determines whether clone(2) is supported.
563
+ // Usually it will only be available on Linux, excluding
564
+ // Linux on the Itanium architecture.
565
+ // Also see http://linux.die.net/man/2/clone.
566
+ #ifndef GTEST_HAS_CLONE
567
+ // The user didn't tell us, so we need to figure it out.
568
+
569
+ # if GTEST_OS_LINUX && !defined(__ia64__)
570
+ # if GTEST_OS_LINUX_ANDROID
571
+ // On Android, clone() became available at different API levels for each 32-bit
572
+ // architecture.
573
+ # if defined(__LP64__) || \
574
+ (defined(__arm__) && __ANDROID_API__ >= 9) || \
575
+ (defined(__mips__) && __ANDROID_API__ >= 12) || \
576
+ (defined(__i386__) && __ANDROID_API__ >= 17)
577
+ # define GTEST_HAS_CLONE 1
578
+ # else
579
+ # define GTEST_HAS_CLONE 0
580
+ # endif
581
+ # else
582
+ # define GTEST_HAS_CLONE 1
583
+ # endif
584
+ # else
585
+ # define GTEST_HAS_CLONE 0
586
+ # endif // GTEST_OS_LINUX && !defined(__ia64__)
587
+
588
+ #endif // GTEST_HAS_CLONE
589
+
590
+ // Determines whether to support stream redirection. This is used to test
591
+ // output correctness and to implement death tests.
592
+ #ifndef GTEST_HAS_STREAM_REDIRECTION
593
+ // By default, we assume that stream redirection is supported on all
594
+ // platforms except known mobile ones.
595
+ #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
596
+ GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_XTENSA
597
+ # define GTEST_HAS_STREAM_REDIRECTION 0
598
+ # else
599
+ # define GTEST_HAS_STREAM_REDIRECTION 1
600
+ # endif // !GTEST_OS_WINDOWS_MOBILE
601
+ #endif // GTEST_HAS_STREAM_REDIRECTION
602
+
603
+ // Determines whether to support death tests.
604
+ // pops up a dialog window that cannot be suppressed programmatically.
605
+ #if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
606
+ (GTEST_OS_MAC && !GTEST_OS_IOS) || \
607
+ (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER) || GTEST_OS_WINDOWS_MINGW || \
608
+ GTEST_OS_AIX || GTEST_OS_HPUX || GTEST_OS_OPENBSD || GTEST_OS_QNX || \
609
+ GTEST_OS_FREEBSD || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA || \
610
+ GTEST_OS_DRAGONFLY || GTEST_OS_GNU_KFREEBSD || GTEST_OS_HAIKU)
611
+ # define GTEST_HAS_DEATH_TEST 1
612
+ #endif
613
+
614
+ // Determines whether to support type-driven tests.
615
+
616
+ // Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
617
+ // Sun Pro CC, IBM Visual Age, and HP aCC support.
618
+ #if defined(__GNUC__) || defined(_MSC_VER) || defined(__SUNPRO_CC) || \
619
+ defined(__IBMCPP__) || defined(__HP_aCC)
620
+ # define GTEST_HAS_TYPED_TEST 1
621
+ # define GTEST_HAS_TYPED_TEST_P 1
622
+ #endif
623
+
624
+ // Determines whether the system compiler uses UTF-16 for encoding wide strings.
625
+ #define GTEST_WIDE_STRING_USES_UTF16_ \
626
+ (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_AIX || GTEST_OS_OS2)
627
+
628
+ // Determines whether test results can be streamed to a socket.
629
+ #if GTEST_OS_LINUX || GTEST_OS_GNU_KFREEBSD || GTEST_OS_DRAGONFLY || \
630
+ GTEST_OS_FREEBSD || GTEST_OS_NETBSD || GTEST_OS_OPENBSD
631
+ # define GTEST_CAN_STREAM_RESULTS_ 1
632
+ #endif
633
+
634
+ // Defines some utility macros.
635
+
636
+ // The GNU compiler emits a warning if nested "if" statements are followed by
637
+ // an "else" statement and braces are not used to explicitly disambiguate the
638
+ // "else" binding. This leads to problems with code like:
639
+ //
640
+ // if (gate)
641
+ // ASSERT_*(condition) << "Some message";
642
+ //
643
+ // The "switch (0) case 0:" idiom is used to suppress this.
644
+ #ifdef __INTEL_COMPILER
645
+ # define GTEST_AMBIGUOUS_ELSE_BLOCKER_
646
+ #else
647
+ # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT
648
+ #endif
649
+
650
+ // Use this annotation at the end of a struct/class definition to
651
+ // prevent the compiler from optimizing away instances that are never
652
+ // used. This is useful when all interesting logic happens inside the
653
+ // c'tor and / or d'tor. Example:
654
+ //
655
+ // struct Foo {
656
+ // Foo() { ... }
657
+ // } GTEST_ATTRIBUTE_UNUSED_;
658
+ //
659
+ // Also use it after a variable or parameter declaration to tell the
660
+ // compiler the variable/parameter does not have to be used.
661
+ #if defined(__GNUC__) && !defined(COMPILER_ICC)
662
+ # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
663
+ #elif defined(__clang__)
664
+ # if __has_attribute(unused)
665
+ # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
666
+ # endif
667
+ #endif
668
+ #ifndef GTEST_ATTRIBUTE_UNUSED_
669
+ # define GTEST_ATTRIBUTE_UNUSED_
670
+ #endif
671
+
672
+ // Use this annotation before a function that takes a printf format string.
673
+ #if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC)
674
+ # if defined(__MINGW_PRINTF_FORMAT)
675
+ // MinGW has two different printf implementations. Ensure the format macro
676
+ // matches the selected implementation. See
677
+ // https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/.
678
+ # define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
679
+ __attribute__((__format__(__MINGW_PRINTF_FORMAT, string_index, \
680
+ first_to_check)))
681
+ # else
682
+ # define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
683
+ __attribute__((__format__(__printf__, string_index, first_to_check)))
684
+ # endif
685
+ #else
686
+ # define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
687
+ #endif
688
+
689
+
690
+ // A macro to disallow copy operator=
691
+ // This should be used in the private: declarations for a class.
692
+ #define GTEST_DISALLOW_ASSIGN_(type) \
693
+ type& operator=(type const &) = delete
694
+
695
+ // A macro to disallow copy constructor and operator=
696
+ // This should be used in the private: declarations for a class.
697
+ #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \
698
+ type(type const&) = delete; \
699
+ type& operator=(type const&) = delete
700
+
701
+ // A macro to disallow move operator=
702
+ // This should be used in the private: declarations for a class.
703
+ #define GTEST_DISALLOW_MOVE_ASSIGN_(type) \
704
+ type& operator=(type &&) noexcept = delete
705
+
706
+ // A macro to disallow move constructor and operator=
707
+ // This should be used in the private: declarations for a class.
708
+ #define GTEST_DISALLOW_MOVE_AND_ASSIGN_(type) \
709
+ type(type&&) noexcept = delete; \
710
+ type& operator=(type&&) noexcept = delete
711
+
712
+ // Tell the compiler to warn about unused return values for functions declared
713
+ // with this macro. The macro should be used on function declarations
714
+ // following the argument list:
715
+ //
716
+ // Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
717
+ #if defined(__GNUC__) && !defined(COMPILER_ICC)
718
+ # define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
719
+ #else
720
+ # define GTEST_MUST_USE_RESULT_
721
+ #endif // __GNUC__ && !COMPILER_ICC
722
+
723
+ // MS C++ compiler emits warning when a conditional expression is compile time
724
+ // constant. In some contexts this warning is false positive and needs to be
725
+ // suppressed. Use the following two macros in such cases:
726
+ //
727
+ // GTEST_INTENTIONAL_CONST_COND_PUSH_()
728
+ // while (true) {
729
+ // GTEST_INTENTIONAL_CONST_COND_POP_()
730
+ // }
731
+ # define GTEST_INTENTIONAL_CONST_COND_PUSH_() \
732
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127)
733
+ # define GTEST_INTENTIONAL_CONST_COND_POP_() \
734
+ GTEST_DISABLE_MSC_WARNINGS_POP_()
735
+
736
+ // Determine whether the compiler supports Microsoft's Structured Exception
737
+ // Handling. This is supported by several Windows compilers but generally
738
+ // does not exist on any other system.
739
+ #ifndef GTEST_HAS_SEH
740
+ // The user didn't tell us, so we need to figure it out.
741
+
742
+ # if defined(_MSC_VER) || defined(__BORLANDC__)
743
+ // These two compilers are known to support SEH.
744
+ # define GTEST_HAS_SEH 1
745
+ # else
746
+ // Assume no SEH.
747
+ # define GTEST_HAS_SEH 0
748
+ # endif
749
+
750
+ #endif // GTEST_HAS_SEH
751
+
752
+ #ifndef GTEST_IS_THREADSAFE
753
+
754
+ #define GTEST_IS_THREADSAFE \
755
+ (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ || \
756
+ (GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT) || \
757
+ GTEST_HAS_PTHREAD)
758
+
759
+ #endif // GTEST_IS_THREADSAFE
760
+
761
+ // GTEST_API_ qualifies all symbols that must be exported. The definitions below
762
+ // are guarded by #ifndef to give embedders a chance to define GTEST_API_ in
763
+ // gtest/internal/custom/gtest-port.h
764
+ #ifndef GTEST_API_
765
+
766
+ #ifdef _MSC_VER
767
+ # if GTEST_LINKED_AS_SHARED_LIBRARY
768
+ # define GTEST_API_ __declspec(dllimport)
769
+ # elif GTEST_CREATE_SHARED_LIBRARY
770
+ # define GTEST_API_ __declspec(dllexport)
771
+ # endif
772
+ #elif __GNUC__ >= 4 || defined(__clang__)
773
+ # define GTEST_API_ __attribute__((visibility ("default")))
774
+ #endif // _MSC_VER
775
+
776
+ #endif // GTEST_API_
777
+
778
+ #ifndef GTEST_API_
779
+ # define GTEST_API_
780
+ #endif // GTEST_API_
781
+
782
+ #ifndef GTEST_DEFAULT_DEATH_TEST_STYLE
783
+ # define GTEST_DEFAULT_DEATH_TEST_STYLE "fast"
784
+ #endif // GTEST_DEFAULT_DEATH_TEST_STYLE
785
+
786
+ #ifdef __GNUC__
787
+ // Ask the compiler to never inline a given function.
788
+ # define GTEST_NO_INLINE_ __attribute__((noinline))
789
+ #else
790
+ # define GTEST_NO_INLINE_
791
+ #endif
792
+
793
+ // _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
794
+ #if !defined(GTEST_HAS_CXXABI_H_)
795
+ # if defined(__GLIBCXX__) || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER))
796
+ # define GTEST_HAS_CXXABI_H_ 1
797
+ # else
798
+ # define GTEST_HAS_CXXABI_H_ 0
799
+ # endif
800
+ #endif
801
+
802
+ // A function level attribute to disable checking for use of uninitialized
803
+ // memory when built with MemorySanitizer.
804
+ #if defined(__clang__)
805
+ # if __has_feature(memory_sanitizer)
806
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \
807
+ __attribute__((no_sanitize_memory))
808
+ # else
809
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
810
+ # endif // __has_feature(memory_sanitizer)
811
+ #else
812
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
813
+ #endif // __clang__
814
+
815
+ // A function level attribute to disable AddressSanitizer instrumentation.
816
+ #if defined(__clang__)
817
+ # if __has_feature(address_sanitizer)
818
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \
819
+ __attribute__((no_sanitize_address))
820
+ # else
821
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
822
+ # endif // __has_feature(address_sanitizer)
823
+ #else
824
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
825
+ #endif // __clang__
826
+
827
+ // A function level attribute to disable HWAddressSanitizer instrumentation.
828
+ #if defined(__clang__)
829
+ # if __has_feature(hwaddress_sanitizer)
830
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ \
831
+ __attribute__((no_sanitize("hwaddress")))
832
+ # else
833
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
834
+ # endif // __has_feature(hwaddress_sanitizer)
835
+ #else
836
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
837
+ #endif // __clang__
838
+
839
+ // A function level attribute to disable ThreadSanitizer instrumentation.
840
+ #if defined(__clang__)
841
+ # if __has_feature(thread_sanitizer)
842
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \
843
+ __attribute__((no_sanitize_thread))
844
+ # else
845
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
846
+ # endif // __has_feature(thread_sanitizer)
847
+ #else
848
+ # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
849
+ #endif // __clang__
850
+
851
+ namespace testing {
852
+
853
+ class Message;
854
+
855
+ // Legacy imports for backwards compatibility.
856
+ // New code should use std:: names directly.
857
+ using std::get;
858
+ using std::make_tuple;
859
+ using std::tuple;
860
+ using std::tuple_element;
861
+ using std::tuple_size;
862
+
863
+ namespace internal {
864
+
865
+ // A secret type that Google Test users don't know about. It has no
866
+ // definition on purpose. Therefore it's impossible to create a
867
+ // Secret object, which is what we want.
868
+ class Secret;
869
+
870
+ // The GTEST_COMPILE_ASSERT_ is a legacy macro used to verify that a compile
871
+ // time expression is true (in new code, use static_assert instead). For
872
+ // example, you could use it to verify the size of a static array:
873
+ //
874
+ // GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
875
+ // names_incorrect_size);
876
+ //
877
+ // The second argument to the macro must be a valid C++ identifier. If the
878
+ // expression is false, compiler will issue an error containing this identifier.
879
+ #define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg)
880
+
881
+ // A helper for suppressing warnings on constant condition. It just
882
+ // returns 'condition'.
883
+ GTEST_API_ bool IsTrue(bool condition);
884
+
885
+ // Defines RE.
886
+
887
+ #if GTEST_USES_PCRE
888
+ // if used, PCRE is injected by custom/gtest-port.h
889
+ #elif GTEST_USES_POSIX_RE || GTEST_USES_SIMPLE_RE
890
+
891
+ // A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
892
+ // Regular Expression syntax.
893
+ class GTEST_API_ RE {
894
+ public:
895
+ // A copy constructor is required by the Standard to initialize object
896
+ // references from r-values.
897
+ RE(const RE& other) { Init(other.pattern()); }
898
+
899
+ // Constructs an RE from a string.
900
+ RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
901
+
902
+ RE(const char* regex) { Init(regex); } // NOLINT
903
+ ~RE();
904
+
905
+ // Returns the string representation of the regex.
906
+ const char* pattern() const { return pattern_; }
907
+
908
+ // FullMatch(str, re) returns true if and only if regular expression re
909
+ // matches the entire str.
910
+ // PartialMatch(str, re) returns true if and only if regular expression re
911
+ // matches a substring of str (including str itself).
912
+ static bool FullMatch(const ::std::string& str, const RE& re) {
913
+ return FullMatch(str.c_str(), re);
914
+ }
915
+ static bool PartialMatch(const ::std::string& str, const RE& re) {
916
+ return PartialMatch(str.c_str(), re);
917
+ }
918
+
919
+ static bool FullMatch(const char* str, const RE& re);
920
+ static bool PartialMatch(const char* str, const RE& re);
921
+
922
+ private:
923
+ void Init(const char* regex);
924
+ const char* pattern_;
925
+ bool is_valid_;
926
+
927
+ # if GTEST_USES_POSIX_RE
928
+
929
+ regex_t full_regex_; // For FullMatch().
930
+ regex_t partial_regex_; // For PartialMatch().
931
+
932
+ # else // GTEST_USES_SIMPLE_RE
933
+
934
+ const char* full_pattern_; // For FullMatch();
935
+
936
+ # endif
937
+ };
938
+
939
+ #endif // GTEST_USES_PCRE
940
+
941
+ // Formats a source file path and a line number as they would appear
942
+ // in an error message from the compiler used to compile this code.
943
+ GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
944
+
945
+ // Formats a file location for compiler-independent XML output.
946
+ // Although this function is not platform dependent, we put it next to
947
+ // FormatFileLocation in order to contrast the two functions.
948
+ GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
949
+ int line);
950
+
951
+ // Defines logging utilities:
952
+ // GTEST_LOG_(severity) - logs messages at the specified severity level. The
953
+ // message itself is streamed into the macro.
954
+ // LogToStderr() - directs all log messages to stderr.
955
+ // FlushInfoLog() - flushes informational log messages.
956
+
957
+ enum GTestLogSeverity {
958
+ GTEST_INFO,
959
+ GTEST_WARNING,
960
+ GTEST_ERROR,
961
+ GTEST_FATAL
962
+ };
963
+
964
+ // Formats log entry severity, provides a stream object for streaming the
965
+ // log message, and terminates the message with a newline when going out of
966
+ // scope.
967
+ class GTEST_API_ GTestLog {
968
+ public:
969
+ GTestLog(GTestLogSeverity severity, const char* file, int line);
970
+
971
+ // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
972
+ ~GTestLog();
973
+
974
+ ::std::ostream& GetStream() { return ::std::cerr; }
975
+
976
+ private:
977
+ const GTestLogSeverity severity_;
978
+
979
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
980
+ };
981
+
982
+ #if !defined(GTEST_LOG_)
983
+
984
+ # define GTEST_LOG_(severity) \
985
+ ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
986
+ __FILE__, __LINE__).GetStream()
987
+
988
+ inline void LogToStderr() {}
989
+ inline void FlushInfoLog() { fflush(nullptr); }
990
+
991
+ #endif // !defined(GTEST_LOG_)
992
+
993
+ #if !defined(GTEST_CHECK_)
994
+ // INTERNAL IMPLEMENTATION - DO NOT USE.
995
+ //
996
+ // GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
997
+ // is not satisfied.
998
+ // Synopsys:
999
+ // GTEST_CHECK_(boolean_condition);
1000
+ // or
1001
+ // GTEST_CHECK_(boolean_condition) << "Additional message";
1002
+ //
1003
+ // This checks the condition and if the condition is not satisfied
1004
+ // it prints message about the condition violation, including the
1005
+ // condition itself, plus additional message streamed into it, if any,
1006
+ // and then it aborts the program. It aborts the program irrespective of
1007
+ // whether it is built in the debug mode or not.
1008
+ # define GTEST_CHECK_(condition) \
1009
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1010
+ if (::testing::internal::IsTrue(condition)) \
1011
+ ; \
1012
+ else \
1013
+ GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
1014
+ #endif // !defined(GTEST_CHECK_)
1015
+
1016
+ // An all-mode assert to verify that the given POSIX-style function
1017
+ // call returns 0 (indicating success). Known limitation: this
1018
+ // doesn't expand to a balanced 'if' statement, so enclose the macro
1019
+ // in {} if you need to use it as the only statement in an 'if'
1020
+ // branch.
1021
+ #define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
1022
+ if (const int gtest_error = (posix_call)) \
1023
+ GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
1024
+ << gtest_error
1025
+
1026
+ // Transforms "T" into "const T&" according to standard reference collapsing
1027
+ // rules (this is only needed as a backport for C++98 compilers that do not
1028
+ // support reference collapsing). Specifically, it transforms:
1029
+ //
1030
+ // char ==> const char&
1031
+ // const char ==> const char&
1032
+ // char& ==> char&
1033
+ // const char& ==> const char&
1034
+ //
1035
+ // Note that the non-const reference will not have "const" added. This is
1036
+ // standard, and necessary so that "T" can always bind to "const T&".
1037
+ template <typename T>
1038
+ struct ConstRef { typedef const T& type; };
1039
+ template <typename T>
1040
+ struct ConstRef<T&> { typedef T& type; };
1041
+
1042
+ // The argument T must depend on some template parameters.
1043
+ #define GTEST_REFERENCE_TO_CONST_(T) \
1044
+ typename ::testing::internal::ConstRef<T>::type
1045
+
1046
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
1047
+ //
1048
+ // Use ImplicitCast_ as a safe version of static_cast for upcasting in
1049
+ // the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
1050
+ // const Foo*). When you use ImplicitCast_, the compiler checks that
1051
+ // the cast is safe. Such explicit ImplicitCast_s are necessary in
1052
+ // surprisingly many situations where C++ demands an exact type match
1053
+ // instead of an argument type convertable to a target type.
1054
+ //
1055
+ // The syntax for using ImplicitCast_ is the same as for static_cast:
1056
+ //
1057
+ // ImplicitCast_<ToType>(expr)
1058
+ //
1059
+ // ImplicitCast_ would have been part of the C++ standard library,
1060
+ // but the proposal was submitted too late. It will probably make
1061
+ // its way into the language in the future.
1062
+ //
1063
+ // This relatively ugly name is intentional. It prevents clashes with
1064
+ // similar functions users may have (e.g., implicit_cast). The internal
1065
+ // namespace alone is not enough because the function can be found by ADL.
1066
+ template<typename To>
1067
+ inline To ImplicitCast_(To x) { return x; }
1068
+
1069
+ // When you upcast (that is, cast a pointer from type Foo to type
1070
+ // SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
1071
+ // always succeed. When you downcast (that is, cast a pointer from
1072
+ // type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
1073
+ // how do you know the pointer is really of type SubclassOfFoo? It
1074
+ // could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
1075
+ // when you downcast, you should use this macro. In debug mode, we
1076
+ // use dynamic_cast<> to double-check the downcast is legal (we die
1077
+ // if it's not). In normal mode, we do the efficient static_cast<>
1078
+ // instead. Thus, it's important to test in debug mode to make sure
1079
+ // the cast is legal!
1080
+ // This is the only place in the code we should use dynamic_cast<>.
1081
+ // In particular, you SHOULDN'T be using dynamic_cast<> in order to
1082
+ // do RTTI (eg code like this:
1083
+ // if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
1084
+ // if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
1085
+ // You should design the code some other way not to need this.
1086
+ //
1087
+ // This relatively ugly name is intentional. It prevents clashes with
1088
+ // similar functions users may have (e.g., down_cast). The internal
1089
+ // namespace alone is not enough because the function can be found by ADL.
1090
+ template<typename To, typename From> // use like this: DownCast_<T*>(foo);
1091
+ inline To DownCast_(From* f) { // so we only accept pointers
1092
+ // Ensures that To is a sub-type of From *. This test is here only
1093
+ // for compile-time type checking, and has no overhead in an
1094
+ // optimized build at run-time, as it will be optimized away
1095
+ // completely.
1096
+ GTEST_INTENTIONAL_CONST_COND_PUSH_()
1097
+ if (false) {
1098
+ GTEST_INTENTIONAL_CONST_COND_POP_()
1099
+ const To to = nullptr;
1100
+ ::testing::internal::ImplicitCast_<From*>(to);
1101
+ }
1102
+
1103
+ #if GTEST_HAS_RTTI
1104
+ // RTTI: debug mode only!
1105
+ GTEST_CHECK_(f == nullptr || dynamic_cast<To>(f) != nullptr);
1106
+ #endif
1107
+ return static_cast<To>(f);
1108
+ }
1109
+
1110
+ // Downcasts the pointer of type Base to Derived.
1111
+ // Derived must be a subclass of Base. The parameter MUST
1112
+ // point to a class of type Derived, not any subclass of it.
1113
+ // When RTTI is available, the function performs a runtime
1114
+ // check to enforce this.
1115
+ template <class Derived, class Base>
1116
+ Derived* CheckedDowncastToActualType(Base* base) {
1117
+ #if GTEST_HAS_RTTI
1118
+ GTEST_CHECK_(typeid(*base) == typeid(Derived));
1119
+ #endif
1120
+
1121
+ #if GTEST_HAS_DOWNCAST_
1122
+ return ::down_cast<Derived*>(base);
1123
+ #elif GTEST_HAS_RTTI
1124
+ return dynamic_cast<Derived*>(base); // NOLINT
1125
+ #else
1126
+ return static_cast<Derived*>(base); // Poor man's downcast.
1127
+ #endif
1128
+ }
1129
+
1130
+ #if GTEST_HAS_STREAM_REDIRECTION
1131
+
1132
+ // Defines the stderr capturer:
1133
+ // CaptureStdout - starts capturing stdout.
1134
+ // GetCapturedStdout - stops capturing stdout and returns the captured string.
1135
+ // CaptureStderr - starts capturing stderr.
1136
+ // GetCapturedStderr - stops capturing stderr and returns the captured string.
1137
+ //
1138
+ GTEST_API_ void CaptureStdout();
1139
+ GTEST_API_ std::string GetCapturedStdout();
1140
+ GTEST_API_ void CaptureStderr();
1141
+ GTEST_API_ std::string GetCapturedStderr();
1142
+
1143
+ #endif // GTEST_HAS_STREAM_REDIRECTION
1144
+ // Returns the size (in bytes) of a file.
1145
+ GTEST_API_ size_t GetFileSize(FILE* file);
1146
+
1147
+ // Reads the entire content of a file as a string.
1148
+ GTEST_API_ std::string ReadEntireFile(FILE* file);
1149
+
1150
+ // All command line arguments.
1151
+ GTEST_API_ std::vector<std::string> GetArgvs();
1152
+
1153
+ #if GTEST_HAS_DEATH_TEST
1154
+
1155
+ std::vector<std::string> GetInjectableArgvs();
1156
+ // Deprecated: pass the args vector by value instead.
1157
+ void SetInjectableArgvs(const std::vector<std::string>* new_argvs);
1158
+ void SetInjectableArgvs(const std::vector<std::string>& new_argvs);
1159
+ void ClearInjectableArgvs();
1160
+
1161
+ #endif // GTEST_HAS_DEATH_TEST
1162
+
1163
+ // Defines synchronization primitives.
1164
+ #if GTEST_IS_THREADSAFE
1165
+ # if GTEST_HAS_PTHREAD
1166
+ // Sleeps for (roughly) n milliseconds. This function is only for testing
1167
+ // Google Test's own constructs. Don't use it in user tests, either
1168
+ // directly or indirectly.
1169
+ inline void SleepMilliseconds(int n) {
1170
+ const timespec time = {
1171
+ 0, // 0 seconds.
1172
+ n * 1000L * 1000L, // And n ms.
1173
+ };
1174
+ nanosleep(&time, nullptr);
1175
+ }
1176
+ # endif // GTEST_HAS_PTHREAD
1177
+
1178
+ # if GTEST_HAS_NOTIFICATION_
1179
+ // Notification has already been imported into the namespace.
1180
+ // Nothing to do here.
1181
+
1182
+ # elif GTEST_HAS_PTHREAD
1183
+ // Allows a controller thread to pause execution of newly created
1184
+ // threads until notified. Instances of this class must be created
1185
+ // and destroyed in the controller thread.
1186
+ //
1187
+ // This class is only for testing Google Test's own constructs. Do not
1188
+ // use it in user tests, either directly or indirectly.
1189
+ class Notification {
1190
+ public:
1191
+ Notification() : notified_(false) {
1192
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, nullptr));
1193
+ }
1194
+ ~Notification() {
1195
+ pthread_mutex_destroy(&mutex_);
1196
+ }
1197
+
1198
+ // Notifies all threads created with this notification to start. Must
1199
+ // be called from the controller thread.
1200
+ void Notify() {
1201
+ pthread_mutex_lock(&mutex_);
1202
+ notified_ = true;
1203
+ pthread_mutex_unlock(&mutex_);
1204
+ }
1205
+
1206
+ // Blocks until the controller thread notifies. Must be called from a test
1207
+ // thread.
1208
+ void WaitForNotification() {
1209
+ for (;;) {
1210
+ pthread_mutex_lock(&mutex_);
1211
+ const bool notified = notified_;
1212
+ pthread_mutex_unlock(&mutex_);
1213
+ if (notified)
1214
+ break;
1215
+ SleepMilliseconds(10);
1216
+ }
1217
+ }
1218
+
1219
+ private:
1220
+ pthread_mutex_t mutex_;
1221
+ bool notified_;
1222
+
1223
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
1224
+ };
1225
+
1226
+ # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
1227
+
1228
+ GTEST_API_ void SleepMilliseconds(int n);
1229
+
1230
+ // Provides leak-safe Windows kernel handle ownership.
1231
+ // Used in death tests and in threading support.
1232
+ class GTEST_API_ AutoHandle {
1233
+ public:
1234
+ // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to
1235
+ // avoid including <windows.h> in this header file. Including <windows.h> is
1236
+ // undesirable because it defines a lot of symbols and macros that tend to
1237
+ // conflict with client code. This assumption is verified by
1238
+ // WindowsTypesTest.HANDLEIsVoidStar.
1239
+ typedef void* Handle;
1240
+ AutoHandle();
1241
+ explicit AutoHandle(Handle handle);
1242
+
1243
+ ~AutoHandle();
1244
+
1245
+ Handle Get() const;
1246
+ void Reset();
1247
+ void Reset(Handle handle);
1248
+
1249
+ private:
1250
+ // Returns true if and only if the handle is a valid handle object that can be
1251
+ // closed.
1252
+ bool IsCloseable() const;
1253
+
1254
+ Handle handle_;
1255
+
1256
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
1257
+ };
1258
+
1259
+ // Allows a controller thread to pause execution of newly created
1260
+ // threads until notified. Instances of this class must be created
1261
+ // and destroyed in the controller thread.
1262
+ //
1263
+ // This class is only for testing Google Test's own constructs. Do not
1264
+ // use it in user tests, either directly or indirectly.
1265
+ class GTEST_API_ Notification {
1266
+ public:
1267
+ Notification();
1268
+ void Notify();
1269
+ void WaitForNotification();
1270
+
1271
+ private:
1272
+ AutoHandle event_;
1273
+
1274
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
1275
+ };
1276
+ # endif // GTEST_HAS_NOTIFICATION_
1277
+
1278
+ // On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
1279
+ // defined, but we don't want to use MinGW's pthreads implementation, which
1280
+ // has conformance problems with some versions of the POSIX standard.
1281
+ # if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
1282
+
1283
+ // As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
1284
+ // Consequently, it cannot select a correct instantiation of ThreadWithParam
1285
+ // in order to call its Run(). Introducing ThreadWithParamBase as a
1286
+ // non-templated base class for ThreadWithParam allows us to bypass this
1287
+ // problem.
1288
+ class ThreadWithParamBase {
1289
+ public:
1290
+ virtual ~ThreadWithParamBase() {}
1291
+ virtual void Run() = 0;
1292
+ };
1293
+
1294
+ // pthread_create() accepts a pointer to a function type with the C linkage.
1295
+ // According to the Standard (7.5/1), function types with different linkages
1296
+ // are different even if they are otherwise identical. Some compilers (for
1297
+ // example, SunStudio) treat them as different types. Since class methods
1298
+ // cannot be defined with C-linkage we need to define a free C-function to
1299
+ // pass into pthread_create().
1300
+ extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
1301
+ static_cast<ThreadWithParamBase*>(thread)->Run();
1302
+ return nullptr;
1303
+ }
1304
+
1305
+ // Helper class for testing Google Test's multi-threading constructs.
1306
+ // To use it, write:
1307
+ //
1308
+ // void ThreadFunc(int param) { /* Do things with param */ }
1309
+ // Notification thread_can_start;
1310
+ // ...
1311
+ // // The thread_can_start parameter is optional; you can supply NULL.
1312
+ // ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
1313
+ // thread_can_start.Notify();
1314
+ //
1315
+ // These classes are only for testing Google Test's own constructs. Do
1316
+ // not use them in user tests, either directly or indirectly.
1317
+ template <typename T>
1318
+ class ThreadWithParam : public ThreadWithParamBase {
1319
+ public:
1320
+ typedef void UserThreadFunc(T);
1321
+
1322
+ ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
1323
+ : func_(func),
1324
+ param_(param),
1325
+ thread_can_start_(thread_can_start),
1326
+ finished_(false) {
1327
+ ThreadWithParamBase* const base = this;
1328
+ // The thread can be created only after all fields except thread_
1329
+ // have been initialized.
1330
+ GTEST_CHECK_POSIX_SUCCESS_(
1331
+ pthread_create(&thread_, nullptr, &ThreadFuncWithCLinkage, base));
1332
+ }
1333
+ ~ThreadWithParam() override { Join(); }
1334
+
1335
+ void Join() {
1336
+ if (!finished_) {
1337
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, nullptr));
1338
+ finished_ = true;
1339
+ }
1340
+ }
1341
+
1342
+ void Run() override {
1343
+ if (thread_can_start_ != nullptr) thread_can_start_->WaitForNotification();
1344
+ func_(param_);
1345
+ }
1346
+
1347
+ private:
1348
+ UserThreadFunc* const func_; // User-supplied thread function.
1349
+ const T param_; // User-supplied parameter to the thread function.
1350
+ // When non-NULL, used to block execution until the controller thread
1351
+ // notifies.
1352
+ Notification* const thread_can_start_;
1353
+ bool finished_; // true if and only if we know that the thread function has
1354
+ // finished.
1355
+ pthread_t thread_; // The native thread object.
1356
+
1357
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
1358
+ };
1359
+ # endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD ||
1360
+ // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
1361
+
1362
+ # if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
1363
+ // Mutex and ThreadLocal have already been imported into the namespace.
1364
+ // Nothing to do here.
1365
+
1366
+ # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
1367
+
1368
+ // Mutex implements mutex on Windows platforms. It is used in conjunction
1369
+ // with class MutexLock:
1370
+ //
1371
+ // Mutex mutex;
1372
+ // ...
1373
+ // MutexLock lock(&mutex); // Acquires the mutex and releases it at the
1374
+ // // end of the current scope.
1375
+ //
1376
+ // A static Mutex *must* be defined or declared using one of the following
1377
+ // macros:
1378
+ // GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
1379
+ // GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
1380
+ //
1381
+ // (A non-static Mutex is defined/declared in the usual way).
1382
+ class GTEST_API_ Mutex {
1383
+ public:
1384
+ enum MutexType { kStatic = 0, kDynamic = 1 };
1385
+ // We rely on kStaticMutex being 0 as it is to what the linker initializes
1386
+ // type_ in static mutexes. critical_section_ will be initialized lazily
1387
+ // in ThreadSafeLazyInit().
1388
+ enum StaticConstructorSelector { kStaticMutex = 0 };
1389
+
1390
+ // This constructor intentionally does nothing. It relies on type_ being
1391
+ // statically initialized to 0 (effectively setting it to kStatic) and on
1392
+ // ThreadSafeLazyInit() to lazily initialize the rest of the members.
1393
+ explicit Mutex(StaticConstructorSelector /*dummy*/) {}
1394
+
1395
+ Mutex();
1396
+ ~Mutex();
1397
+
1398
+ void Lock();
1399
+
1400
+ void Unlock();
1401
+
1402
+ // Does nothing if the current thread holds the mutex. Otherwise, crashes
1403
+ // with high probability.
1404
+ void AssertHeld();
1405
+
1406
+ private:
1407
+ // Initializes owner_thread_id_ and critical_section_ in static mutexes.
1408
+ void ThreadSafeLazyInit();
1409
+
1410
+ // Per https://blogs.msdn.microsoft.com/oldnewthing/20040223-00/?p=40503,
1411
+ // we assume that 0 is an invalid value for thread IDs.
1412
+ unsigned int owner_thread_id_;
1413
+
1414
+ // For static mutexes, we rely on these members being initialized to zeros
1415
+ // by the linker.
1416
+ MutexType type_;
1417
+ long critical_section_init_phase_; // NOLINT
1418
+ GTEST_CRITICAL_SECTION* critical_section_;
1419
+
1420
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
1421
+ };
1422
+
1423
+ # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
1424
+ extern ::testing::internal::Mutex mutex
1425
+
1426
+ # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
1427
+ ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex)
1428
+
1429
+ // We cannot name this class MutexLock because the ctor declaration would
1430
+ // conflict with a macro named MutexLock, which is defined on some
1431
+ // platforms. That macro is used as a defensive measure to prevent against
1432
+ // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
1433
+ // "MutexLock l(&mu)". Hence the typedef trick below.
1434
+ class GTestMutexLock {
1435
+ public:
1436
+ explicit GTestMutexLock(Mutex* mutex)
1437
+ : mutex_(mutex) { mutex_->Lock(); }
1438
+
1439
+ ~GTestMutexLock() { mutex_->Unlock(); }
1440
+
1441
+ private:
1442
+ Mutex* const mutex_;
1443
+
1444
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
1445
+ };
1446
+
1447
+ typedef GTestMutexLock MutexLock;
1448
+
1449
+ // Base class for ValueHolder<T>. Allows a caller to hold and delete a value
1450
+ // without knowing its type.
1451
+ class ThreadLocalValueHolderBase {
1452
+ public:
1453
+ virtual ~ThreadLocalValueHolderBase() {}
1454
+ };
1455
+
1456
+ // Provides a way for a thread to send notifications to a ThreadLocal
1457
+ // regardless of its parameter type.
1458
+ class ThreadLocalBase {
1459
+ public:
1460
+ // Creates a new ValueHolder<T> object holding a default value passed to
1461
+ // this ThreadLocal<T>'s constructor and returns it. It is the caller's
1462
+ // responsibility not to call this when the ThreadLocal<T> instance already
1463
+ // has a value on the current thread.
1464
+ virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0;
1465
+
1466
+ protected:
1467
+ ThreadLocalBase() {}
1468
+ virtual ~ThreadLocalBase() {}
1469
+
1470
+ private:
1471
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase);
1472
+ };
1473
+
1474
+ // Maps a thread to a set of ThreadLocals that have values instantiated on that
1475
+ // thread and notifies them when the thread exits. A ThreadLocal instance is
1476
+ // expected to persist until all threads it has values on have terminated.
1477
+ class GTEST_API_ ThreadLocalRegistry {
1478
+ public:
1479
+ // Registers thread_local_instance as having value on the current thread.
1480
+ // Returns a value that can be used to identify the thread from other threads.
1481
+ static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
1482
+ const ThreadLocalBase* thread_local_instance);
1483
+
1484
+ // Invoked when a ThreadLocal instance is destroyed.
1485
+ static void OnThreadLocalDestroyed(
1486
+ const ThreadLocalBase* thread_local_instance);
1487
+ };
1488
+
1489
+ class GTEST_API_ ThreadWithParamBase {
1490
+ public:
1491
+ void Join();
1492
+
1493
+ protected:
1494
+ class Runnable {
1495
+ public:
1496
+ virtual ~Runnable() {}
1497
+ virtual void Run() = 0;
1498
+ };
1499
+
1500
+ ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start);
1501
+ virtual ~ThreadWithParamBase();
1502
+
1503
+ private:
1504
+ AutoHandle thread_;
1505
+ };
1506
+
1507
+ // Helper class for testing Google Test's multi-threading constructs.
1508
+ template <typename T>
1509
+ class ThreadWithParam : public ThreadWithParamBase {
1510
+ public:
1511
+ typedef void UserThreadFunc(T);
1512
+
1513
+ ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
1514
+ : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {
1515
+ }
1516
+ virtual ~ThreadWithParam() {}
1517
+
1518
+ private:
1519
+ class RunnableImpl : public Runnable {
1520
+ public:
1521
+ RunnableImpl(UserThreadFunc* func, T param)
1522
+ : func_(func),
1523
+ param_(param) {
1524
+ }
1525
+ virtual ~RunnableImpl() {}
1526
+ virtual void Run() {
1527
+ func_(param_);
1528
+ }
1529
+
1530
+ private:
1531
+ UserThreadFunc* const func_;
1532
+ const T param_;
1533
+
1534
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl);
1535
+ };
1536
+
1537
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
1538
+ };
1539
+
1540
+ // Implements thread-local storage on Windows systems.
1541
+ //
1542
+ // // Thread 1
1543
+ // ThreadLocal<int> tl(100); // 100 is the default value for each thread.
1544
+ //
1545
+ // // Thread 2
1546
+ // tl.set(150); // Changes the value for thread 2 only.
1547
+ // EXPECT_EQ(150, tl.get());
1548
+ //
1549
+ // // Thread 1
1550
+ // EXPECT_EQ(100, tl.get()); // In thread 1, tl has the original value.
1551
+ // tl.set(200);
1552
+ // EXPECT_EQ(200, tl.get());
1553
+ //
1554
+ // The template type argument T must have a public copy constructor.
1555
+ // In addition, the default ThreadLocal constructor requires T to have
1556
+ // a public default constructor.
1557
+ //
1558
+ // The users of a TheadLocal instance have to make sure that all but one
1559
+ // threads (including the main one) using that instance have exited before
1560
+ // destroying it. Otherwise, the per-thread objects managed for them by the
1561
+ // ThreadLocal instance are not guaranteed to be destroyed on all platforms.
1562
+ //
1563
+ // Google Test only uses global ThreadLocal objects. That means they
1564
+ // will die after main() has returned. Therefore, no per-thread
1565
+ // object managed by Google Test will be leaked as long as all threads
1566
+ // using Google Test have exited when main() returns.
1567
+ template <typename T>
1568
+ class ThreadLocal : public ThreadLocalBase {
1569
+ public:
1570
+ ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {}
1571
+ explicit ThreadLocal(const T& value)
1572
+ : default_factory_(new InstanceValueHolderFactory(value)) {}
1573
+
1574
+ ~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); }
1575
+
1576
+ T* pointer() { return GetOrCreateValue(); }
1577
+ const T* pointer() const { return GetOrCreateValue(); }
1578
+ const T& get() const { return *pointer(); }
1579
+ void set(const T& value) { *pointer() = value; }
1580
+
1581
+ private:
1582
+ // Holds a value of T. Can be deleted via its base class without the caller
1583
+ // knowing the type of T.
1584
+ class ValueHolder : public ThreadLocalValueHolderBase {
1585
+ public:
1586
+ ValueHolder() : value_() {}
1587
+ explicit ValueHolder(const T& value) : value_(value) {}
1588
+
1589
+ T* pointer() { return &value_; }
1590
+
1591
+ private:
1592
+ T value_;
1593
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
1594
+ };
1595
+
1596
+
1597
+ T* GetOrCreateValue() const {
1598
+ return static_cast<ValueHolder*>(
1599
+ ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer();
1600
+ }
1601
+
1602
+ virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const {
1603
+ return default_factory_->MakeNewHolder();
1604
+ }
1605
+
1606
+ class ValueHolderFactory {
1607
+ public:
1608
+ ValueHolderFactory() {}
1609
+ virtual ~ValueHolderFactory() {}
1610
+ virtual ValueHolder* MakeNewHolder() const = 0;
1611
+
1612
+ private:
1613
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
1614
+ };
1615
+
1616
+ class DefaultValueHolderFactory : public ValueHolderFactory {
1617
+ public:
1618
+ DefaultValueHolderFactory() {}
1619
+ ValueHolder* MakeNewHolder() const override { return new ValueHolder(); }
1620
+
1621
+ private:
1622
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
1623
+ };
1624
+
1625
+ class InstanceValueHolderFactory : public ValueHolderFactory {
1626
+ public:
1627
+ explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
1628
+ ValueHolder* MakeNewHolder() const override {
1629
+ return new ValueHolder(value_);
1630
+ }
1631
+
1632
+ private:
1633
+ const T value_; // The value for each thread.
1634
+
1635
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
1636
+ };
1637
+
1638
+ std::unique_ptr<ValueHolderFactory> default_factory_;
1639
+
1640
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
1641
+ };
1642
+
1643
+ # elif GTEST_HAS_PTHREAD
1644
+
1645
+ // MutexBase and Mutex implement mutex on pthreads-based platforms.
1646
+ class MutexBase {
1647
+ public:
1648
+ // Acquires this mutex.
1649
+ void Lock() {
1650
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
1651
+ owner_ = pthread_self();
1652
+ has_owner_ = true;
1653
+ }
1654
+
1655
+ // Releases this mutex.
1656
+ void Unlock() {
1657
+ // Since the lock is being released the owner_ field should no longer be
1658
+ // considered valid. We don't protect writing to has_owner_ here, as it's
1659
+ // the caller's responsibility to ensure that the current thread holds the
1660
+ // mutex when this is called.
1661
+ has_owner_ = false;
1662
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
1663
+ }
1664
+
1665
+ // Does nothing if the current thread holds the mutex. Otherwise, crashes
1666
+ // with high probability.
1667
+ void AssertHeld() const {
1668
+ GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
1669
+ << "The current thread is not holding the mutex @" << this;
1670
+ }
1671
+
1672
+ // A static mutex may be used before main() is entered. It may even
1673
+ // be used before the dynamic initialization stage. Therefore we
1674
+ // must be able to initialize a static mutex object at link time.
1675
+ // This means MutexBase has to be a POD and its member variables
1676
+ // have to be public.
1677
+ public:
1678
+ pthread_mutex_t mutex_; // The underlying pthread mutex.
1679
+ // has_owner_ indicates whether the owner_ field below contains a valid thread
1680
+ // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
1681
+ // accesses to the owner_ field should be protected by a check of this field.
1682
+ // An alternative might be to memset() owner_ to all zeros, but there's no
1683
+ // guarantee that a zero'd pthread_t is necessarily invalid or even different
1684
+ // from pthread_self().
1685
+ bool has_owner_;
1686
+ pthread_t owner_; // The thread holding the mutex.
1687
+ };
1688
+
1689
+ // Forward-declares a static mutex.
1690
+ # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
1691
+ extern ::testing::internal::MutexBase mutex
1692
+
1693
+ // Defines and statically (i.e. at link time) initializes a static mutex.
1694
+ // The initialization list here does not explicitly initialize each field,
1695
+ // instead relying on default initialization for the unspecified fields. In
1696
+ // particular, the owner_ field (a pthread_t) is not explicitly initialized.
1697
+ // This allows initialization to work whether pthread_t is a scalar or struct.
1698
+ // The flag -Wmissing-field-initializers must not be specified for this to work.
1699
+ #define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
1700
+ ::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false, 0}
1701
+
1702
+ // The Mutex class can only be used for mutexes created at runtime. It
1703
+ // shares its API with MutexBase otherwise.
1704
+ class Mutex : public MutexBase {
1705
+ public:
1706
+ Mutex() {
1707
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, nullptr));
1708
+ has_owner_ = false;
1709
+ }
1710
+ ~Mutex() {
1711
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
1712
+ }
1713
+
1714
+ private:
1715
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
1716
+ };
1717
+
1718
+ // We cannot name this class MutexLock because the ctor declaration would
1719
+ // conflict with a macro named MutexLock, which is defined on some
1720
+ // platforms. That macro is used as a defensive measure to prevent against
1721
+ // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
1722
+ // "MutexLock l(&mu)". Hence the typedef trick below.
1723
+ class GTestMutexLock {
1724
+ public:
1725
+ explicit GTestMutexLock(MutexBase* mutex)
1726
+ : mutex_(mutex) { mutex_->Lock(); }
1727
+
1728
+ ~GTestMutexLock() { mutex_->Unlock(); }
1729
+
1730
+ private:
1731
+ MutexBase* const mutex_;
1732
+
1733
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
1734
+ };
1735
+
1736
+ typedef GTestMutexLock MutexLock;
1737
+
1738
+ // Helpers for ThreadLocal.
1739
+
1740
+ // pthread_key_create() requires DeleteThreadLocalValue() to have
1741
+ // C-linkage. Therefore it cannot be templatized to access
1742
+ // ThreadLocal<T>. Hence the need for class
1743
+ // ThreadLocalValueHolderBase.
1744
+ class ThreadLocalValueHolderBase {
1745
+ public:
1746
+ virtual ~ThreadLocalValueHolderBase() {}
1747
+ };
1748
+
1749
+ // Called by pthread to delete thread-local data stored by
1750
+ // pthread_setspecific().
1751
+ extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
1752
+ delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
1753
+ }
1754
+
1755
+ // Implements thread-local storage on pthreads-based systems.
1756
+ template <typename T>
1757
+ class GTEST_API_ ThreadLocal {
1758
+ public:
1759
+ ThreadLocal()
1760
+ : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
1761
+ explicit ThreadLocal(const T& value)
1762
+ : key_(CreateKey()),
1763
+ default_factory_(new InstanceValueHolderFactory(value)) {}
1764
+
1765
+ ~ThreadLocal() {
1766
+ // Destroys the managed object for the current thread, if any.
1767
+ DeleteThreadLocalValue(pthread_getspecific(key_));
1768
+
1769
+ // Releases resources associated with the key. This will *not*
1770
+ // delete managed objects for other threads.
1771
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
1772
+ }
1773
+
1774
+ T* pointer() { return GetOrCreateValue(); }
1775
+ const T* pointer() const { return GetOrCreateValue(); }
1776
+ const T& get() const { return *pointer(); }
1777
+ void set(const T& value) { *pointer() = value; }
1778
+
1779
+ private:
1780
+ // Holds a value of type T.
1781
+ class ValueHolder : public ThreadLocalValueHolderBase {
1782
+ public:
1783
+ ValueHolder() : value_() {}
1784
+ explicit ValueHolder(const T& value) : value_(value) {}
1785
+
1786
+ T* pointer() { return &value_; }
1787
+
1788
+ private:
1789
+ T value_;
1790
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
1791
+ };
1792
+
1793
+ static pthread_key_t CreateKey() {
1794
+ pthread_key_t key;
1795
+ // When a thread exits, DeleteThreadLocalValue() will be called on
1796
+ // the object managed for that thread.
1797
+ GTEST_CHECK_POSIX_SUCCESS_(
1798
+ pthread_key_create(&key, &DeleteThreadLocalValue));
1799
+ return key;
1800
+ }
1801
+
1802
+ T* GetOrCreateValue() const {
1803
+ ThreadLocalValueHolderBase* const holder =
1804
+ static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
1805
+ if (holder != nullptr) {
1806
+ return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
1807
+ }
1808
+
1809
+ ValueHolder* const new_holder = default_factory_->MakeNewHolder();
1810
+ ThreadLocalValueHolderBase* const holder_base = new_holder;
1811
+ GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
1812
+ return new_holder->pointer();
1813
+ }
1814
+
1815
+ class ValueHolderFactory {
1816
+ public:
1817
+ ValueHolderFactory() {}
1818
+ virtual ~ValueHolderFactory() {}
1819
+ virtual ValueHolder* MakeNewHolder() const = 0;
1820
+
1821
+ private:
1822
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
1823
+ };
1824
+
1825
+ class DefaultValueHolderFactory : public ValueHolderFactory {
1826
+ public:
1827
+ DefaultValueHolderFactory() {}
1828
+ ValueHolder* MakeNewHolder() const override { return new ValueHolder(); }
1829
+
1830
+ private:
1831
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
1832
+ };
1833
+
1834
+ class InstanceValueHolderFactory : public ValueHolderFactory {
1835
+ public:
1836
+ explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
1837
+ ValueHolder* MakeNewHolder() const override {
1838
+ return new ValueHolder(value_);
1839
+ }
1840
+
1841
+ private:
1842
+ const T value_; // The value for each thread.
1843
+
1844
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
1845
+ };
1846
+
1847
+ // A key pthreads uses for looking up per-thread values.
1848
+ const pthread_key_t key_;
1849
+ std::unique_ptr<ValueHolderFactory> default_factory_;
1850
+
1851
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
1852
+ };
1853
+
1854
+ # endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
1855
+
1856
+ #else // GTEST_IS_THREADSAFE
1857
+
1858
+ // A dummy implementation of synchronization primitives (mutex, lock,
1859
+ // and thread-local variable). Necessary for compiling Google Test where
1860
+ // mutex is not supported - using Google Test in multiple threads is not
1861
+ // supported on such platforms.
1862
+
1863
+ class Mutex {
1864
+ public:
1865
+ Mutex() {}
1866
+ void Lock() {}
1867
+ void Unlock() {}
1868
+ void AssertHeld() const {}
1869
+ };
1870
+
1871
+ # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
1872
+ extern ::testing::internal::Mutex mutex
1873
+
1874
+ # define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
1875
+
1876
+ // We cannot name this class MutexLock because the ctor declaration would
1877
+ // conflict with a macro named MutexLock, which is defined on some
1878
+ // platforms. That macro is used as a defensive measure to prevent against
1879
+ // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
1880
+ // "MutexLock l(&mu)". Hence the typedef trick below.
1881
+ class GTestMutexLock {
1882
+ public:
1883
+ explicit GTestMutexLock(Mutex*) {} // NOLINT
1884
+ };
1885
+
1886
+ typedef GTestMutexLock MutexLock;
1887
+
1888
+ template <typename T>
1889
+ class GTEST_API_ ThreadLocal {
1890
+ public:
1891
+ ThreadLocal() : value_() {}
1892
+ explicit ThreadLocal(const T& value) : value_(value) {}
1893
+ T* pointer() { return &value_; }
1894
+ const T* pointer() const { return &value_; }
1895
+ const T& get() const { return value_; }
1896
+ void set(const T& value) { value_ = value; }
1897
+ private:
1898
+ T value_;
1899
+ };
1900
+
1901
+ #endif // GTEST_IS_THREADSAFE
1902
+
1903
+ // Returns the number of threads running in the process, or 0 to indicate that
1904
+ // we cannot detect it.
1905
+ GTEST_API_ size_t GetThreadCount();
1906
+
1907
+ #if GTEST_OS_WINDOWS
1908
+ # define GTEST_PATH_SEP_ "\\"
1909
+ # define GTEST_HAS_ALT_PATH_SEP_ 1
1910
+ #else
1911
+ # define GTEST_PATH_SEP_ "/"
1912
+ # define GTEST_HAS_ALT_PATH_SEP_ 0
1913
+ #endif // GTEST_OS_WINDOWS
1914
+
1915
+ // Utilities for char.
1916
+
1917
+ // isspace(int ch) and friends accept an unsigned char or EOF. char
1918
+ // may be signed, depending on the compiler (or compiler flags).
1919
+ // Therefore we need to cast a char to unsigned char before calling
1920
+ // isspace(), etc.
1921
+
1922
+ inline bool IsAlpha(char ch) {
1923
+ return isalpha(static_cast<unsigned char>(ch)) != 0;
1924
+ }
1925
+ inline bool IsAlNum(char ch) {
1926
+ return isalnum(static_cast<unsigned char>(ch)) != 0;
1927
+ }
1928
+ inline bool IsDigit(char ch) {
1929
+ return isdigit(static_cast<unsigned char>(ch)) != 0;
1930
+ }
1931
+ inline bool IsLower(char ch) {
1932
+ return islower(static_cast<unsigned char>(ch)) != 0;
1933
+ }
1934
+ inline bool IsSpace(char ch) {
1935
+ return isspace(static_cast<unsigned char>(ch)) != 0;
1936
+ }
1937
+ inline bool IsUpper(char ch) {
1938
+ return isupper(static_cast<unsigned char>(ch)) != 0;
1939
+ }
1940
+ inline bool IsXDigit(char ch) {
1941
+ return isxdigit(static_cast<unsigned char>(ch)) != 0;
1942
+ }
1943
+ #ifdef __cpp_char8_t
1944
+ inline bool IsXDigit(char8_t ch) {
1945
+ return isxdigit(static_cast<unsigned char>(ch)) != 0;
1946
+ }
1947
+ #endif
1948
+ inline bool IsXDigit(char16_t ch) {
1949
+ const unsigned char low_byte = static_cast<unsigned char>(ch);
1950
+ return ch == low_byte && isxdigit(low_byte) != 0;
1951
+ }
1952
+ inline bool IsXDigit(char32_t ch) {
1953
+ const unsigned char low_byte = static_cast<unsigned char>(ch);
1954
+ return ch == low_byte && isxdigit(low_byte) != 0;
1955
+ }
1956
+ inline bool IsXDigit(wchar_t ch) {
1957
+ const unsigned char low_byte = static_cast<unsigned char>(ch);
1958
+ return ch == low_byte && isxdigit(low_byte) != 0;
1959
+ }
1960
+
1961
+ inline char ToLower(char ch) {
1962
+ return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
1963
+ }
1964
+ inline char ToUpper(char ch) {
1965
+ return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
1966
+ }
1967
+
1968
+ inline std::string StripTrailingSpaces(std::string str) {
1969
+ std::string::iterator it = str.end();
1970
+ while (it != str.begin() && IsSpace(*--it))
1971
+ it = str.erase(it);
1972
+ return str;
1973
+ }
1974
+
1975
+ // The testing::internal::posix namespace holds wrappers for common
1976
+ // POSIX functions. These wrappers hide the differences between
1977
+ // Windows/MSVC and POSIX systems. Since some compilers define these
1978
+ // standard functions as macros, the wrapper cannot have the same name
1979
+ // as the wrapped function.
1980
+
1981
+ namespace posix {
1982
+
1983
+ // Functions with a different name on Windows.
1984
+
1985
+ #if GTEST_OS_WINDOWS
1986
+
1987
+ typedef struct _stat StatStruct;
1988
+
1989
+ # ifdef __BORLANDC__
1990
+ inline int DoIsATTY(int fd) { return isatty(fd); }
1991
+ inline int StrCaseCmp(const char* s1, const char* s2) {
1992
+ return stricmp(s1, s2);
1993
+ }
1994
+ inline char* StrDup(const char* src) { return strdup(src); }
1995
+ # else // !__BORLANDC__
1996
+ # if GTEST_OS_WINDOWS_MOBILE
1997
+ inline int DoIsATTY(int /* fd */) { return 0; }
1998
+ # else
1999
+ inline int DoIsATTY(int fd) { return _isatty(fd); }
2000
+ # endif // GTEST_OS_WINDOWS_MOBILE
2001
+ inline int StrCaseCmp(const char* s1, const char* s2) {
2002
+ return _stricmp(s1, s2);
2003
+ }
2004
+ inline char* StrDup(const char* src) { return _strdup(src); }
2005
+ # endif // __BORLANDC__
2006
+
2007
+ # if GTEST_OS_WINDOWS_MOBILE
2008
+ inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
2009
+ // Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
2010
+ // time and thus not defined there.
2011
+ # else
2012
+ inline int FileNo(FILE* file) { return _fileno(file); }
2013
+ inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
2014
+ inline int RmDir(const char* dir) { return _rmdir(dir); }
2015
+ inline bool IsDir(const StatStruct& st) {
2016
+ return (_S_IFDIR & st.st_mode) != 0;
2017
+ }
2018
+ # endif // GTEST_OS_WINDOWS_MOBILE
2019
+
2020
+ #elif GTEST_OS_ESP8266
2021
+ typedef struct stat StatStruct;
2022
+
2023
+ inline int FileNo(FILE* file) { return fileno(file); }
2024
+ inline int DoIsATTY(int fd) { return isatty(fd); }
2025
+ inline int Stat(const char* path, StatStruct* buf) {
2026
+ // stat function not implemented on ESP8266
2027
+ return 0;
2028
+ }
2029
+ inline int StrCaseCmp(const char* s1, const char* s2) {
2030
+ return strcasecmp(s1, s2);
2031
+ }
2032
+ inline char* StrDup(const char* src) { return strdup(src); }
2033
+ inline int RmDir(const char* dir) { return rmdir(dir); }
2034
+ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
2035
+
2036
+ #else
2037
+
2038
+ typedef struct stat StatStruct;
2039
+
2040
+ inline int FileNo(FILE* file) { return fileno(file); }
2041
+ inline int DoIsATTY(int fd) { return isatty(fd); }
2042
+ inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
2043
+ inline int StrCaseCmp(const char* s1, const char* s2) {
2044
+ return strcasecmp(s1, s2);
2045
+ }
2046
+ inline char* StrDup(const char* src) { return strdup(src); }
2047
+ inline int RmDir(const char* dir) { return rmdir(dir); }
2048
+ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
2049
+
2050
+ #endif // GTEST_OS_WINDOWS
2051
+
2052
+ inline int IsATTY(int fd) {
2053
+ // DoIsATTY might change errno (for example ENOTTY in case you redirect stdout
2054
+ // to a file on Linux), which is unexpected, so save the previous value, and
2055
+ // restore it after the call.
2056
+ int savedErrno = errno;
2057
+ int isAttyValue = DoIsATTY(fd);
2058
+ errno = savedErrno;
2059
+
2060
+ return isAttyValue;
2061
+ }
2062
+
2063
+ // Functions deprecated by MSVC 8.0.
2064
+
2065
+ GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
2066
+
2067
+ // ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
2068
+ // StrError() aren't needed on Windows CE at this time and thus not
2069
+ // defined there.
2070
+
2071
+ #if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && \
2072
+ !GTEST_OS_WINDOWS_RT && !GTEST_OS_ESP8266 && !GTEST_OS_XTENSA
2073
+ inline int ChDir(const char* dir) { return chdir(dir); }
2074
+ #endif
2075
+ inline FILE* FOpen(const char* path, const char* mode) {
2076
+ #if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW
2077
+ struct wchar_codecvt : public std::codecvt<wchar_t, char, std::mbstate_t> {};
2078
+ std::wstring_convert<wchar_codecvt> converter;
2079
+ std::wstring wide_path = converter.from_bytes(path);
2080
+ std::wstring wide_mode = converter.from_bytes(mode);
2081
+ return _wfopen(wide_path.c_str(), wide_mode.c_str());
2082
+ #else // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW
2083
+ return fopen(path, mode);
2084
+ #endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW
2085
+ }
2086
+ #if !GTEST_OS_WINDOWS_MOBILE
2087
+ inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
2088
+ return freopen(path, mode, stream);
2089
+ }
2090
+ inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
2091
+ #endif
2092
+ inline int FClose(FILE* fp) { return fclose(fp); }
2093
+ #if !GTEST_OS_WINDOWS_MOBILE
2094
+ inline int Read(int fd, void* buf, unsigned int count) {
2095
+ return static_cast<int>(read(fd, buf, count));
2096
+ }
2097
+ inline int Write(int fd, const void* buf, unsigned int count) {
2098
+ return static_cast<int>(write(fd, buf, count));
2099
+ }
2100
+ inline int Close(int fd) { return close(fd); }
2101
+ inline const char* StrError(int errnum) { return strerror(errnum); }
2102
+ #endif
2103
+ inline const char* GetEnv(const char* name) {
2104
+ #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
2105
+ GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_XTENSA
2106
+ // We are on an embedded platform, which has no environment variables.
2107
+ static_cast<void>(name); // To prevent 'unused argument' warning.
2108
+ return nullptr;
2109
+ #elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
2110
+ // Environment variables which we programmatically clear will be set to the
2111
+ // empty string rather than unset (NULL). Handle that case.
2112
+ const char* const env = getenv(name);
2113
+ return (env != nullptr && env[0] != '\0') ? env : nullptr;
2114
+ #else
2115
+ return getenv(name);
2116
+ #endif
2117
+ }
2118
+
2119
+ GTEST_DISABLE_MSC_DEPRECATED_POP_()
2120
+
2121
+ #if GTEST_OS_WINDOWS_MOBILE
2122
+ // Windows CE has no C library. The abort() function is used in
2123
+ // several places in Google Test. This implementation provides a reasonable
2124
+ // imitation of standard behaviour.
2125
+ [[noreturn]] void Abort();
2126
+ #else
2127
+ [[noreturn]] inline void Abort() { abort(); }
2128
+ #endif // GTEST_OS_WINDOWS_MOBILE
2129
+
2130
+ } // namespace posix
2131
+
2132
+ // MSVC "deprecates" snprintf and issues warnings wherever it is used. In
2133
+ // order to avoid these warnings, we need to use _snprintf or _snprintf_s on
2134
+ // MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate
2135
+ // function in order to achieve that. We use macro definition here because
2136
+ // snprintf is a variadic function.
2137
+ #if _MSC_VER && !GTEST_OS_WINDOWS_MOBILE
2138
+ // MSVC 2005 and above support variadic macros.
2139
+ # define GTEST_SNPRINTF_(buffer, size, format, ...) \
2140
+ _snprintf_s(buffer, size, size, format, __VA_ARGS__)
2141
+ #elif defined(_MSC_VER)
2142
+ // Windows CE does not define _snprintf_s
2143
+ # define GTEST_SNPRINTF_ _snprintf
2144
+ #else
2145
+ # define GTEST_SNPRINTF_ snprintf
2146
+ #endif
2147
+
2148
+ // The biggest signed integer type the compiler supports.
2149
+ //
2150
+ // long long is guaranteed to be at least 64-bits in C++11.
2151
+ using BiggestInt = long long; // NOLINT
2152
+
2153
+ // The maximum number a BiggestInt can represent.
2154
+ constexpr BiggestInt kMaxBiggestInt = (std::numeric_limits<BiggestInt>::max)();
2155
+
2156
+ // This template class serves as a compile-time function from size to
2157
+ // type. It maps a size in bytes to a primitive type with that
2158
+ // size. e.g.
2159
+ //
2160
+ // TypeWithSize<4>::UInt
2161
+ //
2162
+ // is typedef-ed to be unsigned int (unsigned integer made up of 4
2163
+ // bytes).
2164
+ //
2165
+ // Such functionality should belong to STL, but I cannot find it
2166
+ // there.
2167
+ //
2168
+ // Google Test uses this class in the implementation of floating-point
2169
+ // comparison.
2170
+ //
2171
+ // For now it only handles UInt (unsigned int) as that's all Google Test
2172
+ // needs. Other types can be easily added in the future if need
2173
+ // arises.
2174
+ template <size_t size>
2175
+ class TypeWithSize {
2176
+ public:
2177
+ // This prevents the user from using TypeWithSize<N> with incorrect
2178
+ // values of N.
2179
+ using UInt = void;
2180
+ };
2181
+
2182
+ // The specialization for size 4.
2183
+ template <>
2184
+ class TypeWithSize<4> {
2185
+ public:
2186
+ using Int = std::int32_t;
2187
+ using UInt = std::uint32_t;
2188
+ };
2189
+
2190
+ // The specialization for size 8.
2191
+ template <>
2192
+ class TypeWithSize<8> {
2193
+ public:
2194
+ using Int = std::int64_t;
2195
+ using UInt = std::uint64_t;
2196
+ };
2197
+
2198
+ // Integer types of known sizes.
2199
+ using TimeInMillis = int64_t; // Represents time in milliseconds.
2200
+
2201
+ // Utilities for command line flags and environment variables.
2202
+
2203
+ // Macro for referencing flags.
2204
+ #if !defined(GTEST_FLAG)
2205
+ # define GTEST_FLAG(name) FLAGS_gtest_##name
2206
+ #endif // !defined(GTEST_FLAG)
2207
+
2208
+ #if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
2209
+ # define GTEST_USE_OWN_FLAGFILE_FLAG_ 1
2210
+ #endif // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
2211
+
2212
+ #if !defined(GTEST_DECLARE_bool_)
2213
+ # define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
2214
+
2215
+ // Macros for declaring flags.
2216
+ # define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
2217
+ # define GTEST_DECLARE_int32_(name) \
2218
+ GTEST_API_ extern std::int32_t GTEST_FLAG(name)
2219
+ # define GTEST_DECLARE_string_(name) \
2220
+ GTEST_API_ extern ::std::string GTEST_FLAG(name)
2221
+
2222
+ // Macros for defining flags.
2223
+ # define GTEST_DEFINE_bool_(name, default_val, doc) \
2224
+ GTEST_API_ bool GTEST_FLAG(name) = (default_val)
2225
+ # define GTEST_DEFINE_int32_(name, default_val, doc) \
2226
+ GTEST_API_ std::int32_t GTEST_FLAG(name) = (default_val)
2227
+ # define GTEST_DEFINE_string_(name, default_val, doc) \
2228
+ GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
2229
+
2230
+ #endif // !defined(GTEST_DECLARE_bool_)
2231
+
2232
+ // Thread annotations
2233
+ #if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
2234
+ # define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
2235
+ # define GTEST_LOCK_EXCLUDED_(locks)
2236
+ #endif // !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
2237
+
2238
+ // Parses 'str' for a 32-bit signed integer. If successful, writes the result
2239
+ // to *value and returns true; otherwise leaves *value unchanged and returns
2240
+ // false.
2241
+ GTEST_API_ bool ParseInt32(const Message& src_text, const char* str,
2242
+ int32_t* value);
2243
+
2244
+ // Parses a bool/int32_t/string from the environment variable
2245
+ // corresponding to the given Google Test flag.
2246
+ bool BoolFromGTestEnv(const char* flag, bool default_val);
2247
+ GTEST_API_ int32_t Int32FromGTestEnv(const char* flag, int32_t default_val);
2248
+ std::string OutputFlagAlsoCheckEnvVar();
2249
+ const char* StringFromGTestEnv(const char* flag, const char* default_val);
2250
+
2251
+ } // namespace internal
2252
+ } // namespace testing
2253
+
2254
+ #if !defined(GTEST_INTERNAL_DEPRECATED)
2255
+
2256
+ // Internal Macro to mark an API deprecated, for googletest usage only
2257
+ // Usage: class GTEST_INTERNAL_DEPRECATED(message) MyClass or
2258
+ // GTEST_INTERNAL_DEPRECATED(message) <return_type> myFunction(); Every usage of
2259
+ // a deprecated entity will trigger a warning when compiled with
2260
+ // `-Wdeprecated-declarations` option (clang, gcc, any __GNUC__ compiler).
2261
+ // For msvc /W3 option will need to be used
2262
+ // Note that for 'other' compilers this macro evaluates to nothing to prevent
2263
+ // compilations errors.
2264
+ #if defined(_MSC_VER)
2265
+ #define GTEST_INTERNAL_DEPRECATED(message) __declspec(deprecated(message))
2266
+ #elif defined(__GNUC__)
2267
+ #define GTEST_INTERNAL_DEPRECATED(message) __attribute__((deprecated(message)))
2268
+ #else
2269
+ #define GTEST_INTERNAL_DEPRECATED(message)
2270
+ #endif
2271
+
2272
+ #endif // !defined(GTEST_INTERNAL_DEPRECATED)
2273
+
2274
+ #if GTEST_HAS_ABSL
2275
+ // Always use absl::any for UniversalPrinter<> specializations if googletest
2276
+ // is built with absl support.
2277
+ #define GTEST_INTERNAL_HAS_ANY 1
2278
+ #include "absl/types/any.h"
2279
+ namespace testing {
2280
+ namespace internal {
2281
+ using Any = ::absl::any;
2282
+ } // namespace internal
2283
+ } // namespace testing
2284
+ #else
2285
+ #ifdef __has_include
2286
+ #if __has_include(<any>) && __cplusplus >= 201703L
2287
+ // Otherwise for C++17 and higher use std::any for UniversalPrinter<>
2288
+ // specializations.
2289
+ #define GTEST_INTERNAL_HAS_ANY 1
2290
+ #include <any>
2291
+ namespace testing {
2292
+ namespace internal {
2293
+ using Any = ::std::any;
2294
+ } // namespace internal
2295
+ } // namespace testing
2296
+ // The case where absl is configured NOT to alias std::any is not
2297
+ // supported.
2298
+ #endif // __has_include(<any>) && __cplusplus >= 201703L
2299
+ #endif // __has_include
2300
+ #endif // GTEST_HAS_ABSL
2301
+
2302
+ #if GTEST_HAS_ABSL
2303
+ // Always use absl::optional for UniversalPrinter<> specializations if
2304
+ // googletest is built with absl support.
2305
+ #define GTEST_INTERNAL_HAS_OPTIONAL 1
2306
+ #include "absl/types/optional.h"
2307
+ namespace testing {
2308
+ namespace internal {
2309
+ template <typename T>
2310
+ using Optional = ::absl::optional<T>;
2311
+ } // namespace internal
2312
+ } // namespace testing
2313
+ #else
2314
+ #ifdef __has_include
2315
+ #if __has_include(<optional>) && __cplusplus >= 201703L
2316
+ // Otherwise for C++17 and higher use std::optional for UniversalPrinter<>
2317
+ // specializations.
2318
+ #define GTEST_INTERNAL_HAS_OPTIONAL 1
2319
+ #include <optional>
2320
+ namespace testing {
2321
+ namespace internal {
2322
+ template <typename T>
2323
+ using Optional = ::std::optional<T>;
2324
+ } // namespace internal
2325
+ } // namespace testing
2326
+ // The case where absl is configured NOT to alias std::optional is not
2327
+ // supported.
2328
+ #endif // __has_include(<optional>) && __cplusplus >= 201703L
2329
+ #endif // __has_include
2330
+ #endif // GTEST_HAS_ABSL
2331
+
2332
+ #if GTEST_HAS_ABSL
2333
+ // Always use absl::string_view for Matcher<> specializations if googletest
2334
+ // is built with absl support.
2335
+ # define GTEST_INTERNAL_HAS_STRING_VIEW 1
2336
+ #include "absl/strings/string_view.h"
2337
+ namespace testing {
2338
+ namespace internal {
2339
+ using StringView = ::absl::string_view;
2340
+ } // namespace internal
2341
+ } // namespace testing
2342
+ #else
2343
+ # ifdef __has_include
2344
+ # if __has_include(<string_view>) && __cplusplus >= 201703L
2345
+ // Otherwise for C++17 and higher use std::string_view for Matcher<>
2346
+ // specializations.
2347
+ # define GTEST_INTERNAL_HAS_STRING_VIEW 1
2348
+ #include <string_view>
2349
+ namespace testing {
2350
+ namespace internal {
2351
+ using StringView = ::std::string_view;
2352
+ } // namespace internal
2353
+ } // namespace testing
2354
+ // The case where absl is configured NOT to alias std::string_view is not
2355
+ // supported.
2356
+ # endif // __has_include(<string_view>) && __cplusplus >= 201703L
2357
+ # endif // __has_include
2358
+ #endif // GTEST_HAS_ABSL
2359
+
2360
+ #if GTEST_HAS_ABSL
2361
+ // Always use absl::variant for UniversalPrinter<> specializations if googletest
2362
+ // is built with absl support.
2363
+ #define GTEST_INTERNAL_HAS_VARIANT 1
2364
+ #include "absl/types/variant.h"
2365
+ namespace testing {
2366
+ namespace internal {
2367
+ template <typename... T>
2368
+ using Variant = ::absl::variant<T...>;
2369
+ } // namespace internal
2370
+ } // namespace testing
2371
+ #else
2372
+ #ifdef __has_include
2373
+ #if __has_include(<variant>) && __cplusplus >= 201703L
2374
+ // Otherwise for C++17 and higher use std::variant for UniversalPrinter<>
2375
+ // specializations.
2376
+ #define GTEST_INTERNAL_HAS_VARIANT 1
2377
+ #include <variant>
2378
+ namespace testing {
2379
+ namespace internal {
2380
+ template <typename... T>
2381
+ using Variant = ::std::variant<T...>;
2382
+ } // namespace internal
2383
+ } // namespace testing
2384
+ // The case where absl is configured NOT to alias std::variant is not supported.
2385
+ #endif // __has_include(<variant>) && __cplusplus >= 201703L
2386
+ #endif // __has_include
2387
+ #endif // GTEST_HAS_ABSL
2388
+
2389
+ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
data/miniconda3/include/gtest/internal/gtest-string.h ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2005, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // The Google C++ Testing and Mocking Framework (Google Test)
31
+ //
32
+ // This header file declares the String class and functions used internally by
33
+ // Google Test. They are subject to change without notice. They should not used
34
+ // by code external to Google Test.
35
+ //
36
+ // This header file is #included by gtest-internal.h.
37
+ // It should not be #included by other files.
38
+
39
+ // GOOGLETEST_CM0001 DO NOT DELETE
40
+
41
+ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
42
+ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
43
+
44
+ #ifdef __BORLANDC__
45
+ // string.h is not guaranteed to provide strcpy on C++ Builder.
46
+ # include <mem.h>
47
+ #endif
48
+
49
+ #include <string.h>
50
+ #include <cstdint>
51
+ #include <string>
52
+
53
+ #include "gtest/internal/gtest-port.h"
54
+
55
+ namespace testing {
56
+ namespace internal {
57
+
58
+ // String - an abstract class holding static string utilities.
59
+ class GTEST_API_ String {
60
+ public:
61
+ // Static utility methods
62
+
63
+ // Clones a 0-terminated C string, allocating memory using new. The
64
+ // caller is responsible for deleting the return value using
65
+ // delete[]. Returns the cloned string, or NULL if the input is
66
+ // NULL.
67
+ //
68
+ // This is different from strdup() in string.h, which allocates
69
+ // memory using malloc().
70
+ static const char* CloneCString(const char* c_str);
71
+
72
+ #if GTEST_OS_WINDOWS_MOBILE
73
+ // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
74
+ // able to pass strings to Win32 APIs on CE we need to convert them
75
+ // to 'Unicode', UTF-16.
76
+
77
+ // Creates a UTF-16 wide string from the given ANSI string, allocating
78
+ // memory using new. The caller is responsible for deleting the return
79
+ // value using delete[]. Returns the wide string, or NULL if the
80
+ // input is NULL.
81
+ //
82
+ // The wide string is created using the ANSI codepage (CP_ACP) to
83
+ // match the behaviour of the ANSI versions of Win32 calls and the
84
+ // C runtime.
85
+ static LPCWSTR AnsiToUtf16(const char* c_str);
86
+
87
+ // Creates an ANSI string from the given wide string, allocating
88
+ // memory using new. The caller is responsible for deleting the return
89
+ // value using delete[]. Returns the ANSI string, or NULL if the
90
+ // input is NULL.
91
+ //
92
+ // The returned string is created using the ANSI codepage (CP_ACP) to
93
+ // match the behaviour of the ANSI versions of Win32 calls and the
94
+ // C runtime.
95
+ static const char* Utf16ToAnsi(LPCWSTR utf16_str);
96
+ #endif
97
+
98
+ // Compares two C strings. Returns true if and only if they have the same
99
+ // content.
100
+ //
101
+ // Unlike strcmp(), this function can handle NULL argument(s). A
102
+ // NULL C string is considered different to any non-NULL C string,
103
+ // including the empty string.
104
+ static bool CStringEquals(const char* lhs, const char* rhs);
105
+
106
+ // Converts a wide C string to a String using the UTF-8 encoding.
107
+ // NULL will be converted to "(null)". If an error occurred during
108
+ // the conversion, "(failed to convert from wide string)" is
109
+ // returned.
110
+ static std::string ShowWideCString(const wchar_t* wide_c_str);
111
+
112
+ // Compares two wide C strings. Returns true if and only if they have the
113
+ // same content.
114
+ //
115
+ // Unlike wcscmp(), this function can handle NULL argument(s). A
116
+ // NULL C string is considered different to any non-NULL C string,
117
+ // including the empty string.
118
+ static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
119
+
120
+ // Compares two C strings, ignoring case. Returns true if and only if
121
+ // they have the same content.
122
+ //
123
+ // Unlike strcasecmp(), this function can handle NULL argument(s).
124
+ // A NULL C string is considered different to any non-NULL C string,
125
+ // including the empty string.
126
+ static bool CaseInsensitiveCStringEquals(const char* lhs,
127
+ const char* rhs);
128
+
129
+ // Compares two wide C strings, ignoring case. Returns true if and only if
130
+ // they have the same content.
131
+ //
132
+ // Unlike wcscasecmp(), this function can handle NULL argument(s).
133
+ // A NULL C string is considered different to any non-NULL wide C string,
134
+ // including the empty string.
135
+ // NB: The implementations on different platforms slightly differ.
136
+ // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
137
+ // environment variable. On GNU platform this method uses wcscasecmp
138
+ // which compares according to LC_CTYPE category of the current locale.
139
+ // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
140
+ // current locale.
141
+ static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
142
+ const wchar_t* rhs);
143
+
144
+ // Returns true if and only if the given string ends with the given suffix,
145
+ // ignoring case. Any string is considered to end with an empty suffix.
146
+ static bool EndsWithCaseInsensitive(
147
+ const std::string& str, const std::string& suffix);
148
+
149
+ // Formats an int value as "%02d".
150
+ static std::string FormatIntWidth2(int value); // "%02d" for width == 2
151
+
152
+ // Formats an int value to given width with leading zeros.
153
+ static std::string FormatIntWidthN(int value, int width);
154
+
155
+ // Formats an int value as "%X".
156
+ static std::string FormatHexInt(int value);
157
+
158
+ // Formats an int value as "%X".
159
+ static std::string FormatHexUInt32(uint32_t value);
160
+
161
+ // Formats a byte as "%02X".
162
+ static std::string FormatByte(unsigned char value);
163
+
164
+ private:
165
+ String(); // Not meant to be instantiated.
166
+ }; // class String
167
+
168
+ // Gets the content of the stringstream's buffer as an std::string. Each '\0'
169
+ // character in the buffer is replaced with "\\0".
170
+ GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
171
+
172
+ } // namespace internal
173
+ } // namespace testing
174
+
175
+ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
data/miniconda3/include/gtest/internal/gtest-type-util.h ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2008 Google Inc.
2
+ // All Rights Reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ // Type utilities needed for implementing typed and type-parameterized
31
+ // tests.
32
+
33
+ // GOOGLETEST_CM0001 DO NOT DELETE
34
+
35
+ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
36
+ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
37
+
38
+ #include "gtest/internal/gtest-port.h"
39
+
40
+ // #ifdef __GNUC__ is too general here. It is possible to use gcc without using
41
+ // libstdc++ (which is where cxxabi.h comes from).
42
+ # if GTEST_HAS_CXXABI_H_
43
+ # include <cxxabi.h>
44
+ # elif defined(__HP_aCC)
45
+ # include <acxx_demangle.h>
46
+ # endif // GTEST_HASH_CXXABI_H_
47
+
48
+ namespace testing {
49
+ namespace internal {
50
+
51
+ // Canonicalizes a given name with respect to the Standard C++ Library.
52
+ // This handles removing the inline namespace within `std` that is
53
+ // used by various standard libraries (e.g., `std::__1`). Names outside
54
+ // of namespace std are returned unmodified.
55
+ inline std::string CanonicalizeForStdLibVersioning(std::string s) {
56
+ static const char prefix[] = "std::__";
57
+ if (s.compare(0, strlen(prefix), prefix) == 0) {
58
+ std::string::size_type end = s.find("::", strlen(prefix));
59
+ if (end != s.npos) {
60
+ // Erase everything between the initial `std` and the second `::`.
61
+ s.erase(strlen("std"), end - strlen("std"));
62
+ }
63
+ }
64
+ return s;
65
+ }
66
+
67
+ #if GTEST_HAS_RTTI
68
+ // GetTypeName(const std::type_info&) returns a human-readable name of type T.
69
+ inline std::string GetTypeName(const std::type_info& type) {
70
+ const char* const name = type.name();
71
+ #if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
72
+ int status = 0;
73
+ // gcc's implementation of typeid(T).name() mangles the type name,
74
+ // so we have to demangle it.
75
+ #if GTEST_HAS_CXXABI_H_
76
+ using abi::__cxa_demangle;
77
+ #endif // GTEST_HAS_CXXABI_H_
78
+ char* const readable_name = __cxa_demangle(name, nullptr, nullptr, &status);
79
+ const std::string name_str(status == 0 ? readable_name : name);
80
+ free(readable_name);
81
+ return CanonicalizeForStdLibVersioning(name_str);
82
+ #else
83
+ return name;
84
+ #endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
85
+ }
86
+ #endif // GTEST_HAS_RTTI
87
+
88
+ // GetTypeName<T>() returns a human-readable name of type T if and only if
89
+ // RTTI is enabled, otherwise it returns a dummy type name.
90
+ // NB: This function is also used in Google Mock, so don't move it inside of
91
+ // the typed-test-only section below.
92
+ template <typename T>
93
+ std::string GetTypeName() {
94
+ #if GTEST_HAS_RTTI
95
+ return GetTypeName(typeid(T));
96
+ #else
97
+ return "<type>";
98
+ #endif // GTEST_HAS_RTTI
99
+ }
100
+
101
+ // A unique type indicating an empty node
102
+ struct None {};
103
+
104
+ # define GTEST_TEMPLATE_ template <typename T> class
105
+
106
+ // The template "selector" struct TemplateSel<Tmpl> is used to
107
+ // represent Tmpl, which must be a class template with one type
108
+ // parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
109
+ // as the type Tmpl<T>. This allows us to actually instantiate the
110
+ // template "selected" by TemplateSel<Tmpl>.
111
+ //
112
+ // This trick is necessary for simulating typedef for class templates,
113
+ // which C++ doesn't support directly.
114
+ template <GTEST_TEMPLATE_ Tmpl>
115
+ struct TemplateSel {
116
+ template <typename T>
117
+ struct Bind {
118
+ typedef Tmpl<T> type;
119
+ };
120
+ };
121
+
122
+ # define GTEST_BIND_(TmplSel, T) \
123
+ TmplSel::template Bind<T>::type
124
+
125
+ template <GTEST_TEMPLATE_ Head_, GTEST_TEMPLATE_... Tail_>
126
+ struct Templates {
127
+ using Head = TemplateSel<Head_>;
128
+ using Tail = Templates<Tail_...>;
129
+ };
130
+
131
+ template <GTEST_TEMPLATE_ Head_>
132
+ struct Templates<Head_> {
133
+ using Head = TemplateSel<Head_>;
134
+ using Tail = None;
135
+ };
136
+
137
+ // Tuple-like type lists
138
+ template <typename Head_, typename... Tail_>
139
+ struct Types {
140
+ using Head = Head_;
141
+ using Tail = Types<Tail_...>;
142
+ };
143
+
144
+ template <typename Head_>
145
+ struct Types<Head_> {
146
+ using Head = Head_;
147
+ using Tail = None;
148
+ };
149
+
150
+ // Helper metafunctions to tell apart a single type from types
151
+ // generated by ::testing::Types
152
+ template <typename... Ts>
153
+ struct ProxyTypeList {
154
+ using type = Types<Ts...>;
155
+ };
156
+
157
+ template <typename>
158
+ struct is_proxy_type_list : std::false_type {};
159
+
160
+ template <typename... Ts>
161
+ struct is_proxy_type_list<ProxyTypeList<Ts...>> : std::true_type {};
162
+
163
+ // Generator which conditionally creates type lists.
164
+ // It recognizes if a requested type list should be created
165
+ // and prevents creating a new type list nested within another one.
166
+ template <typename T>
167
+ struct GenerateTypeList {
168
+ private:
169
+ using proxy = typename std::conditional<is_proxy_type_list<T>::value, T,
170
+ ProxyTypeList<T>>::type;
171
+
172
+ public:
173
+ using type = typename proxy::type;
174
+ };
175
+
176
+ } // namespace internal
177
+
178
+ template <typename... Ts>
179
+ using Types = internal::ProxyTypeList<Ts...>;
180
+
181
+ } // namespace testing
182
+
183
+ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
data/miniconda3/include/mamba/core/activation.hpp ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_ACTIVATION_HPP
8
+ #define MAMBA_CORE_ACTIVATION_HPP
9
+
10
+ #include <string>
11
+ #include <unordered_map>
12
+ #include <utility>
13
+ #include <vector>
14
+
15
+ #include "mamba/fs/filesystem.hpp"
16
+
17
+ // TODO write a map that keeps insertion order
18
+
19
+ namespace mamba
20
+ {
21
+ class Context;
22
+
23
+ enum class ActivationType
24
+ {
25
+ ACTIVATE,
26
+ DEACTIVATE,
27
+ REACTIVATE
28
+ };
29
+
30
+ struct EnvironmentTransform
31
+ {
32
+ std::string export_path;
33
+ std::vector<std::string> unset_vars;
34
+ std::vector<std::pair<std::string, std::string>> set_vars;
35
+ std::vector<std::pair<std::string, std::string>> export_vars;
36
+ std::vector<fs::u8path> activate_scripts;
37
+ std::vector<fs::u8path> deactivate_scripts;
38
+ };
39
+
40
+ class Activator
41
+ {
42
+ public:
43
+
44
+ virtual ~Activator() = default;
45
+
46
+ Activator(const Activator&) = delete;
47
+ Activator& operator=(const Activator&) = delete;
48
+ Activator(Activator&&) = delete;
49
+ Activator& operator=(Activator&&) = delete;
50
+
51
+ virtual std::string script(const EnvironmentTransform& env) = 0;
52
+ virtual std::pair<std::string, std::string>
53
+ update_prompt(const std::string& conda_prompt_modifier) = 0;
54
+ virtual std::string shell_extension() = 0;
55
+ virtual std::string shell() = 0;
56
+
57
+ std::vector<fs::u8path> get_activate_scripts(const fs::u8path& prefix);
58
+ std::vector<fs::u8path> get_deactivate_scripts(const fs::u8path& prefix);
59
+
60
+ std::string get_default_env(const fs::u8path& prefix);
61
+ std::vector<std::pair<std::string, std::string>>
62
+ get_environment_vars(const fs::u8path& prefix);
63
+
64
+ std::string get_prompt_modifier(
65
+ const fs::u8path& prefix,
66
+ const std::string& conda_default_env,
67
+ int old_conda_shlvl
68
+ );
69
+
70
+ std::vector<fs::u8path> get_PATH();
71
+
72
+ std::string add_prefix_to_path(const fs::u8path& prefix, int old_conda_shlvl);
73
+ std::string
74
+ replace_prefix_in_path(const fs::u8path& old_prefix, const fs::u8path& new_prefix);
75
+ std::string remove_prefix_from_path(const fs::u8path& prefix);
76
+
77
+ void get_export_unset_vars(
78
+ EnvironmentTransform& envt,
79
+ const std::vector<std::pair<std::string, std::string>>& to_export
80
+ );
81
+
82
+ EnvironmentTransform build_reactivate();
83
+ EnvironmentTransform build_deactivate();
84
+ EnvironmentTransform build_activate(const fs::u8path& prefix);
85
+
86
+ std::string activate(const fs::u8path& prefix, bool stack);
87
+ std::string reactivate();
88
+ std::string deactivate();
89
+
90
+ virtual std::string hook_preamble() = 0;
91
+ virtual std::string hook_postamble() = 0;
92
+ virtual fs::u8path hook_source_path() = 0;
93
+
94
+ std::string hook(const std::string& shell_type);
95
+
96
+ protected:
97
+
98
+ explicit Activator(const Context& context);
99
+
100
+ const Context& m_context;
101
+ bool m_stack = false;
102
+ ActivationType m_action;
103
+
104
+ std::unordered_map<std::string, std::string> m_env;
105
+ };
106
+
107
+ class PosixActivator : public Activator
108
+ {
109
+ public:
110
+
111
+ explicit PosixActivator(const Context& context)
112
+ : Activator(context)
113
+ {
114
+ }
115
+
116
+ virtual ~PosixActivator() = default;
117
+
118
+ std::string script(const EnvironmentTransform& env_transform) override;
119
+ std::pair<std::string, std::string>
120
+ update_prompt(const std::string& conda_prompt_modifier) override;
121
+ std::string shell_extension() override;
122
+ std::string shell() override;
123
+
124
+ std::string hook_preamble() override;
125
+ std::string hook_postamble() override;
126
+ fs::u8path hook_source_path() override;
127
+ };
128
+
129
+ class CshActivator : public Activator
130
+ {
131
+ public:
132
+
133
+ explicit CshActivator(const Context& context)
134
+ : Activator(context)
135
+ {
136
+ }
137
+
138
+ virtual ~CshActivator() = default;
139
+
140
+ std::string script(const EnvironmentTransform& env_transform) override;
141
+ std::pair<std::string, std::string>
142
+ update_prompt(const std::string& conda_prompt_modifier) override;
143
+ std::string shell_extension() override;
144
+ std::string shell() override;
145
+
146
+ std::string hook_preamble() override;
147
+ std::string hook_postamble() override;
148
+ fs::u8path hook_source_path() override;
149
+ };
150
+
151
+ class CmdExeActivator : public Activator
152
+ {
153
+ public:
154
+
155
+ explicit CmdExeActivator(const Context& context)
156
+ : Activator(context)
157
+ {
158
+ }
159
+
160
+ virtual ~CmdExeActivator() = default;
161
+
162
+ std::string script(const EnvironmentTransform& env_transform) override;
163
+ std::pair<std::string, std::string>
164
+ update_prompt(const std::string& conda_prompt_modifier) override;
165
+ std::string shell_extension() override;
166
+ std::string shell() override;
167
+
168
+ std::string hook_preamble() override;
169
+ std::string hook_postamble() override;
170
+ fs::u8path hook_source_path() override;
171
+ };
172
+
173
+ class PowerShellActivator : public Activator
174
+ {
175
+ public:
176
+
177
+ explicit PowerShellActivator(const Context& context)
178
+ : Activator(context)
179
+ {
180
+ }
181
+
182
+ virtual ~PowerShellActivator() = default;
183
+
184
+ std::string script(const EnvironmentTransform& env_transform) override;
185
+ std::pair<std::string, std::string>
186
+ update_prompt(const std::string& conda_prompt_modifier) override;
187
+ std::string shell_extension() override;
188
+ std::string shell() override;
189
+
190
+ std::string hook_preamble() override;
191
+ std::string hook_postamble() override;
192
+ fs::u8path hook_source_path() override;
193
+ };
194
+
195
+ class XonshActivator : public Activator
196
+ {
197
+ public:
198
+
199
+ explicit XonshActivator(const Context& context)
200
+ : Activator(context)
201
+ {
202
+ }
203
+
204
+ virtual ~XonshActivator() = default;
205
+
206
+ std::string script(const EnvironmentTransform& env_transform) override;
207
+ std::pair<std::string, std::string>
208
+ update_prompt(const std::string& conda_prompt_modifier) override;
209
+ std::string shell_extension() override;
210
+ std::string shell() override;
211
+
212
+ std::string hook_preamble() override;
213
+ std::string hook_postamble() override;
214
+ fs::u8path hook_source_path() override;
215
+ };
216
+
217
+ class FishActivator : public Activator
218
+ {
219
+ public:
220
+
221
+ explicit FishActivator(const Context& context)
222
+ : Activator(context)
223
+ {
224
+ }
225
+
226
+ virtual ~FishActivator() = default;
227
+
228
+ std::string script(const EnvironmentTransform& env_transform) override;
229
+ std::pair<std::string, std::string>
230
+ update_prompt(const std::string& conda_prompt_modifier) override;
231
+ std::string shell_extension() override;
232
+ std::string shell() override;
233
+
234
+ std::string hook_preamble() override;
235
+ std::string hook_postamble() override;
236
+ fs::u8path hook_source_path() override;
237
+ };
238
+
239
+ class NuActivator : public Activator
240
+ {
241
+ public:
242
+
243
+ explicit NuActivator(const Context& context)
244
+ : Activator(context)
245
+ {
246
+ }
247
+
248
+ virtual ~NuActivator() = default;
249
+
250
+ std::string script(const EnvironmentTransform& env_transform) override;
251
+ std::pair<std::string, std::string>
252
+ update_prompt(const std::string& conda_prompt_modifier) override;
253
+ std::string shell_extension() override;
254
+ std::string shell() override;
255
+
256
+ std::string hook_preamble() override;
257
+ std::string hook_postamble() override;
258
+ fs::u8path hook_source_path() override;
259
+ };
260
+
261
+ } // namespace mamba
262
+
263
+ #endif
data/miniconda3/include/mamba/core/channel_context.hpp ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_CHANNEL_HPP
8
+ #define MAMBA_CORE_CHANNEL_HPP
9
+
10
+ #include <string>
11
+ #include <string_view>
12
+
13
+ #include "mamba/specs/channel.hpp"
14
+
15
+ namespace mamba
16
+ {
17
+ class Context;
18
+
19
+ class ChannelContext
20
+ {
21
+ public:
22
+
23
+ using ChannelResolveParams = specs::ChannelResolveParams;
24
+ using Channel = specs::Channel;
25
+ using channel_list = ChannelResolveParams::channel_list;
26
+
27
+ /**
28
+ * Create a ChannelContext with a simple parsing of the context options.
29
+ *
30
+ * No hardcoded names are added.
31
+ * Custom channels are treated as aliases rather than the Conda way (the name is not
32
+ * added at the end of the URL if absent).
33
+ */
34
+ [[nodiscard]] static auto make_simple(const Context& ctx) -> ChannelContext;
35
+
36
+ /**
37
+ * Create a ChannelContext while applying all of Conda context options.
38
+ *
39
+ * If not defined, the Conda custom channels "pkgs/main", "pkgs/r", "pkgs/pro",
40
+ * and "pkgs/msys2" (Windows only) will be added.
41
+ * If not defined, the Conda custom mutlit channels "defaults" and "local" will
42
+ * be added.
43
+ * The function will ensure custom channels names are added at the end of the URLs.
44
+ */
45
+ [[nodiscard]] static auto make_conda_compatible(const Context& ctx) -> ChannelContext;
46
+
47
+ /**
48
+ * Initialize channel with the parameters as they are.
49
+ *
50
+ * The Context is not parsed.
51
+ */
52
+ ChannelContext(ChannelResolveParams params, std::vector<Channel> has_zst);
53
+
54
+ [[nodiscard]] auto make_channel(specs::UnresolvedChannel uc) -> const channel_list&;
55
+ [[nodiscard]] auto make_channel(std::string_view name) -> const channel_list&;
56
+ [[nodiscard]] auto
57
+ make_channel(std::string_view name, const std::vector<std::string>& mirrors)
58
+ -> const channel_list&;
59
+
60
+ [[nodiscard]] auto params() const -> const specs::ChannelResolveParams&;
61
+
62
+ [[nodiscard]] auto has_zst(const Channel& chan) const -> bool;
63
+
64
+ private:
65
+
66
+ using ChannelCache = std::unordered_map<std::string, channel_list>;
67
+
68
+ ChannelResolveParams m_channel_params;
69
+ ChannelCache m_channel_cache;
70
+ std::vector<Channel> m_has_zst;
71
+ };
72
+ }
73
+ #endif
data/miniconda3/include/mamba/core/common_types.hpp ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_COMMON_TYPES_HPP
8
+ #define MAMBA_CORE_COMMON_TYPES_HPP
9
+
10
+ namespace mamba
11
+ {
12
+ enum class log_level
13
+ {
14
+ trace,
15
+ debug,
16
+ info,
17
+ warn,
18
+ err,
19
+ critical,
20
+ off
21
+ };
22
+ }
23
+
24
+ #endif
data/miniconda3/include/mamba/core/context.hpp ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_CONTEXT_HPP
8
+ #define MAMBA_CORE_CONTEXT_HPP
9
+
10
+ #include <map>
11
+ #include <optional>
12
+ #include <string>
13
+ #include <vector>
14
+
15
+ #include "mamba/core/common_types.hpp"
16
+ #include "mamba/core/context_params.hpp"
17
+ #include "mamba/core/palette.hpp"
18
+ #include "mamba/core/subdir_parameters.hpp"
19
+ #include "mamba/core/tasksync.hpp"
20
+ #include "mamba/download/mirror_map.hpp"
21
+ #include "mamba/download/parameters.hpp"
22
+ #include "mamba/fs/filesystem.hpp"
23
+ #include "mamba/solver/libsolv/parameters.hpp"
24
+ #include "mamba/solver/request.hpp"
25
+ #include "mamba/specs/authentication_info.hpp"
26
+ #include "mamba/specs/platform.hpp"
27
+ #include "mamba/version.hpp"
28
+
29
+ #define ROOT_ENV_NAME "base"
30
+
31
+ namespace mamba
32
+ {
33
+ enum class VerificationLevel
34
+ {
35
+ Disabled,
36
+ Warn,
37
+ Enabled
38
+ };
39
+
40
+ struct ValidationParams
41
+ {
42
+ VerificationLevel safety_checks = VerificationLevel::Warn;
43
+ bool extra_safety_checks = false;
44
+ bool verify_artifacts = false;
45
+
46
+ // TODO Uncomment `conda-forge` or whatever trusted_channels when possible
47
+ // (i.e server side package signing ready)
48
+ // Remove "http://127.0.0.1:8000/get/channel0"
49
+ // (should only be used in integration tests,
50
+ // this one is for testing with quetz)
51
+ std::vector<std::string> trusted_channels = {
52
+ /*"conda-forge", */ "http://127.0.0.1:8000/get/channel0"
53
+ };
54
+ };
55
+
56
+ enum class ChannelPriority
57
+ {
58
+ Disabled,
59
+ Flexible,
60
+ Strict
61
+ };
62
+
63
+
64
+ class Logger;
65
+ class Context;
66
+
67
+ struct ContextOptions
68
+ {
69
+ bool enable_logging = false;
70
+ bool enable_signal_handling = false;
71
+ };
72
+
73
+ // Context singleton class
74
+ class Context
75
+ {
76
+ public:
77
+
78
+ static void use_default_signal_handler(bool val);
79
+
80
+ struct OutputParams
81
+ {
82
+ int verbosity{ 0 };
83
+ log_level logging_level{ log_level::warn };
84
+
85
+ bool json{ false };
86
+ bool quiet{ false };
87
+
88
+ std::string log_pattern{ "%^%-9!l%-8n%$ %v" };
89
+ std::size_t log_backtrace{ 0 };
90
+ };
91
+
92
+ struct GraphicsParams
93
+ {
94
+ bool no_progress_bars{ false };
95
+ Palette palette;
96
+ };
97
+
98
+ struct SrcParams
99
+ {
100
+ bool no_rc{ false };
101
+ bool no_env{ false };
102
+ };
103
+
104
+ // Configurable
105
+ bool experimental = false;
106
+ bool experimental_repodata_parsing = true;
107
+ bool experimental_matchspec_parsing = false;
108
+ bool debug = false;
109
+ bool use_uv = false;
110
+
111
+ // TODO check writable and add other potential dirs
112
+ std::vector<fs::u8path> envs_dirs;
113
+ std::vector<fs::u8path> pkgs_dirs;
114
+ std::optional<std::string> env_lockfile;
115
+
116
+ bool use_index_cache = false;
117
+ std::size_t local_repodata_ttl = 1; // take from header
118
+ bool offline = false;
119
+
120
+ ChannelPriority channel_priority = ChannelPriority::Flexible;
121
+ bool auto_activate_base = false;
122
+
123
+ bool extract_sparse = false;
124
+
125
+ bool dry_run = false;
126
+ bool download_only = false;
127
+ bool always_yes = false;
128
+
129
+ bool register_envs = true;
130
+
131
+ bool show_anaconda_channel_warnings = true;
132
+
133
+ // solver options
134
+ solver::Request::Flags solver_flags = {};
135
+
136
+ // add start menu shortcuts on Windows (not implemented on Linux / macOS)
137
+ bool shortcuts = true;
138
+
139
+ // debug helpers
140
+ bool keep_temp_files = false;
141
+ bool keep_temp_directories = false;
142
+
143
+ bool change_ps1 = true;
144
+ std::string env_prompt = "({default_env}) ";
145
+ bool ascii_only = false;
146
+ // micromamba only
147
+ bool shell_completion = true;
148
+
149
+ OutputParams output_params;
150
+ GraphicsParams graphics_params;
151
+ SrcParams src_params;
152
+ CommandParams command_params;
153
+ ThreadsParams threads_params;
154
+ PrefixParams prefix_params;
155
+ ValidationParams validation_params;
156
+ LinkParams link_params;
157
+
158
+ download::RemoteFetchParams remote_fetch_params = {
159
+ .ssl_verify = { "" },
160
+ .ssl_no_revoke = false,
161
+ .curl_initialized = false,
162
+ .user_agent = { "mamba/" LIBMAMBA_VERSION_STRING },
163
+ .connect_timeout_secs = 10.,
164
+ .retry_timeout = 2,
165
+ .retry_backoff = 3,
166
+ .max_retries = 3,
167
+ .proxy_servers = {},
168
+ };
169
+
170
+ download::Options download_options() const
171
+ {
172
+ return {
173
+ .download_threads = this->threads_params.download_threads,
174
+ .fail_fast = false,
175
+ .sort = true,
176
+ .verbose = this->output_params.verbosity >= 2,
177
+ };
178
+ }
179
+
180
+ SubdirParams subdir_params() const
181
+ {
182
+ const auto get_local_repodata_ttl = [&]() -> std::optional<std::size_t>
183
+ {
184
+ // Force the use of index cache by setting TTL to 0
185
+ if (this->use_index_cache)
186
+ {
187
+ return { 0 };
188
+ }
189
+ // This is legacy where from where 1 meant to read from header
190
+ if (this->local_repodata_ttl == 1)
191
+ {
192
+ return std::nullopt;
193
+ }
194
+ return { this->local_repodata_ttl };
195
+ };
196
+
197
+ return {
198
+ .local_repodata_ttl_s = get_local_repodata_ttl(),
199
+ .offline = this->offline,
200
+ .repodata_force_use_zst = false // Must override based on ChannelContext
201
+ };
202
+ }
203
+
204
+ SubdirDownloadParams subdir_download_params() const
205
+ {
206
+ return {
207
+ .offline = this->offline,
208
+ .repodata_check_zst = this->repodata_use_zst,
209
+ };
210
+ }
211
+
212
+ TransactionParams transaction_params() const
213
+ {
214
+ return {
215
+ .is_mamba_exe = command_params.is_mamba_exe,
216
+ .json_output = output_params.json,
217
+ .verbosity = output_params.verbosity,
218
+ .shortcuts = shortcuts,
219
+ .envs_dirs = envs_dirs,
220
+ .platform = platform,
221
+ .prefix_params = prefix_params,
222
+ .link_params = link_params,
223
+ .threads_params = threads_params,
224
+ };
225
+ }
226
+
227
+ std::size_t lock_timeout = 0;
228
+ bool use_lockfiles = true;
229
+
230
+ // Conda compat
231
+ bool add_pip_as_python_dependency = true;
232
+
233
+ std::string host_platform = std::string(specs::build_platform_name());
234
+ std::string platform = std::string(specs::build_platform_name());
235
+ std::vector<std::string> platforms() const;
236
+
237
+ std::vector<std::string> channels = { "conda-forge" };
238
+ std::map<std::string, std::string> custom_channels;
239
+ std::map<std::string, std::vector<std::string>> custom_multichannels;
240
+
241
+ std::vector<std::string> default_channels = {
242
+ #ifdef _WIN32
243
+ "https://repo.anaconda.com/pkgs/main",
244
+ "https://repo.anaconda.com/pkgs/r",
245
+ "https://repo.anaconda.com/pkgs/msys2"
246
+ #else
247
+ "https://repo.anaconda.com/pkgs/main",
248
+ "https://repo.anaconda.com/pkgs/r"
249
+ #endif
250
+ };
251
+
252
+ std::map<std::string, std::vector<std::string>> mirrored_channels;
253
+ std::string channel_alias = "https://conda.anaconda.org";
254
+ specs::AuthenticationDataBase& authentication_info();
255
+ const specs::AuthenticationDataBase& authentication_info() const;
256
+ std::vector<fs::u8path> token_locations{ "~/.continuum/anaconda-client/tokens" };
257
+
258
+ bool override_channels_enabled = true;
259
+
260
+ std::vector<std::string> pinned_packages = {};
261
+
262
+ bool use_only_tar_bz2 = false;
263
+
264
+ bool repodata_use_zst = true;
265
+ std::vector<std::string> repodata_has_zst = { "https://conda.anaconda.org/conda-forge" };
266
+
267
+ // FIXME: Should not be stored here
268
+ // Notice that we cannot build this map directly from mirrored_channels,
269
+ // since we need to add a single "mirror" for non mirrored channels
270
+ download::mirror_map mirrors;
271
+
272
+ Context(const Context&) = delete;
273
+ Context& operator=(const Context&) = delete;
274
+
275
+ Context(Context&&) = delete;
276
+ Context& operator=(Context&&) = delete;
277
+
278
+ void debug_print() const;
279
+ void dump_backtrace_no_guards();
280
+
281
+ void set_verbosity(int lvl);
282
+ void set_log_level(log_level level);
283
+
284
+ Context(const ContextOptions& options = {});
285
+ ~Context();
286
+
287
+ private:
288
+
289
+ // Used internally
290
+ bool on_ci = false;
291
+
292
+ void load_authentication_info();
293
+ specs::AuthenticationDataBase m_authentication_info;
294
+ bool m_authentication_infos_loaded = false;
295
+
296
+ class ScopedLogger;
297
+ std::vector<ScopedLogger> loggers;
298
+
299
+ std::shared_ptr<Logger> main_logger();
300
+ void add_logger(std::shared_ptr<Logger>);
301
+
302
+ TaskSynchronizer tasksync;
303
+
304
+
305
+ // Enables the provided context setup signal handling.
306
+ // This function must be called only for one Context in the lifetime of the program.
307
+ void enable_signal_handling();
308
+
309
+ // Enables the provided context to drive the logging system.
310
+ // This function must be called only for one Context in the lifetime of the program.
311
+ void enable_logging();
312
+ };
313
+
314
+
315
+ } // namespace mamba
316
+
317
+ #endif // MAMBA_CONTEXT_HPP
data/miniconda3/include/mamba/core/context_params.hpp ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #pragma once
8
+
9
+ #include <string>
10
+ #include <vector>
11
+
12
+ #include "mamba/fs/filesystem.hpp"
13
+
14
+ // TODO move these structures back to Context.hpp or rename this file
15
+ // with a better name when the Context is fully refactored.
16
+ namespace mamba
17
+ {
18
+ struct CommandParams
19
+ {
20
+ std::string caller_version{ "" };
21
+ std::string conda_version{ "3.8.0" };
22
+ std::string current_command{ "mamba" };
23
+ /** Is the Context used in a mamba or mamba executable (instead of a lib). */
24
+ bool is_mamba_exe{ false };
25
+ };
26
+
27
+ struct PrefixParams
28
+ {
29
+ fs::u8path target_prefix;
30
+ fs::u8path root_prefix;
31
+ fs::u8path conda_prefix;
32
+ fs::u8path relocate_prefix;
33
+ };
34
+
35
+ struct LinkParams
36
+ {
37
+ bool allow_softlinks = false;
38
+ bool always_copy = false;
39
+ bool always_softlink = false;
40
+ bool compile_pyc = true;
41
+ };
42
+
43
+ struct ThreadsParams
44
+ {
45
+ std::size_t download_threads{ 5 };
46
+ int extract_threads{ 0 };
47
+ };
48
+
49
+ struct TransactionParams
50
+ {
51
+ bool is_mamba_exe;
52
+ bool json_output;
53
+ int verbosity;
54
+ bool shortcuts;
55
+ std::vector<fs::u8path> envs_dirs;
56
+ std::string platform;
57
+
58
+ PrefixParams prefix_params;
59
+ LinkParams link_params;
60
+ ThreadsParams threads_params;
61
+ };
62
+ }
data/miniconda3/include/mamba/core/download_progress_bar.hpp ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_DOWNLOAD_PROGRESS_BAR_HPP
8
+ #define MAMBA_CORE_DOWNLOAD_PROGRESS_BAR_HPP
9
+
10
+ #include <chrono>
11
+ #include <functional>
12
+ #include <vector>
13
+
14
+ #include "mamba/core/context.hpp"
15
+ #include "mamba/core/package_fetcher.hpp"
16
+ #include "mamba/download/downloader.hpp"
17
+
18
+ namespace mamba
19
+ {
20
+ struct MonitorOptions
21
+ {
22
+ bool checking_download = false;
23
+ bool no_clear_progress_bar = false;
24
+ };
25
+
26
+ class SubdirIndexMonitor : public download::Monitor
27
+ {
28
+ public:
29
+
30
+ static bool can_monitor(const Context& context);
31
+
32
+ explicit SubdirIndexMonitor(MonitorOptions options = {});
33
+ virtual ~SubdirIndexMonitor() = default;
34
+
35
+ SubdirIndexMonitor(const SubdirIndexMonitor&) = delete;
36
+ SubdirIndexMonitor& operator=(const SubdirIndexMonitor&) = delete;
37
+
38
+ SubdirIndexMonitor(SubdirIndexMonitor&&) = delete;
39
+ SubdirIndexMonitor& operator=(SubdirIndexMonitor&&) = delete;
40
+
41
+ void reset_options(MonitorOptions options);
42
+
43
+ private:
44
+
45
+ void observe_impl(download::MultiRequest& requests, download::Options& options) override;
46
+ void on_done_impl() override;
47
+ void on_unexpected_termination_impl() override;
48
+
49
+ void update_progress_bar(std::size_t index, const download::Event& event);
50
+ void update_progress_bar(std::size_t index, const download::Progress& progress);
51
+ void update_progress_bar(std::size_t index, const download::Error& error);
52
+ void update_progress_bar(std::size_t index, const download::Success& success);
53
+
54
+ void complete_checking_progress_bar(std::size_t index);
55
+
56
+ using time_point = std::chrono::steady_clock::time_point;
57
+ std::vector<time_point> m_throttle_time;
58
+ std::vector<ProgressProxy> m_progress_bar;
59
+ MonitorOptions m_options;
60
+ };
61
+
62
+ class PackageDownloadMonitor : public download::Monitor
63
+ {
64
+ public:
65
+
66
+ static bool can_monitor(const Context& context);
67
+
68
+ PackageDownloadMonitor() = default;
69
+ virtual ~PackageDownloadMonitor();
70
+
71
+ PackageDownloadMonitor(const PackageDownloadMonitor&) = delete;
72
+ PackageDownloadMonitor& operator=(const PackageDownloadMonitor&) = delete;
73
+
74
+ PackageDownloadMonitor(PackageDownloadMonitor&&) = delete;
75
+ PackageDownloadMonitor& operator=(PackageDownloadMonitor&&) = delete;
76
+
77
+ // Requires extract_tasks.size() >= requests.size()
78
+ // Requires for i in [0, dl_requests.size()), extract_tasks[i].needs_download()
79
+ void observe(
80
+ download::MultiRequest& dl_requests,
81
+ std::vector<PackageExtractTask>& extract_tasks,
82
+ download::Options& options
83
+ );
84
+
85
+ void end_monitoring();
86
+
87
+ private:
88
+
89
+ void init_extract_bar(ProgressProxy& extract_bar);
90
+ void init_download_bar(ProgressProxy& download_bar);
91
+ void init_aggregated_extract();
92
+ void init_aggregated_download();
93
+
94
+ void update_extract_bar(std::size_t index, PackageExtractEvent event);
95
+
96
+ void observe_impl(download::MultiRequest& requests, download::Options& options) override;
97
+ void on_done_impl() override;
98
+ void on_unexpected_termination_impl() override;
99
+
100
+ void update_progress_bar(std::size_t index, const download::Event& event);
101
+ void update_progress_bar(std::size_t index, const download::Progress& progress);
102
+ void update_progress_bar(std::size_t index, const download::Error& error);
103
+ void update_progress_bar(std::size_t index, const download::Success& success);
104
+
105
+ std::vector<ProgressProxy> m_extract_bar;
106
+
107
+ using time_point = std::chrono::steady_clock::time_point;
108
+ std::vector<time_point> m_throttle_time;
109
+ std::vector<ProgressProxy> m_download_bar;
110
+ };
111
+ }
112
+
113
+ #endif
data/miniconda3/include/mamba/core/env_lockfile.hpp ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2022, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+
8
+ #ifndef MAMBA_CORE_ENVIRONMENT_LOCKFILE_HPP
9
+ #define MAMBA_CORE_ENVIRONMENT_LOCKFILE_HPP
10
+
11
+ #include <optional>
12
+ #include <string>
13
+ #include <typeindex>
14
+ #include <unordered_map>
15
+
16
+ #include <tl/expected.hpp>
17
+
18
+ #include "mamba/core/error_handling.hpp"
19
+ #include "mamba/core/fsutil.hpp"
20
+ #include "mamba/fs/filesystem.hpp"
21
+ #include "mamba/specs/package_info.hpp"
22
+
23
+ namespace mamba
24
+ {
25
+ class Context;
26
+ class ChannelContext;
27
+
28
+ enum class file_parsing_error_code
29
+ {
30
+ unknown_failure, /// Something failed while parsing but we can't identify what.
31
+ unsupported_version, /// The version of the file does not matched supported ver.
32
+ parsing_failure, /// The content of the file doesnt match the expected format/language
33
+ /// structure or constraints.
34
+ invalid_data, /// The structure of the data in the file is fine but some fields have
35
+ /// invalid values for our purpose.
36
+ };
37
+
38
+ struct EnvLockFileError
39
+ {
40
+ file_parsing_error_code parsing_error_code = file_parsing_error_code::unknown_failure;
41
+ std::optional<std::type_index> yaml_error_type{};
42
+
43
+ static const EnvLockFileError& get_details(const mamba_error& error)
44
+ {
45
+ return std::any_cast<const EnvLockFileError&>(error.data());
46
+ }
47
+
48
+ template <typename StringT>
49
+ static mamba_error make_error(
50
+ file_parsing_error_code error_code,
51
+ StringT&& msg,
52
+ std::optional<std::type_index> yaml_error_type = std::nullopt
53
+ )
54
+ {
55
+ return mamba_error{ std::forward<StringT>(msg),
56
+ mamba_error_code::env_lockfile_parsing_failed,
57
+ EnvLockFileError{ error_code, yaml_error_type } };
58
+ }
59
+ };
60
+
61
+ class EnvironmentLockFile
62
+ {
63
+ public:
64
+
65
+ struct Channel
66
+ {
67
+ std::string url;
68
+ std::vector<std::string> used_env_vars;
69
+ };
70
+
71
+ struct Meta
72
+ {
73
+ std::unordered_map<std::string, std::string> content_hash;
74
+ std::vector<Channel> channels;
75
+ std::vector<std::string> platforms;
76
+ std::vector<std::string> sources;
77
+ };
78
+
79
+ struct Package
80
+ {
81
+ specs::PackageInfo info;
82
+ bool is_optional = false;
83
+ std::string category;
84
+ std::string manager;
85
+ std::string platform;
86
+ };
87
+
88
+ EnvironmentLockFile(Meta metadata, std::vector<Package> packages)
89
+ : m_metadata(std::move(metadata))
90
+ , m_packages(std::move(packages))
91
+ {
92
+ }
93
+
94
+ std::vector<specs::PackageInfo>
95
+ get_packages_for(std::string_view category, std::string_view platform, std::string_view manager)
96
+ const;
97
+
98
+ const std::vector<Package>& get_all_packages() const
99
+ {
100
+ return m_packages;
101
+ }
102
+
103
+ const Meta& get_metadata() const
104
+ {
105
+ return m_metadata;
106
+ }
107
+
108
+ private:
109
+
110
+ Meta m_metadata;
111
+ std::vector<Package> m_packages;
112
+ };
113
+
114
+ /// Read an environment lock YAML file and returns it's structured content or an error if
115
+ /// failed.
116
+ tl::expected<EnvironmentLockFile, mamba_error>
117
+ read_environment_lockfile(const mamba::fs::u8path& lockfile_location);
118
+
119
+
120
+ /// Returns `true` if the filename matches names of files which should be interpreted as conda
121
+ /// environment lockfile. NOTE: this does not check if the file exists.
122
+ bool is_env_lockfile_name(std::string_view filename);
123
+ }
124
+ #endif
data/miniconda3/include/mamba/core/environments_manager.hpp ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_ENVIRONMENT_MANAGER
8
+ #define MAMBA_CORE_ENVIRONMENT_MANAGER
9
+
10
+ #include <set>
11
+ #include <string>
12
+ #include <vector>
13
+
14
+ #include "fsutil.hpp"
15
+
16
+ namespace mamba
17
+ {
18
+ class Context;
19
+
20
+ const char PREFIX_MAGIC_FILE[] = "conda-meta/history";
21
+
22
+ bool is_conda_environment(const fs::u8path& prefix);
23
+
24
+ std::string env_name(
25
+ const std::vector<fs::u8path>& envs_dirs,
26
+ const fs::u8path& root_prefix,
27
+ const fs::u8path& prefix
28
+ );
29
+
30
+ class EnvironmentsManager
31
+ {
32
+ public:
33
+
34
+ explicit EnvironmentsManager(const Context& context);
35
+
36
+ void register_env(const fs::u8path& location);
37
+ void unregister_env(const fs::u8path& location);
38
+ std::set<fs::u8path> list_all_known_prefixes();
39
+
40
+ private:
41
+
42
+ const Context& m_context;
43
+ std::set<std::string>
44
+ clean_environments_txt(const fs::u8path& env_txt_file, const fs::u8path& location);
45
+ std::string remove_trailing_slash(std::string p);
46
+ fs::u8path get_environments_txt_file(const fs::u8path& home) const;
47
+ };
48
+ } // namespace mamba
49
+
50
+ #endif
data/miniconda3/include/mamba/core/error_handling.hpp ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef MAMBA_ERROR_HANDLING_HPP
2
+ #define MAMBA_ERROR_HANDLING_HPP
3
+
4
+ #include <any>
5
+ #include <stdexcept>
6
+ #include <string>
7
+ #include <vector>
8
+
9
+ #include "tl/expected.hpp"
10
+
11
+ namespace mamba
12
+ {
13
+
14
+ /*********************
15
+ * Mamba exceptions *
16
+ *********************/
17
+
18
+ enum class mamba_error_code
19
+ {
20
+ unknown,
21
+ aggregated,
22
+ prefix_data_not_loaded,
23
+ subdirdata_not_loaded,
24
+ cache_not_loaded,
25
+ repodata_not_loaded,
26
+ configurable_bad_cast,
27
+ env_lockfile_parsing_failed,
28
+ openssl_failed,
29
+ internal_failure,
30
+ lockfile_failure,
31
+ selfupdate_failure,
32
+ satisfiablitity_error,
33
+ user_interrupted,
34
+ incorrect_usage,
35
+ invalid_spec,
36
+ download_content
37
+ };
38
+
39
+ class mamba_error : public std::runtime_error
40
+ {
41
+ public:
42
+
43
+ using base_type = std::runtime_error;
44
+
45
+ mamba_error(const std::string& msg, mamba_error_code ec);
46
+ mamba_error(const char* msg, mamba_error_code ec);
47
+ mamba_error(const std::string& msg, mamba_error_code ec, std::any&& data);
48
+ mamba_error(const char* msg, mamba_error_code ec, std::any&& data);
49
+
50
+ mamba_error_code error_code() const noexcept;
51
+ const std::any& data() const noexcept;
52
+
53
+ private:
54
+
55
+ mamba_error_code m_error_code;
56
+ std::any m_data;
57
+ };
58
+
59
+ class mamba_aggregated_error : public mamba_error
60
+ {
61
+ public:
62
+
63
+ using base_type = mamba_error;
64
+ using error_list_t = std::vector<mamba_error>;
65
+
66
+ explicit mamba_aggregated_error(error_list_t&& error_list);
67
+
68
+ const char* what() const noexcept override;
69
+
70
+ private:
71
+
72
+ error_list_t m_error_list;
73
+ mutable std::string m_aggregated_message;
74
+ static constexpr const char* m_base_message = "Multiple errors occurred:\n";
75
+ };
76
+
77
+ /********************************
78
+ * wrappers around tl::expected *
79
+ ********************************/
80
+
81
+ template <class T, class E>
82
+ class expected_ref_wrapper : private tl::expected<std::reference_wrapper<T>, E>
83
+ {
84
+ public:
85
+
86
+ using value_type = T;
87
+ using self_type = expected_ref_wrapper<T, E>;
88
+ using reference = std::reference_wrapper<T>;
89
+ using base_type = tl::expected<reference, E>;
90
+
91
+ using base_type::base_type;
92
+ using base_type::operator=;
93
+ using base_type::emplace;
94
+ using base_type::error;
95
+ using base_type::operator bool;
96
+ using base_type::has_value;
97
+
98
+ constexpr void swap(self_type& rhs) noexcept;
99
+
100
+ constexpr const T* operator->() const noexcept;
101
+ constexpr T* operator->() noexcept;
102
+ constexpr const T& operator*() const& noexcept;
103
+ constexpr T& operator*() & noexcept;
104
+ constexpr const T&& operator*() const&& noexcept;
105
+ constexpr T&& operator*() && noexcept;
106
+
107
+ constexpr T& value() &;
108
+ constexpr const T&& value() const&&;
109
+ constexpr T&& value() &&;
110
+
111
+ template <class U>
112
+ constexpr T value_or(U&&) const&;
113
+ template <class U>
114
+ constexpr T value_or(U&&) &&;
115
+
116
+ template <class T2, class E2>
117
+ friend constexpr bool operator==(const self_type& x, const expected_ref_wrapper<T2, E2>& y);
118
+
119
+ template <class T2>
120
+ friend constexpr bool operator==(const self_type&, const T2&);
121
+
122
+ template <class E2>
123
+ friend constexpr bool operator==(const self_type&, const tl::unexpected<E2>&);
124
+ };
125
+
126
+ namespace detail
127
+ {
128
+ template <class T, class E>
129
+ struct get_expected
130
+ {
131
+ using type = tl::expected<T, E>;
132
+ };
133
+
134
+ template <class T, class E>
135
+ struct get_expected<T&, E>
136
+ {
137
+ using type = expected_ref_wrapper<T, E>;
138
+ };
139
+ }
140
+
141
+ template <class T, class E = mamba_error>
142
+ using expected_t = typename detail::get_expected<T, E>::type;
143
+
144
+ /********************
145
+ * helper functions *
146
+ ********************/
147
+
148
+ tl::unexpected<mamba_error> make_unexpected(const char* msg, mamba_error_code ec);
149
+
150
+ tl::unexpected<mamba_error> make_unexpected(const std::string& msg, mamba_error_code sc);
151
+
152
+ tl::unexpected<mamba_aggregated_error> make_unexpected(std::vector<mamba_error>&& error_list);
153
+
154
+ template <class T, class E>
155
+ tl::unexpected<E> forward_error(const tl::expected<T, E>& exp);
156
+
157
+ template <class T, class E>
158
+ tl::unexpected<E> forward_error(const expected_ref_wrapper<T, E>& exp);
159
+
160
+ template <class T, class E>
161
+ T& extract(tl::expected<T, E>& exp);
162
+
163
+ template <class T, class E>
164
+ const T& extract(const tl::expected<T, E>& exp);
165
+
166
+ template <class T, class E>
167
+ T&& extract(tl::expected<T, E>&& exp);
168
+
169
+ template <class T, class E>
170
+ T& extract(expected_ref_wrapper<T, E>& exp);
171
+
172
+ template <class T, class E>
173
+ const T& extract(const expected_ref_wrapper<T, E>& exp);
174
+
175
+ template <class T, class E>
176
+ T&& extract(expected_ref_wrapper<T, E>&& exp);
177
+
178
+ /***************************************
179
+ * expected_ref_wrapper implementation *
180
+ ***************************************/
181
+
182
+ template <class T, class E>
183
+ constexpr void expected_ref_wrapper<T, E>::swap(self_type& rhs) noexcept
184
+ {
185
+ base_type::swap(rhs);
186
+ }
187
+
188
+ template <class T, class E>
189
+ constexpr const T* expected_ref_wrapper<T, E>::operator->() const noexcept
190
+ {
191
+ return &(base_type::operator->()->get());
192
+ }
193
+
194
+ template <class T, class E>
195
+ constexpr T* expected_ref_wrapper<T, E>::operator->() noexcept
196
+ {
197
+ return &(base_type::operator->()->get());
198
+ }
199
+
200
+ template <class T, class E>
201
+ constexpr const T& expected_ref_wrapper<T, E>::operator*() const& noexcept
202
+ {
203
+ return base_type::operator*().get();
204
+ }
205
+
206
+ template <class T, class E>
207
+ constexpr T& expected_ref_wrapper<T, E>::operator*() & noexcept
208
+ {
209
+ return base_type::operator*().get();
210
+ }
211
+
212
+ template <class T, class E>
213
+ constexpr const T&& expected_ref_wrapper<T, E>::operator*() const&& noexcept
214
+ {
215
+ return std::move(base_type::operator*().get());
216
+ }
217
+
218
+ template <class T, class E>
219
+ constexpr T&& expected_ref_wrapper<T, E>::operator*() && noexcept
220
+ {
221
+ return std::move(base_type::operator*().get());
222
+ }
223
+
224
+ template <class T, class E>
225
+ constexpr T& expected_ref_wrapper<T, E>::value() &
226
+ {
227
+ return base_type::value().get();
228
+ }
229
+
230
+ template <class T, class E>
231
+ constexpr const T&& expected_ref_wrapper<T, E>::value() const&&
232
+ {
233
+ return std::move(base_type::value().get());
234
+ }
235
+
236
+ template <class T, class E>
237
+ constexpr T&& expected_ref_wrapper<T, E>::value() &&
238
+ {
239
+ return std::move(base_type::value().get());
240
+ }
241
+
242
+ template <class T, class E>
243
+ template <class U>
244
+ constexpr T expected_ref_wrapper<T, E>::value_or(U&& u) const&
245
+ {
246
+ return base_type::value_or(std::move(u)).get();
247
+ }
248
+
249
+ template <class T, class E>
250
+ template <class U>
251
+ constexpr T expected_ref_wrapper<T, E>::value_or(U&& u) &&
252
+ {
253
+ return base_type::value_or(std::move(u)).get();
254
+ }
255
+
256
+ template <class T1, class E1, class T2, class E2>
257
+ constexpr bool
258
+ operator==(const expected_ref_wrapper<T1, E1>& x, const expected_ref_wrapper<T2, E2>& y)
259
+ {
260
+ using base_type1 = typename expected_ref_wrapper<T1, E1>::base_type;
261
+ using base_type2 = typename expected_ref_wrapper<T2, E2>::base_type;
262
+ return operator==(static_cast<const base_type1&>(x), static_cast<const base_type2&>(y));
263
+ }
264
+
265
+ template <class T1, class E1, class T2>
266
+ constexpr bool operator==(const expected_ref_wrapper<T1, E1>& x, const T2& y)
267
+ {
268
+ using base_type1 = typename expected_ref_wrapper<T1, E1>::base_type;
269
+ return operator==(static_cast<const base_type1&>(x), y);
270
+ }
271
+
272
+ template <class T1, class E1, class E2>
273
+ constexpr bool operator==(const expected_ref_wrapper<T1, E1>& x, const tl::unexpected<E2>& y)
274
+ {
275
+ using base_type1 = typename expected_ref_wrapper<T1, E1>::base_type;
276
+ return operator==(static_cast<const base_type1&>(x), y);
277
+ }
278
+
279
+ /***********************************
280
+ * helper functions implementation *
281
+ ***********************************/
282
+
283
+ template <class T, class E>
284
+ tl::unexpected<E> forward_error(const tl::expected<T, E>& exp)
285
+ {
286
+ return tl::make_unexpected(exp.error());
287
+ }
288
+
289
+ template <class T, class E>
290
+ tl::unexpected<E> forward_error(const expected_ref_wrapper<T, E>& exp)
291
+ {
292
+ return tl::make_unexpected(exp.error());
293
+ }
294
+
295
+ namespace detail
296
+ {
297
+ template <class T>
298
+ decltype(auto) extract_impl(T&& exp)
299
+ {
300
+ if (exp)
301
+ {
302
+ return std::forward<T>(exp).value();
303
+ }
304
+ else
305
+ {
306
+ throw exp.error();
307
+ }
308
+ }
309
+ }
310
+
311
+ template <class T, class E>
312
+ T& extract(tl::expected<T, E>& exp)
313
+ {
314
+ return detail::extract_impl(exp);
315
+ }
316
+
317
+ template <class T, class E>
318
+ const T& extract(const tl::expected<T, E>& exp)
319
+ {
320
+ return detail::extract_impl(exp);
321
+ }
322
+
323
+ template <class T, class E>
324
+ T&& extract(tl::expected<T, E>&& exp)
325
+ {
326
+ return detail::extract_impl(std::move(exp));
327
+ }
328
+
329
+ template <class T, class E>
330
+ T& extract(expected_ref_wrapper<T, E>& exp)
331
+ {
332
+ return detail::extract_impl(exp);
333
+ }
334
+
335
+ template <class T, class E>
336
+ const T& extract(const expected_ref_wrapper<T, E>& exp)
337
+ {
338
+ return detail::extract_impl(exp);
339
+ }
340
+
341
+ template <class T, class E>
342
+ T&& extract(expected_ref_wrapper<T, E>&& exp)
343
+ {
344
+ return detail::extract_impl(std::move(exp));
345
+ }
346
+
347
+ }
348
+
349
+ #endif
data/miniconda3/include/mamba/core/execution.hpp ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2022, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_EXECUTION_HPP
8
+ #define MAMBA_CORE_EXECUTION_HPP
9
+
10
+ #include <atomic>
11
+ #include <future>
12
+ #include <mutex>
13
+ #include <thread>
14
+ #include <vector>
15
+
16
+ #include "mamba/core/error_handling.hpp"
17
+ #include "mamba/util/synchronized_value.hpp"
18
+
19
+ namespace mamba
20
+ {
21
+ struct MainExecutorError : public mamba_error
22
+ {
23
+ using mamba_error::mamba_error;
24
+ };
25
+
26
+ // Main execution resource (for example threads) handler for this library.
27
+ // Allows scoping the lifetime of threads being used by the library.
28
+ // The user code can either create an instance of this type to determine
29
+ // itself the lifetime of the threads, or it can just use `MainExecutor::instance()`
30
+ // to obtain a global static instance. In this last case, `MainExecutor::instance().close()`
31
+ // have to be called before the end of `main()` to avoid undefined behaviors.
32
+ // WARNING: this is a temporary solution designed to evolve, the current implementation
33
+ // uses threads directly, a future implementation will use a thread-pool or other similar
34
+ // mechanisms.
35
+ class MainExecutor
36
+ {
37
+ public:
38
+
39
+ // Set itself as the main executor.
40
+ // Throws `MainExecutorError` if another instance already exists.
41
+ MainExecutor();
42
+
43
+ // Closes (see `close()`) and unregister itself as the main executor.
44
+ // Blocks until all scheduled tasks are done and all resources are released (threads
45
+ // joined).
46
+ ~MainExecutor();
47
+
48
+ // Returns a reference to the current main executor.
49
+ // If no main executor have been set previously to this call,
50
+ // a global one is created and returned. In this case the user must
51
+ // call `MainExecutor::instance().close()` before the end of `main()` to avoid
52
+ // undefined behaviors.
53
+ static MainExecutor& instance();
54
+
55
+ // If the default (global) main executor is being used, close and destroy it.
56
+ // Do nothing otherwise.
57
+ // This is mostly used for testing and libraries using the default main executor.
58
+ static void stop_default();
59
+
60
+ // Schedules a task for execution.
61
+ // The task must be a callable which takes either the provided arguments or none.
62
+ // If this executor is open, the task is scheduled for execution and will be called
63
+ // as soon as execution resources are available. The call to the task is not guaranteed
64
+ // to have been done at the end of the execution of this function, nor before.
65
+ // If this executor is closed, the task is ignored and no code will be executed nor the task
66
+ // be called.
67
+ template <typename Task, typename... Args>
68
+ void schedule(Task&& task, Args&&... args)
69
+ {
70
+ if (!is_open)
71
+ {
72
+ return;
73
+ }
74
+
75
+ auto synched_threads = threads.synchronize();
76
+ if (is_open) // Double check necessary for correctness
77
+ {
78
+ synched_threads->emplace_back(std::forward<Task>(task), std::forward<Args>(args)...);
79
+ }
80
+ }
81
+
82
+ // Moves ownership of a thread into this executor.
83
+ // This is used in case a thread needs to be manipulated in a particular way,
84
+ // but we still want to avoid having to use `std::thread::detach()`. By
85
+ // transferring the ownership of the thread to this executor, we are guaranteed that
86
+ // the thread will be joined before the end of the lifetime of this executor.
87
+ // If this executor is closed, no code will be executed and the thread will be destroyed,
88
+ // resulting in a call to `std::terminate()` if the thread is not already joined.
89
+ void take_ownership(std::thread thread)
90
+ {
91
+ if (!thread.joinable() || !is_open)
92
+ {
93
+ return;
94
+ }
95
+
96
+ auto synched_threads = threads.synchronize();
97
+ if (is_open) // Double check necessary for correctness
98
+ {
99
+ synched_threads->push_back(std::move(thread));
100
+ }
101
+ }
102
+
103
+ // Closes this executor:
104
+ // Only returns once all tasks scheduled before this call are finished
105
+ // and all owned execution resources (aka threads) are released.
106
+ // Note that if any task never ends, this function will never end either.
107
+ // Once called this function makes all other functions no-op, even before returning, to
108
+ // prevent running tasks from scheduling more tasks to run. This is should be used to
109
+ // manually determine the lifetime of the executor's resources.
110
+ void close()
111
+ {
112
+ bool expected = true;
113
+ if (!is_open.compare_exchange_strong(expected, false))
114
+ {
115
+ return;
116
+ }
117
+
118
+ invoke_close_handlers();
119
+
120
+ auto synched_threads = threads.synchronize();
121
+ for (auto&& t : *synched_threads)
122
+ {
123
+ t.join();
124
+ }
125
+ synched_threads->clear();
126
+ }
127
+
128
+ using on_close_handler = std::function<void()>;
129
+
130
+ void on_close(on_close_handler handler)
131
+ {
132
+ if (!is_open)
133
+ {
134
+ return;
135
+ }
136
+
137
+ auto handlers = close_handlers.synchronize();
138
+ if (is_open) // Double check needed to avoid adding new handles while closing.
139
+ {
140
+ handlers->push_back(std::move(handler));
141
+ }
142
+ }
143
+
144
+ private:
145
+
146
+ std::atomic<bool> is_open{ true };
147
+ using Threads = std::vector<std::thread>;
148
+ using CloseHandlers = std::vector<on_close_handler>;
149
+ util::synchronized_value<Threads, std::recursive_mutex> threads;
150
+ util::synchronized_value<CloseHandlers, std::recursive_mutex> close_handlers;
151
+
152
+ void invoke_close_handlers();
153
+ };
154
+
155
+
156
+ }
157
+
158
+ #endif
data/miniconda3/include/mamba/core/fsutil.hpp ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_FS_UTIL
8
+ #define MAMBA_CORE_FS_UTIL
9
+
10
+ #include <system_error>
11
+
12
+ namespace mamba
13
+ {
14
+ namespace fs
15
+ {
16
+ class u8path;
17
+ }
18
+
19
+ namespace path
20
+ {
21
+ bool starts_with_home(const fs::u8path& p);
22
+
23
+ void create_directories_sudo_safe(const fs::u8path& path);
24
+ bool touch(const fs::u8path& path, bool mkdir = false, bool sudo_safe = false);
25
+
26
+ /**
27
+ * Returns `true` only if the provided path is either:
28
+ * - a file we are able to open for writing;
29
+ * - a directory we are able to create a file in for writing;
30
+ * - a file name that does not exist but the parent directory in the path exists and we
31
+ * are able to create a file with that name in that directory for writing.
32
+ * Returns `false` otherwise.
33
+ */
34
+ bool is_writable(const fs::u8path& path) noexcept;
35
+ }
36
+
37
+ namespace mamba_fs
38
+ {
39
+ /** Like std::rename, but works across file systems by moving the file instead
40
+ * if the rename fails.
41
+ * if both rename and move fail, the error code is set to the error code of the
42
+ * copy_file operation and the `to` file is removed. You will have to handle removal
43
+ * of the `from` file yourself.
44
+ */
45
+ void rename_or_move(const fs::u8path& from, const fs::u8path& to, std::error_code& ec);
46
+
47
+ }
48
+ }
49
+ #endif
data/miniconda3/include/mamba/core/history.hpp ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_HISTORY
8
+ #define MAMBA_CORE_HISTORY
9
+
10
+ #include <string>
11
+ #include <unordered_map>
12
+ #include <vector>
13
+
14
+ #include "mamba/core/channel_context.hpp"
15
+ #include "mamba/core/context_params.hpp"
16
+ #include "mamba/fs/filesystem.hpp"
17
+ #include "mamba/specs/match_spec.hpp"
18
+ #include "mamba/specs/package_info.hpp"
19
+
20
+ namespace mamba
21
+ {
22
+ class History
23
+ {
24
+ public:
25
+
26
+ History(const fs::u8path& prefix, ChannelContext& channel_context);
27
+
28
+ struct ParseResult
29
+ {
30
+ std::string head_line;
31
+ std::vector<std::string> diff;
32
+ std::vector<std::string> comments;
33
+ };
34
+
35
+ struct UserRequest
36
+ {
37
+ static UserRequest prefilled(const CommandParams& command_params);
38
+
39
+ std::string date;
40
+ std::size_t revision_num = 0;
41
+ std::string cmd;
42
+ std::string conda_version;
43
+
44
+ std::vector<std::string> unlink_dists;
45
+ std::vector<std::string> link_dists;
46
+
47
+ std::vector<std::string> update;
48
+ std::vector<std::string> remove;
49
+ std::vector<std::string> neutered;
50
+ };
51
+
52
+ std::vector<ParseResult> parse();
53
+ bool parse_comment_line(const std::string& line, UserRequest& req);
54
+ std::vector<UserRequest> get_user_requests();
55
+ std::unordered_map<std::string, specs::MatchSpec> get_requested_specs_map();
56
+ void add_entry(const History::UserRequest& entry);
57
+
58
+ fs::u8path m_prefix;
59
+ fs::u8path m_history_file_path;
60
+ ChannelContext& m_channel_context;
61
+ };
62
+
63
+ /** PackageDiff contains two maps of packages and their package info, one being for the
64
+ * installed packages, the other for the removed ones. This is used while looping on
65
+ * revisions to get the diff between the target revision and the current one.
66
+ */
67
+ struct PackageDiff
68
+ {
69
+ using package_diff_map = std::unordered_map<std::string, specs::PackageInfo>;
70
+ package_diff_map removed_pkg_diff;
71
+ package_diff_map installed_pkg_diff;
72
+
73
+ [[nodiscard]] static PackageDiff
74
+ from_revision(const std::vector<History::UserRequest>& user_requests, std::size_t target_revision);
75
+ };
76
+
77
+ /** The following function parses the different formats that can be found in the history
78
+ * file.
79
+ *
80
+ * conda/mamba1 format:
81
+ *
82
+ * installed: +conda-forge/linux-64::xtl-0.8.0-h84d6215_0
83
+ * removed: -conda-forge/linux-64::xtl-0.8.0-h84d6215_0
84
+ *
85
+ * mamba2 broken format:
86
+ *
87
+ * installed: +conda-forge::xtl-0.8.0-h84d6215_0
88
+ * removed: -https://conda.anaconda.org/conda-forge/linux-64::xtl-0.8.0-h84d6215_0
89
+ *
90
+ * mamba2 new format:
91
+ * installed: +https://conda.anaconda.org/conda-forge/linux-64::xtl-0.8.0-h84d6215_0
92
+ * removed: -https://conda.anaconda.org/conda-forge/linux-64::xtl-0.8.0-h84d6215_0
93
+ */
94
+ specs::PackageInfo read_history_url_entry(const std::string& s);
95
+ } // namespace mamba
96
+
97
+ #endif
data/miniconda3/include/mamba/core/invoke.hpp ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef MAMBA_INVOKE_HPP
2
+ #define MAMBA_INVOKE_HPP
3
+
4
+ #include <functional>
5
+
6
+ #include "mamba/core/error_handling.hpp"
7
+
8
+ namespace mamba
9
+ {
10
+
11
+ template <typename Func, typename... Args>
12
+ auto safe_invoke(Func&& func, Args&&... args)
13
+ -> tl::expected<decltype(std::invoke(std::forward<Func>(func), std::forward<Args>(args)...)), mamba_error>
14
+ {
15
+ try
16
+ {
17
+ // If the callable is passed by being moved-in (r-value reference/temporary etc.)
18
+ // we make sure that the lifetime of that callable doesnt go beyond this block.
19
+ auto call = [&, callable = std::forward<Func>(func)]
20
+ { return std::invoke(callable, std::forward<Args>(args)...); };
21
+ using Result = decltype(call());
22
+
23
+ if constexpr (std::is_void<Result>::value)
24
+ {
25
+ call();
26
+ return {};
27
+ }
28
+ else
29
+ {
30
+ return call();
31
+ }
32
+ }
33
+ catch (const std::runtime_error& err)
34
+ {
35
+ return make_unexpected(
36
+ std::string("callback invocation failed : ") + err.what(),
37
+ mamba_error_code::unknown
38
+ );
39
+ }
40
+ catch (...)
41
+ {
42
+ return make_unexpected(
43
+ "callback invocation failed : unknown error",
44
+ mamba_error_code::unknown
45
+ );
46
+ }
47
+ }
48
+
49
+ }
50
+
51
+ #endif
data/miniconda3/include/mamba/core/menuinst.hpp ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ namespace mamba
8
+ {
9
+ class TransactionContext;
10
+
11
+ namespace fs
12
+ {
13
+ class u8path;
14
+ }
15
+
16
+ void
17
+ remove_menu_from_json(const fs::u8path& json_file, const TransactionContext& transaction_context);
18
+ void
19
+ create_menu_from_json(const fs::u8path& json_file, const TransactionContext& transaction_context);
20
+ }
data/miniconda3/include/mamba/core/output.hpp ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_OUTPUT_HPP
8
+ #define MAMBA_CORE_OUTPUT_HPP
9
+
10
+ #include <iosfwd>
11
+ #include <sstream>
12
+ #include <string>
13
+ #include <string_view>
14
+ #include <vector>
15
+
16
+ #include <fmt/color.h>
17
+ #include <nlohmann/json.hpp>
18
+
19
+ #include "mamba/core/common_types.hpp"
20
+ #include "mamba/core/progress_bar.hpp"
21
+
22
+ namespace mamba
23
+ {
24
+ class Context;
25
+
26
+ std::string cut_repo_name(std::string_view reponame);
27
+
28
+ namespace printers
29
+ {
30
+ struct FormattedString
31
+ {
32
+ std::string s;
33
+ fmt::text_style style = {};
34
+
35
+ FormattedString() = default;
36
+
37
+ inline FormattedString(const std::string& i)
38
+ : s(i)
39
+ {
40
+ }
41
+
42
+ inline FormattedString(const std::string_view i)
43
+ : s(i)
44
+ {
45
+ }
46
+
47
+ inline FormattedString(const char* i)
48
+ : s(i)
49
+ {
50
+ }
51
+
52
+ inline std::size_t size() const
53
+ {
54
+ return s.size();
55
+ }
56
+ };
57
+
58
+ enum class alignment
59
+ {
60
+ left,
61
+ right,
62
+ };
63
+
64
+ constexpr auto alignmentMarker(alignment a) -> std::string_view
65
+ {
66
+ switch (a)
67
+ {
68
+ case alignment::right:
69
+ return "alignment_right";
70
+ case alignment::left:
71
+ return "alignment_right";
72
+ default:
73
+ assert(false);
74
+ return "";
75
+ }
76
+ }
77
+
78
+ class Table
79
+ {
80
+ public:
81
+
82
+ Table(const std::vector<FormattedString>& header);
83
+
84
+ void set_alignment(const std::vector<alignment>& a);
85
+ void set_padding(const std::vector<int>& p);
86
+ void add_row(const std::vector<FormattedString>& r);
87
+ void
88
+ add_rows(const std::string& header, const std::vector<std::vector<FormattedString>>& rs);
89
+
90
+ std::ostream& print(std::ostream& out);
91
+
92
+ private:
93
+
94
+ std::vector<FormattedString> m_header;
95
+ std::vector<alignment> m_align;
96
+ std::vector<int> m_padding;
97
+ std::vector<std::vector<FormattedString>> m_table;
98
+ };
99
+
100
+ std::ostringstream table_like(const std::vector<std::string>& data, std::size_t max_width);
101
+ } // namespace printers
102
+
103
+ // Todo: replace public inheritance with
104
+ // private one + using directives
105
+ class ConsoleStream : public std::stringstream
106
+ {
107
+ public:
108
+
109
+ ConsoleStream() = default;
110
+ ~ConsoleStream();
111
+ };
112
+
113
+ class ProgressBarManager;
114
+ class ConsoleData;
115
+
116
+ class Console
117
+ {
118
+ public:
119
+
120
+ Console(const Console&) = delete;
121
+ Console& operator=(const Console&) = delete;
122
+
123
+ Console(Console&&) = delete;
124
+ Console& operator=(Console&&) = delete;
125
+
126
+ static Console& instance();
127
+ static bool is_available();
128
+ static ConsoleStream stream();
129
+ static bool prompt(std::string_view message, char fallback = '_');
130
+ static bool prompt(std::string_view message, char fallback, std::istream& input_stream);
131
+
132
+ ProgressProxy add_progress_bar(const std::string& name, size_t expected_total = 0);
133
+ void clear_progress_bars();
134
+ ProgressBarManager& init_progress_bar_manager(ProgressBarMode mode = ProgressBarMode::multi);
135
+ void terminate_progress_bar_manager();
136
+ ProgressBarManager& progress_bar_manager();
137
+
138
+ static std::string hide_secrets(std::string_view str);
139
+
140
+ void print(std::string_view str, bool force_print = false);
141
+ void json_write(const nlohmann::json& j);
142
+ void json_append(const std::string& value);
143
+ void json_append(const nlohmann::json& j);
144
+ void json_down(const std::string& key);
145
+ void json_up();
146
+
147
+ static void print_buffer(std::ostream& ostream);
148
+
149
+ void cancel_json_print();
150
+
151
+ const Context& context() const;
152
+
153
+ Console(const Context& context);
154
+ ~Console();
155
+
156
+ private:
157
+
158
+ void json_print();
159
+ void deactivate_progress_bar(std::size_t idx, std::string_view msg = "");
160
+
161
+ std::unique_ptr<ConsoleData> p_data;
162
+
163
+ friend class ProgressProxy;
164
+
165
+ static void set_singleton(Console& console);
166
+ static void clear_singleton();
167
+ };
168
+
169
+ class MessageLogger
170
+ {
171
+ public:
172
+
173
+ MessageLogger(log_level level);
174
+ ~MessageLogger();
175
+
176
+ std::stringstream& stream();
177
+
178
+ static void activate_buffer();
179
+ static void deactivate_buffer();
180
+ static void print_buffer(std::ostream& ostream);
181
+
182
+ private:
183
+
184
+ log_level m_level;
185
+ std::stringstream m_stream;
186
+
187
+ static void emit(const std::string& msg, const log_level& level);
188
+ };
189
+
190
+ } // namespace mamba
191
+
192
+ #undef LOG
193
+ #undef LOG_TRACE
194
+ #undef LOG_DEBUG
195
+ #undef LOG_INFO
196
+ #undef LOG_WARNING
197
+ #undef LOG_ERROR
198
+ #undef LOG_CRITICAL
199
+
200
+ #define LOG(severity) mamba::MessageLogger(severity).stream()
201
+ #define LOG_TRACE LOG(mamba::log_level::trace)
202
+ #define LOG_DEBUG LOG(mamba::log_level::debug)
203
+ #define LOG_INFO LOG(mamba::log_level::info)
204
+ #define LOG_WARNING LOG(mamba::log_level::warn)
205
+ #define LOG_ERROR LOG(mamba::log_level::err)
206
+ #define LOG_CRITICAL LOG(mamba::log_level::critical)
207
+
208
+ #endif // MAMBA_CORE_OUTPUT_HPP
data/miniconda3/include/mamba/core/package_cache.hpp ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_PACKAGE_CACHE
8
+ #define MAMBA_CORE_PACKAGE_CACHE
9
+
10
+ #include <map>
11
+ #include <string>
12
+ #include <vector>
13
+
14
+ #include "mamba/core/fsutil.hpp"
15
+ #include "mamba/fs/filesystem.hpp"
16
+ #include "mamba/specs/package_info.hpp"
17
+
18
+ #define PACKAGE_CACHE_MAGIC_FILE "urls.txt"
19
+
20
+ namespace mamba
21
+ {
22
+ struct ValidationParams;
23
+
24
+ enum class Writable
25
+ {
26
+ UNKNOWN,
27
+ WRITABLE,
28
+ NOT_WRITABLE,
29
+ DIR_DOES_NOT_EXIST
30
+ };
31
+
32
+ // TODO layered package caches
33
+ class PackageCacheData
34
+ {
35
+ public:
36
+
37
+ explicit PackageCacheData(const fs::u8path& path);
38
+
39
+ bool create_directory();
40
+ void set_writable(Writable writable);
41
+ Writable is_writable();
42
+ fs::u8path path() const;
43
+ void clear_query_cache(const specs::PackageInfo& s);
44
+
45
+ bool has_valid_tarball(const specs::PackageInfo& s, const ValidationParams& params);
46
+ bool has_valid_extracted_dir(const specs::PackageInfo& s, const ValidationParams& params);
47
+
48
+ private:
49
+
50
+ void check_writable();
51
+
52
+ std::map<std::string, bool> m_valid_tarballs;
53
+ std::map<std::string, bool> m_valid_extracted_dir;
54
+ Writable m_writable = Writable::UNKNOWN;
55
+ fs::u8path m_path;
56
+ };
57
+
58
+ class MultiPackageCache
59
+ {
60
+ public:
61
+
62
+ MultiPackageCache(const std::vector<fs::u8path>& pkgs_dirs, const ValidationParams& params);
63
+
64
+ std::vector<fs::u8path> paths() const;
65
+
66
+ fs::u8path get_tarball_path(const specs::PackageInfo& s, bool return_empty = true);
67
+ fs::u8path get_extracted_dir_path(const specs::PackageInfo& s, bool return_empty = true);
68
+
69
+ fs::u8path first_writable_path();
70
+ PackageCacheData& first_writable_cache(bool create = false);
71
+ std::vector<PackageCacheData*> writable_caches();
72
+
73
+ void clear_query_cache(const specs::PackageInfo& s);
74
+
75
+ private:
76
+
77
+ std::vector<PackageCacheData> m_caches;
78
+ std::map<std::string, fs::u8path> m_cached_tarballs;
79
+ std::map<std::string, fs::u8path> m_cached_extracted_dirs;
80
+ const ValidationParams& m_params;
81
+ };
82
+ } // namespace mamba
83
+
84
+ #endif
data/miniconda3/include/mamba/core/package_database_loader.hpp ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_PACKAGE_DATABASE_LOADER_HPP
8
+ #define MAMBA_CORE_PACKAGE_DATABASE_LOADER_HPP
9
+
10
+ #include "mamba/core/error_handling.hpp"
11
+ #include "mamba/solver/libsolv/repo_info.hpp"
12
+ #include "mamba/specs/channel.hpp"
13
+
14
+ namespace mamba
15
+ {
16
+ class Context;
17
+ class PrefixData;
18
+ class SubdirIndexLoader;
19
+
20
+ namespace solver::libsolv
21
+ {
22
+ class Database;
23
+ }
24
+
25
+ void add_spdlog_logger_to_database(solver::libsolv::Database& database);
26
+
27
+ auto load_subdir_in_database( //
28
+ const Context& ctx,
29
+ solver::libsolv::Database& database,
30
+ const SubdirIndexLoader& subdir
31
+ ) -> expected_t<solver::libsolv::RepoInfo>;
32
+
33
+ auto load_installed_packages_in_database(
34
+ const Context& ctx,
35
+ solver::libsolv::Database& database,
36
+ const PrefixData& prefix
37
+ ) -> solver::libsolv::RepoInfo;
38
+ }
39
+ #endif
data/miniconda3/include/mamba/core/package_fetcher.hpp ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2023, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_PACKAGE_FETCHER_HPP
8
+ #define MAMBA_CORE_PACKAGE_FETCHER_HPP
9
+
10
+ #include <functional>
11
+
12
+ #include "mamba/core/package_cache.hpp"
13
+ #include "mamba/core/package_handling.hpp"
14
+ #include "mamba/core/thread_utils.hpp"
15
+ #include "mamba/download/downloader.hpp"
16
+ #include "mamba/specs/package_info.hpp"
17
+
18
+ namespace mamba
19
+ {
20
+
21
+ class PackageFetcher;
22
+
23
+ enum class PackageExtractEvent
24
+ {
25
+ validate_update,
26
+ validate_success,
27
+ validate_failure,
28
+ extract_update,
29
+ extract_success,
30
+ extract_failure
31
+ };
32
+
33
+ class PackageExtractTask
34
+ {
35
+ public:
36
+
37
+ struct Result
38
+ {
39
+ bool valid;
40
+ bool extracted;
41
+ };
42
+
43
+ using progress_callback_t = std::function<void(PackageExtractEvent)>;
44
+
45
+ PackageExtractTask(PackageFetcher* fetcher, ExtractOptions options);
46
+
47
+ const std::string& name() const;
48
+ bool needs_download() const;
49
+
50
+ void set_progress_callback(progress_callback_t cb);
51
+
52
+ Result run();
53
+ Result run(std::size_t downloaded_size);
54
+
55
+ private:
56
+
57
+ progress_callback_t* get_progress_callback();
58
+
59
+ PackageFetcher* p_fetcher;
60
+ ExtractOptions m_options;
61
+ std::optional<progress_callback_t> m_progress_callback = std::nullopt;
62
+ };
63
+
64
+ class PackageFetcher
65
+ {
66
+ public:
67
+
68
+ enum class ValidationResult
69
+ {
70
+ UNDEFINED = 0,
71
+ VALID = 1,
72
+ SHA256_ERROR,
73
+ MD5SUM_ERROR,
74
+ SIZE_ERROR,
75
+ EXTRACT_ERROR
76
+ };
77
+
78
+ using post_download_success_t = std::function<void(std::size_t)>;
79
+ using progress_callback_t = std::function<void(PackageExtractEvent)>;
80
+
81
+ PackageFetcher(const specs::PackageInfo& pkg_info, MultiPackageCache& caches);
82
+
83
+ const std::string& name() const;
84
+
85
+ bool needs_download() const;
86
+ bool needs_extract() const;
87
+
88
+ download::Request
89
+ build_download_request(std::optional<post_download_success_t> callback = std::nullopt);
90
+ ValidationResult
91
+ validate(std::size_t downloaded_size, progress_callback_t* cb = nullptr) const;
92
+ bool extract(const ExtractOptions& options, progress_callback_t* cb = nullptr);
93
+
94
+ // The PackageFetcher object should be stable in memory (i.e. not moved) after this
95
+ // method has been called, until the PackageExtractTask has been completed.
96
+ PackageExtractTask build_extract_task(ExtractOptions options);
97
+
98
+ void clear_cache() const;
99
+
100
+ private:
101
+
102
+ struct CheckSumParams;
103
+
104
+ bool use_oci() const;
105
+ bool use_auth() const;
106
+ const std::string& filename() const;
107
+ std::string channel() const;
108
+ std::string url_path() const;
109
+ const std::string& url() const;
110
+ const std::string& sha256() const;
111
+ const std::string& md5() const;
112
+ std::size_t expected_size() const;
113
+
114
+ ValidationResult validate_size(std::size_t downloaded_size) const;
115
+ ValidationResult validate_checksum(const CheckSumParams& params) const;
116
+
117
+ void write_repodata_record(const fs::u8path& base_path) const;
118
+ void update_urls_txt() const;
119
+
120
+ void update_monitor(progress_callback_t* cb, PackageExtractEvent event) const;
121
+
122
+ specs::PackageInfo m_package_info;
123
+
124
+ fs::u8path m_tarball_path;
125
+ fs::u8path m_cache_path;
126
+
127
+ bool m_needs_download = false;
128
+ std::string m_downloaded_url = {};
129
+ bool m_needs_extract = false;
130
+ };
131
+
132
+ class PackageFetcherSemaphore
133
+ {
134
+ public:
135
+
136
+ static std::ptrdiff_t get_max();
137
+ static void set_max(int value);
138
+
139
+ private:
140
+
141
+ static counting_semaphore semaphore;
142
+
143
+ friend class PackageFetcher;
144
+ };
145
+ }
146
+
147
+ #endif
data/miniconda3/include/mamba/core/package_handling.hpp ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_PACKAGE_HANDLING_HPP
8
+ #define MAMBA_CORE_PACKAGE_HANDLING_HPP
9
+
10
+ #include <string>
11
+ #include <system_error>
12
+ #include <vector>
13
+
14
+ #include "mamba/fs/filesystem.hpp"
15
+
16
+ namespace mamba
17
+ {
18
+ struct ValidationParams;
19
+ class Context;
20
+
21
+ // Determine the kind of command line to run to extract subprocesses.
22
+ enum class extract_subproc_mode
23
+ {
24
+ /** An external binary packaged with `libmamba` to launch as a subprocess. */
25
+ mamba_package,
26
+ /** The mamba or micromamba executable calling itself. */
27
+ mamba_exe,
28
+ };
29
+
30
+ struct ExtractOptions
31
+ {
32
+ bool sparse = false;
33
+ extract_subproc_mode subproc_mode;
34
+ static ExtractOptions from_context(const Context&);
35
+ };
36
+
37
+ enum compression_algorithm
38
+ {
39
+ none,
40
+ bzip2,
41
+ zip,
42
+ zstd
43
+ };
44
+
45
+ void create_archive(
46
+ const fs::u8path& directory,
47
+ const fs::u8path& destination,
48
+ compression_algorithm,
49
+ int compression_level,
50
+ int compression_threads,
51
+ bool (*filter)(const fs::u8path&)
52
+ );
53
+ void create_package(
54
+ const fs::u8path& directory,
55
+ const fs::u8path& out_file,
56
+ int compression_threads,
57
+ int compression_level
58
+ );
59
+
60
+ void
61
+ extract_archive(const fs::u8path& file, const fs::u8path& destination, const ExtractOptions& options);
62
+ void extract_conda(
63
+ const fs::u8path& file,
64
+ const fs::u8path& dest_dir,
65
+ const ExtractOptions& options,
66
+ const std::vector<std::string>& parts = { "info", "pkg" }
67
+ );
68
+ void
69
+ extract(const fs::u8path& file, const fs::u8path& destination, const ExtractOptions& options);
70
+ fs::u8path extract(const fs::u8path& file, const ExtractOptions& options);
71
+
72
+
73
+ void
74
+ extract_subproc(const fs::u8path& file, const fs::u8path& dest, const ExtractOptions& options);
75
+
76
+ bool transmute(
77
+ const fs::u8path& pkg_file,
78
+ const fs::u8path& target,
79
+ int compression_level,
80
+ int compression_threads,
81
+ const ExtractOptions& options
82
+ );
83
+
84
+ bool validate(const fs::u8path& pkg_folder, const ValidationParams& params);
85
+
86
+ } // namespace mamba
87
+
88
+ #endif // MAMBA_PACKAGE_HANDLING_HPP
data/miniconda3/include/mamba/core/package_paths.hpp ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_READ_PATHS_HPP
8
+ #define MAMBA_CORE_READ_PATHS_HPP
9
+
10
+ #include <map>
11
+ #include <set>
12
+ #include <string>
13
+ #include <vector>
14
+
15
+ #include "util.hpp"
16
+
17
+ const char PREFIX_PLACEHOLDER_1[] = "/opt/anaconda1anaconda2";
18
+ // this is intentionally split into parts, such that running
19
+ // this program on itself will leave it unchanged
20
+ const char PREFIX_PLACEHOLDER_2[] = "anaconda3";
21
+
22
+ namespace mamba
23
+ {
24
+ struct PrefixFileParse
25
+ {
26
+ std::string placeholder;
27
+ std::string file_mode;
28
+ std::string file_path;
29
+ };
30
+
31
+ enum class PathType
32
+ {
33
+ UNDEFINED,
34
+ HARDLINK,
35
+ SOFTLINK,
36
+ DIRECTORY,
37
+
38
+ // These should not occur in a package, only after installation
39
+ LINKED_PACKAGE_RECORD,
40
+ PYC_FILE,
41
+ UNIX_PYTHON_ENTRY_POINT,
42
+ WINDOWS_PYTHON_ENTRY_POINT_SCRIPT,
43
+ WINDOWS_PYTHON_ENTRY_POINT_EXE
44
+ };
45
+
46
+ enum class FileMode
47
+ {
48
+ UNDEFINED,
49
+ BINARY,
50
+ TEXT
51
+ };
52
+
53
+ struct PathData
54
+ {
55
+ std::string path;
56
+ PathType path_type = PathType::UNDEFINED;
57
+ std::string sha256;
58
+ std::size_t size_in_bytes = 0;
59
+
60
+ std::string prefix_placeholder;
61
+ FileMode file_mode = FileMode::TEXT;
62
+ bool no_link = false;
63
+ };
64
+
65
+ std::map<std::string, PrefixFileParse> read_has_prefix(const fs::u8path& path);
66
+ std::set<std::string> read_no_link(const fs::u8path& info_dir);
67
+ std::vector<PathData> read_paths(const fs::u8path& directory);
68
+ } // namespace mamba
69
+
70
+ #endif
data/miniconda3/include/mamba/core/palette.hpp ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2022, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_PALETTE_HPP
8
+ #define MAMBA_CORE_PALETTE_HPP
9
+
10
+ #include <fmt/color.h>
11
+
12
+ namespace mamba
13
+ {
14
+ struct Palette
15
+ {
16
+ /** Something that is possible or exists. */
17
+ fmt::text_style success;
18
+ /** Something that is impossible or does not exist. */
19
+ fmt::text_style failure;
20
+ /** Refers to external ecosystem. */
21
+ fmt::text_style external;
22
+ /** Information that was already shown (for. */
23
+ fmt::text_style shown;
24
+ /** Some action is safe or trusted. */
25
+ fmt::text_style safe;
26
+ /** Some action is unsafe or not trusted. */
27
+ fmt::text_style unsafe;
28
+
29
+ /** Reference to some input from the user. */
30
+ fmt::text_style user;
31
+ /** Input from the user was ignored or has no effect. */
32
+ fmt::text_style ignored;
33
+ /** Something was added due to user input. */
34
+ fmt::text_style addition;
35
+ /** Something was removed due to user input. */
36
+ fmt::text_style deletion;
37
+
38
+ /** The color of an empty progress bar. */
39
+ fmt::text_style progress_bar_none;
40
+ /** The color of the downloaded items in the progress bar. */
41
+ fmt::text_style progress_bar_downloaded;
42
+ /** The color of the extracted items in the progress bar. */
43
+ fmt::text_style progress_bar_extracted;
44
+
45
+ /** A Palette with no colors at all. */
46
+ static constexpr auto no_color() -> Palette;
47
+ /** A Palette with terminal 4 bit colors. */
48
+ static constexpr auto terminal() -> Palette;
49
+ };
50
+
51
+ /*******************************
52
+ * Implementation of Palette *
53
+ *******************************/
54
+
55
+ inline constexpr auto Palette::no_color() -> Palette
56
+ {
57
+ return {};
58
+ }
59
+
60
+ inline constexpr auto Palette::terminal() -> Palette
61
+ {
62
+ return {
63
+ /* .success= */ fmt::fg(fmt::terminal_color::green),
64
+ /* .failure= */ fmt::fg(fmt::terminal_color::red),
65
+ /* .external= */ fmt::fg(fmt::terminal_color::cyan),
66
+ /* .shown= */ fmt::fg(fmt::terminal_color::bright_black),
67
+ /* .safe= */ fmt::fg(fmt::terminal_color::green),
68
+ /* .unsafe= */ fmt::fg(fmt::terminal_color::red),
69
+ /* .user= */ fmt::fg(fmt::terminal_color::blue) | fmt::emphasis::bold,
70
+ /* .ignored= */ fmt::fg(fmt::terminal_color::yellow),
71
+ /* .addition= */ fmt::fg(fmt::terminal_color::green),
72
+ /* .deletion= */ fmt::fg(fmt::terminal_color::red),
73
+ /* .progress_bar_none= */ fmt::fg(fmt::terminal_color::bright_black),
74
+ /* .progress_bar_downloaded= */ fmt::fg(fmt::terminal_color::yellow),
75
+ /* .progress_bar_extracted= */ {},
76
+ };
77
+ }
78
+
79
+ }
80
+ #endif
data/miniconda3/include/mamba/core/pinning.hpp ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_PINNING_HPP
8
+ #define MAMBA_CORE_PINNING_HPP
9
+
10
+ #include <string>
11
+ #include <vector>
12
+
13
+ namespace mamba
14
+ {
15
+ class Context;
16
+ class ChannelContext;
17
+ class PrefixData;
18
+
19
+ namespace fs
20
+ {
21
+ class u8path;
22
+ }
23
+
24
+ std::string python_pin(PrefixData& prefix_data, const std::vector<std::string>& specs);
25
+
26
+ std::vector<std::string> file_pins(const fs::u8path& file);
27
+ }
28
+
29
+ #endif
data/miniconda3/include/mamba/core/prefix_data.hpp ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_PREFIX_DATA_HPP
8
+ #define MAMBA_CORE_PREFIX_DATA_HPP
9
+
10
+ #include <map>
11
+ #include <string>
12
+
13
+ #include "mamba/core/error_handling.hpp"
14
+ #include "mamba/core/history.hpp"
15
+ #include "mamba/specs/package_info.hpp"
16
+
17
+ namespace mamba
18
+ {
19
+ class ChannelContext;
20
+
21
+ class PrefixData
22
+ {
23
+ public:
24
+
25
+ using package_map = std::map<std::string, specs::PackageInfo>;
26
+
27
+ static expected_t<PrefixData>
28
+ create(const fs::u8path& prefix_path, ChannelContext& channel_context, bool no_pip = false);
29
+
30
+ void add_packages(const std::vector<specs::PackageInfo>& packages);
31
+ void load_single_record(const fs::u8path& path);
32
+
33
+ const package_map& records() const;
34
+ const package_map& pip_records() const;
35
+ package_map all_pkg_mgr_records() const;
36
+
37
+ History& history();
38
+ const fs::u8path& path() const;
39
+ std::vector<specs::PackageInfo> sorted_records() const;
40
+
41
+ ChannelContext& channel_context() const
42
+ {
43
+ return m_channel_context;
44
+ }
45
+
46
+ private:
47
+
48
+ PrefixData(const fs::u8path& prefix_path, ChannelContext& channel_context, bool no_pip);
49
+
50
+ void load_site_packages();
51
+
52
+ History m_history;
53
+ package_map m_package_records;
54
+ package_map m_pip_package_records;
55
+ fs::u8path m_prefix_path;
56
+
57
+ ChannelContext& m_channel_context;
58
+ };
59
+ } // namespace mamba
60
+
61
+ #endif
data/miniconda3/include/mamba/core/progress_bar.hpp ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_PROGRESS_BAR_HPP
8
+ #define MAMBA_CORE_PROGRESS_BAR_HPP
9
+
10
+ #include <chrono>
11
+ #include <cstddef>
12
+ #include <functional>
13
+ #include <string>
14
+
15
+ namespace mamba
16
+ {
17
+ class ProgressBar;
18
+ struct ProgressBarOptions;
19
+ // TODO: find a way to define it here without
20
+ // impoorting spdlog and modst of the STL.
21
+ class ProgressBarRepr;
22
+
23
+ enum ProgressBarMode
24
+ {
25
+ multi,
26
+ aggregated
27
+ };
28
+
29
+ class ProgressProxy
30
+ {
31
+ public:
32
+
33
+ ProgressProxy() = default;
34
+ ProgressProxy(ProgressBar* ptr);
35
+ ~ProgressProxy() = default;
36
+
37
+ ProgressProxy(const ProgressProxy&) = default;
38
+ ProgressProxy& operator=(const ProgressProxy&) = default;
39
+ ProgressProxy(ProgressProxy&&) = default;
40
+ ProgressProxy& operator=(ProgressProxy&&) = default;
41
+
42
+ bool defined() const;
43
+ operator bool() const;
44
+ ProgressProxy& set_bar(ProgressBar* ptr);
45
+
46
+ ProgressProxy& set_progress(std::size_t current, std::size_t total);
47
+ ProgressProxy& update_progress(std::size_t current, std::size_t total);
48
+ ProgressProxy& set_progress(double progress);
49
+ ProgressProxy& set_current(std::size_t current);
50
+ ProgressProxy& set_in_progress(std::size_t in_progress);
51
+ ProgressProxy& update_current(std::size_t current);
52
+ ProgressProxy& set_total(std::size_t total);
53
+ ProgressProxy& set_speed(std::size_t speed);
54
+ ProgressProxy& set_full();
55
+ ProgressProxy& activate_spinner();
56
+ ProgressProxy& deactivate_spinner();
57
+
58
+ std::size_t current() const;
59
+ std::size_t in_progress() const;
60
+ std::size_t total() const;
61
+ std::size_t speed() const;
62
+ std::size_t
63
+ avg_speed(const std::chrono::milliseconds& ref_duration = std::chrono::milliseconds::max());
64
+ double progress() const;
65
+ bool completed() const;
66
+
67
+ ProgressProxy& set_prefix(const std::string& text);
68
+ ProgressProxy& set_postfix(const std::string& text);
69
+ ProgressProxy& set_repr_hook(std::function<void(ProgressBarRepr&)> f);
70
+ ProgressProxy& set_progress_hook(std::function<void(ProgressProxy&)> f);
71
+ ProgressProxy&
72
+ mark_as_completed(const std::chrono::milliseconds& delay = std::chrono::milliseconds::zero());
73
+
74
+ std::string elapsed_time_to_str() const;
75
+ std::string prefix() const;
76
+
77
+ ProgressBarRepr& update_repr(bool compute_progress = true);
78
+ const ProgressBarRepr& repr() const;
79
+ ProgressBarRepr& repr();
80
+ ProgressProxy& print(std::ostream& stream, std::size_t width = 0, bool with_endl = true);
81
+
82
+ ProgressProxy& start();
83
+ ProgressProxy& pause();
84
+ ProgressProxy& resume();
85
+ ProgressProxy& stop();
86
+
87
+ bool started() const;
88
+
89
+ int width() const;
90
+ const ProgressBarOptions& options() const;
91
+
92
+ private:
93
+
94
+ ProgressBar* p_bar = nullptr;
95
+
96
+ friend class ProgressBarManager;
97
+ };
98
+ }
99
+
100
+ #endif
data/miniconda3/include/mamba/core/query.hpp ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2019, QuantStack and Mamba Contributors
2
+ //
3
+ // Distributed under the terms of the BSD 3-Clause License.
4
+ //
5
+ // The full license is in the file LICENSE, distributed with this software.
6
+
7
+ #ifndef MAMBA_CORE_QUERY_HPP
8
+ #define MAMBA_CORE_QUERY_HPP
9
+
10
+ #include <iosfwd>
11
+ #include <map>
12
+ #include <string>
13
+ #include <string_view>
14
+ #include <vector>
15
+
16
+ #include "mamba/core/context.hpp"
17
+ #include "mamba/specs/package_info.hpp"
18
+ #include "mamba/util/graph.hpp"
19
+
20
+ namespace mamba
21
+ {
22
+ namespace solver::libsolv
23
+ {
24
+ class Database;
25
+ }
26
+
27
+ enum class QueryType
28
+ {
29
+ Search,
30
+ Depends,
31
+ WhoNeeds
32
+ };
33
+
34
+ constexpr auto enum_name(QueryType t) -> std::string_view;
35
+
36
+ auto query_type_parse(std::string_view name) -> QueryType;
37
+
38
+ class QueryResult
39
+ {
40
+ public:
41
+
42
+ using GraphicsParams = Context::GraphicsParams;
43
+ using dependency_graph = util::DiGraph<specs::PackageInfo>;
44
+
45
+ QueryResult(QueryType type, std::string query, dependency_graph dep_graph);
46
+ QueryResult(const QueryResult&) = default;
47
+ QueryResult(QueryResult&&) = default;
48
+
49
+ ~QueryResult() = default;
50
+
51
+ auto operator=(const QueryResult&) -> QueryResult& = default;
52
+ auto operator=(QueryResult&&) -> QueryResult& = default;
53
+
54
+ [[nodiscard]] auto type() const -> QueryType;
55
+ [[nodiscard]] auto query() const -> const std::string&;
56
+ [[nodiscard]] auto empty() const -> bool;
57
+
58
+ auto sort(std::string_view field) -> QueryResult&;
59
+
60
+ auto groupby(std::string_view field) -> QueryResult&;
61
+
62
+ auto reset() -> QueryResult&;
63
+
64
+ auto table(std::ostream&) const -> std::ostream&;
65
+ auto table(std::ostream&, const std::vector<std::string_view>& fmt) const -> std::ostream&;
66
+ [[nodiscard]] auto table_to_str() const -> std::string;
67
+
68
+ auto tree(std::ostream&, const GraphicsParams& graphics) const -> std::ostream&;
69
+ [[nodiscard]] auto tree_to_str(const GraphicsParams& graphics) const -> std::string;
70
+
71
+ [[nodiscard]] auto json() const -> nlohmann::json;
72
+
73
+ auto pretty(std::ostream&, bool show_all_builds) const -> std::ostream&;
74
+ [[nodiscard]] auto pretty_to_str(bool show_all_builds) const -> std::string;
75
+
76
+ private:
77
+
78
+ using node_id = dependency_graph::node_id;
79
+ using package_id_list = std::vector<node_id>;
80
+ using ordered_package_list = std::map<std::string, package_id_list>;
81
+
82
+ void reset_pkg_view_list();
83
+
84
+ QueryType m_type;
85
+ std::string m_query;
86
+ dependency_graph m_dep_graph;
87
+ package_id_list m_pkg_id_list = {};
88
+ ordered_package_list m_ordered_pkg_id_list = {};
89
+ };
90
+
91
+ class Query
92
+ {
93
+ public:
94
+
95
+ using Database = solver::libsolv::Database;
96
+
97
+ [[nodiscard]] static auto find(Database& database, const std::vector<std::string>& queries)
98
+ -> QueryResult;
99
+
100
+ [[nodiscard]] static auto whoneeds(Database& database, std::string query, bool tree)
101
+ -> QueryResult;
102
+
103
+ [[nodiscard]] static auto depends(Database& database, std::string query, bool tree)
104
+ -> QueryResult;
105
+ };
106
+
107
+ /********************
108
+ * Implementation *
109
+ ********************/
110
+
111
+ constexpr auto enum_name(QueryType t) -> std::string_view
112
+ {
113
+ switch (t)
114
+ {
115
+ case QueryType::Search:
116
+ return "Search";
117
+ case QueryType::WhoNeeds:
118
+ return "WhoNeeds";
119
+ case QueryType::Depends:
120
+ return "Depends";
121
+ }
122
+ throw std::invalid_argument("Invalid enum value");
123
+ }
124
+ }
125
+ #endif