@@ -30,7 +30,7 @@ module json_file_module
30
30
! The `json_file` is the main public class that is
31
31
! used to open a file and get data from it.
32
32
!
33
- ! A `json_file` contains only two items: an instance of a [[json_core]],
33
+ ! A `json_file` contains only two items: an instance of a [[json_core(type) ]],
34
34
! which use used for all data manipulation, and a [[json_value]],
35
35
! which is used to construct the linked-list data structure.
36
36
! Note that most methods in the `json_file` class are simply wrappers
@@ -61,7 +61,7 @@ module json_file_module
61
61
62
62
private
63
63
64
- type (json_core) :: core ! ! The instance of the [[json_core]] factory used for this file.
64
+ type (json_core) :: core ! ! The instance of the [[json_core(type) ]] factory used for this file.
65
65
type (json_value),pointer :: p = > null () ! ! the JSON structure read from the file
66
66
67
67
contains
@@ -165,8 +165,8 @@ module json_file_module
165
165
! date: 07/23/2015
166
166
!
167
167
! Structure constructor to initialize a [[json_file(type)]] object
168
- ! with an existing [[json_value]] object, and either the [[json_core]]
169
- ! settings or a [[json_core]] instance.
168
+ ! with an existing [[json_value]] object, and either the [[json_core(type) ]]
169
+ ! settings or a [[json_core(type) ]] instance.
170
170
!
171
171
! # Example
172
172
!
@@ -258,7 +258,7 @@ end subroutine json_file_print_error_message
258
258
259
259
! *****************************************************************************************
260
260
! >
261
- ! Initialize the [[json_core]] for this [[json_file]].
261
+ ! Initialize the [[json_core(type) ]] for this [[json_file]].
262
262
! This is just a wrapper for [[json_initialize]].
263
263
!
264
264
! @note: This does not destroy the data in the file.
@@ -274,35 +274,13 @@ subroutine initialize_json_core_in_file(me,verbose,compact_reals,&
274
274
case_sensitive_keys ,&
275
275
no_whitespace ,&
276
276
unescape_strings ,&
277
- comment_char )
277
+ comment_char ,&
278
+ use_rfc6901_paths )
278
279
279
280
implicit none
280
281
281
282
class(json_file),intent (inout ) :: me
282
- logical (LK),intent (in ),optional :: verbose ! ! mainly useful for debugging (default is false)
283
- logical (LK),intent (in ),optional :: compact_reals ! ! to compact the real number strings for output (default is true)
284
- logical (LK),intent (in ),optional :: print_signs ! ! always print numeric sign (default is false)
285
- character (kind= CDK,len=* ),intent (in ),optional :: real_format ! ! Real number format: 'E' [default], '*', 'G', 'EN', or 'ES'
286
- integer (IK),intent (in ),optional :: spaces_per_tab ! ! number of spaces per tab for indenting (default is 2)
287
- logical (LK),intent (in ),optional :: strict_type_checking ! ! if true, no integer, double, or logical type
288
- ! ! conversions are done for the `get` routines
289
- ! ! (default is false)
290
- logical (LK),intent (in ),optional :: trailing_spaces_significant ! ! for name and path comparisons, is trailing
291
- ! ! space to be considered significant.
292
- ! ! (default is false)
293
- logical (LK),intent (in ),optional :: case_sensitive_keys ! ! for name and path comparisons, are they
294
- ! ! case sensitive. (default is true)
295
- logical (LK),intent (in ),optional :: no_whitespace ! ! if true, printing the JSON structure is
296
- ! ! done without adding any non-significant
297
- ! ! spaces or linebreaks (default is false)
298
- logical (LK),intent (in ),optional :: unescape_strings ! ! If false, then the raw escaped
299
- ! ! string is returned from [[json_get_string]]
300
- ! ! and similar routines. If true [default],
301
- ! ! then the string is returned unescaped.
302
- character (kind= CK,len= 1 ),intent (in ),optional :: comment_char ! ! If present, this character is used
303
- ! ! to denote comments in the JSON file,
304
- ! ! which will be ignored if present.
305
- ! ! Example: `!` or `#`.
283
+ #include " json_initialize_arguments.inc"
306
284
307
285
call me% core% initialize(verbose,compact_reals,&
308
286
print_signs,real_format,spaces_per_tab,&
@@ -311,19 +289,20 @@ subroutine initialize_json_core_in_file(me,verbose,compact_reals,&
311
289
case_sensitive_keys,&
312
290
no_whitespace,&
313
291
unescape_strings,&
314
- comment_char)
292
+ comment_char,&
293
+ use_rfc6901_paths)
315
294
316
295
end subroutine initialize_json_core_in_file
317
296
! *****************************************************************************************
318
297
319
298
! *****************************************************************************************
320
299
! >
321
- ! Set the [[json_core]] for this [[json_file]].
300
+ ! Set the [[json_core(type) ]] for this [[json_file]].
322
301
!
323
302
! @note: This does not destroy the data in the file.
324
303
!
325
304
! @note: This one is used if you want to initialize the file with
326
- ! an already-existing [[json_core]] (presumably, this was already
305
+ ! an already-existing [[json_core(type) ]] (presumably, this was already
327
306
! initialized by a call to [[initialize_json_core]] or similar).
328
307
329
308
subroutine set_json_core_in_file (me ,core )
@@ -340,7 +319,7 @@ end subroutine set_json_core_in_file
340
319
341
320
! *****************************************************************************************
342
321
! >
343
- ! Get a copy of the [[json_core]] in this [[json_file]].
322
+ ! Get a copy of the [[json_core(type) ]] in this [[json_file]].
344
323
345
324
subroutine get_json_core_in_file (me ,core )
346
325
@@ -372,37 +351,15 @@ function initialize_json_file(p,verbose,compact_reals,&
372
351
case_sensitive_keys ,&
373
352
no_whitespace ,&
374
353
unescape_strings ,&
375
- comment_char ) result(file_object)
354
+ comment_char ,&
355
+ use_rfc6901_paths ) result(file_object)
376
356
377
357
implicit none
378
358
379
359
type (json_file) :: file_object
380
360
type (json_value),pointer ,optional ,intent (in ) :: p ! ! `json_value` object to cast
381
361
! ! as a `json_file` object
382
- logical (LK),intent (in ),optional :: verbose ! ! mainly useful for debugging (default is false)
383
- logical (LK),intent (in ),optional :: compact_reals ! ! to compact the real number strings for output (default is true)
384
- logical (LK),intent (in ),optional :: print_signs ! ! always print numeric sign (default is false)
385
- character (kind= CDK,len=* ),intent (in ),optional :: real_format ! ! Real number format: 'E' [default], '*', 'G', 'EN', or 'ES'
386
- integer (IK),intent (in ),optional :: spaces_per_tab ! ! number of spaces per tab for indenting (default is 2)
387
- logical (LK),intent (in ),optional :: strict_type_checking ! ! if true, no integer, double, or logical type
388
- ! ! conversions are done for the `get` routines
389
- ! ! (default is false)
390
- logical (LK),intent (in ),optional :: trailing_spaces_significant ! ! for name and path comparisons, is trailing
391
- ! ! space to be considered significant.
392
- ! ! (default is false)
393
- logical (LK),intent (in ),optional :: case_sensitive_keys ! ! for name and path comparisons, are they
394
- ! ! case sensitive. (default is true)
395
- logical (LK),intent (in ),optional :: no_whitespace ! ! if true, printing the JSON structure is
396
- ! ! done without adding any non-significant
397
- ! ! spaces or linebreaks (default is false)
398
- logical (LK),intent (in ),optional :: unescape_strings ! ! If false, then the raw escaped
399
- ! ! string is returned from [[json_get_string]]
400
- ! ! and similar routines. If true [default],
401
- ! ! then the string is returned unescaped.
402
- character (kind= CK,len= 1 ),intent (in ),optional :: comment_char ! ! If present, this character is used
403
- ! ! to denote comments in the JSON file,
404
- ! ! which will be ignored if present.
405
- ! ! Example: `!` or `#`.
362
+ #include " json_initialize_arguments.inc"
406
363
407
364
call file_object% initialize(verbose,compact_reals,&
408
365
print_signs,real_format,spaces_per_tab,&
@@ -411,7 +368,8 @@ function initialize_json_file(p,verbose,compact_reals,&
411
368
case_sensitive_keys,&
412
369
no_whitespace,&
413
370
unescape_strings,&
414
- comment_char)
371
+ comment_char,&
372
+ use_rfc6901_paths)
415
373
416
374
if (present (p)) file_object% p = > p
417
375
@@ -422,7 +380,7 @@ end function initialize_json_file
422
380
! > author: Jacob Williams
423
381
! date: 4/26/2016
424
382
!
425
- ! Cast a [[json_value]] pointer and a [[json_core]] object
383
+ ! Cast a [[json_value]] pointer and a [[json_core(type) ]] object
426
384
! as a [[json_file(type)]] object.
427
385
428
386
function initialize_json_file_v2 (json_value_object , json_core_object ) &
@@ -448,8 +406,8 @@ end function initialize_json_file_v2
448
406
! or will be reused to open a different file.
449
407
! Otherwise a memory leak will occur.
450
408
!
451
- ! Optionally, also destroy the [[json_core]] instance (this
452
- ! is not necessary to prevent memory leaks, since a [[json_core]]
409
+ ! Optionally, also destroy the [[json_core(type) ]] instance (this
410
+ ! is not necessary to prevent memory leaks, since a [[json_core(type) ]]
453
411
! does not use pointers).
454
412
!
455
413
! ### History
@@ -461,7 +419,7 @@ subroutine json_file_destroy(me,destroy_core)
461
419
implicit none
462
420
463
421
class(json_file),intent (inout ) :: me
464
- logical ,intent (in ),optional :: destroy_core ! ! to also destroy the [[json_core]].
422
+ logical ,intent (in ),optional :: destroy_core ! ! to also destroy the [[json_core(type) ]].
465
423
! ! default is to leave it as is.
466
424
467
425
if (associated (me% p)) call me% core% destroy(me% p)
0 commit comments