@@ -150,20 +150,28 @@ module json_file_module
150
150
! date: 07/23/2015
151
151
!
152
152
! Structure constructor to initialize a [[json_file(type)]] object
153
- ! with an existing [[json_value]] object
153
+ ! with an existing [[json_value]] object, and either the [[json_core]]
154
+ ! settings or a [[json_core]] instance.
154
155
!
155
156
! # Example
156
157
!
157
158
! ```fortran
158
159
! ...
159
160
! type(json_file) :: my_file
160
- ! type(json_value) :: json_object
161
+ ! type(json_value),pointer :: json_object
162
+ ! type(json_core) :: json_core_object
161
163
! ...
162
- ! ! Construct a json_object
163
- ! my_file = json_file(json_object)
164
+ ! ! Construct a json_object:
165
+ ! !could do this:
166
+ ! my_file = json_file(json_object)
167
+ ! !or:
168
+ ! my_file = json_file(json_object,verbose=.true.)
169
+ ! !or:
170
+ ! my_file = json_file(json_object,json_core_object)
164
171
! ```
165
172
interface json_file
166
- module procedure initialize_json_file
173
+ module procedure :: initialize_json_file
174
+ module procedure :: initialize_json_file_v2
167
175
end interface
168
176
! *************************************************************************************
169
177
@@ -240,6 +248,10 @@ end subroutine json_file_print_error_message
240
248
! This is just a wrapper for [[json_initialize]].
241
249
!
242
250
! @note: This does not destroy the data in the file.
251
+ !
252
+ ! @note [[initialize_json_core]], [[json_initialize]],
253
+ ! [[initialize_json_core_in_file]], and [[initialize_json_file]]
254
+ ! all have a similar interface.
243
255
244
256
subroutine initialize_json_core_in_file (me ,verbose ,compact_reals ,&
245
257
print_signs ,real_format ,spaces_per_tab ,&
@@ -270,6 +282,10 @@ end subroutine initialize_json_core_in_file
270
282
!
271
283
! Cast a [[json_value]] object as a [[json_file(type)]] object.
272
284
! It also calls the `initialize()` method.
285
+ !
286
+ ! @note [[initialize_json_core]], [[json_initialize]],
287
+ ! [[initialize_json_core_in_file]], and [[initialize_json_file]]
288
+ ! all have a similar interface.
273
289
274
290
function initialize_json_file (p ,verbose ,compact_reals ,&
275
291
print_signs ,real_format ,spaces_per_tab ,&
@@ -298,6 +314,32 @@ function initialize_json_file(p,verbose,compact_reals,&
298
314
end function initialize_json_file
299
315
! *****************************************************************************************
300
316
317
+ ! *****************************************************************************************
318
+ ! > author: Jacob Williams
319
+ ! date: 4/26/2016
320
+ !
321
+ ! Cast a [[json_value]] pointer and a [[json_core]] object
322
+ ! as a [[json_file(type)]] object.
323
+ !
324
+ ! @note [[initialize_json_core]], [[json_initialize]],
325
+ ! [[initialize_json_core_in_file]], and [[initialize_json_file]]
326
+ ! all have a similar interface.
327
+
328
+ function initialize_json_file_v2 (json_value_object , json_core_object ) &
329
+ result(file_object)
330
+
331
+ implicit none
332
+
333
+ type (json_file) :: file_object
334
+ type (json_value),pointer ,intent (in ) :: json_value_object
335
+ type (json_core),intent (in ) :: json_core_object
336
+
337
+ file_object% p = > json_value_object
338
+ file_object% json = json_core_object
339
+
340
+ end function initialize_json_file_v2
341
+ ! *****************************************************************************************
342
+
301
343
! *****************************************************************************************
302
344
! > author: Jacob Williams
303
345
! date: 12/9/2013
0 commit comments