Goddard-Fortran-Ecosystem / yaFyaml

Yet Another Fortran YAML
Apache License 2.0
13 stars 8 forks source link

Overload the Parser::load() interface #42

Closed tclune closed 2 years ago

tclune commented 2 years ago

Currently, the Parser class has a single interface for loading a config:

https://github.com/Goddard-Fortran-Ecosystem/yaFyaml/blob/6b9a50eb7000a600c9816c63abc8c84075771a33/src/Parser.F90#L90-L104

This interface is useful for testing, but is inconvenient for end users as they first must create a stream from an actual file. The load() interface should be overloaded that takes a filename as an argument instead a stream. It would open the file to create a stream and then call the original load() and then close the file. You can see the pattern in the examples.

The examples should then be updated to use the simpler interface.