CoolProp
8.0.0
An open-source fluid property and humid air property database
include
CoolProp
FactoryOptions.h
Go to the documentation of this file.
1
#ifndef COOLPROP_FACTORY_OPTIONS_H
2
#define COOLPROP_FACTORY_OPTIONS_H
3
4
#include <string>
5
6
namespace
CoolProp
{
7
8
// Result of splitting a factory string of the form
9
//
10
// <backend-and-fluid>[?<options>]
11
//
12
// into its two halves. `options_json` is the *raw* options payload as a
13
// JSON string, populated by either an inline `?{...}` blob or a
14
// `?@<path>` indirection that reads the file at <path>. No JSON parsing
15
// or schema validation happens here — that lives one layer up in the
16
// schema validator. When the factory string has no `?` suffix or the
17
// suffix is empty, `options_json` is the empty string and downstream
18
// callers treat that as "no options".
19
struct
FactoryOptionsParseResult
20
{
21
std::string
clean_string
;
22
std::string
options_json
;
23
};
24
25
// Split a factory string on its first `?` and resolve the suffix.
26
//
27
// - No `?` → options_json = ""
28
// - `?` then empty / whitespace → options_json = ""
29
// - `?@<path>` → options_json = contents of <path>
30
// (FileIOError on read failure)
31
// - anything else → options_json = the verbatim tail
32
//
33
// The parser deliberately does *not* validate JSON, look at the schema,
34
// or interpret the suffix in any other way. Any `?` characters after
35
// the first one (e.g. inside a JSON string value, inside a URL, inside
36
// the `@<path>` filename itself) are kept verbatim — the contract is
37
// `find_first_of('?')` exactly once.
38
FactoryOptionsParseResult
parse_factory_options
(
const
std::string& factory_string);
39
40
}
// namespace CoolProp
41
42
#endif
// COOLPROP_FACTORY_OPTIONS_H
Generated by
1.9.4