$darkmode
#include <path.hpp>
Public Types | |
| enum | State { Any, State::Absent, State::Exists, State::Executable, State::FileExists, State::DirExists, State::NotFile, State::NotDir } |
| using | Type = boost::filesystem::path |
Public Member Functions | |
| Path (Type *ptr, std::string &&desc) | |
| State | state () const |
| Path | state (State s) && |
| void | set_state (State s) |
| Path | absent () && |
| Path | exists () && |
| Path | executable () && |
| Path | file_exists () && |
| Path | dir_exists () && |
| Path | not_file () && |
| Path | not_dir () && |
| Path | not_empty () && |
| Path | absolute () && |
| bool | resolve () const |
| Path | resolve (bool value) && |
| void | set_resolve (bool value) |
| bool | normalize () const |
| Path | normalize (bool value) && |
| void | set_normalize (bool value) |
| bool | interpolate () const |
| void | set_interpolate (bool value) |
| Path | interpolate (bool value) && |
| Environment * | environment () const |
| void | set_environment (Environment *env) |
| Path | environment (Environment *env) && |
| size_t | min_length () const |
| void | set_min_length (size_t value) |
| Path | min_length (size_t value) && |
| size_t | max_length () const |
| void | set_max_length (size_t value) |
| Path | max_length (size_t value) && |
| const std::string & | pattern () const |
| void | set_pattern (const std::string &value) |
| Path | pattern (const std::string &value) && |
| Json | json_schema () const override |
| void | validate (const Conf &c) const override |
| void | to_json (Json &j) const override |
| void | from_conf (const Conf &c) override |
| Json | serialize (const Type &x) const |
| Type | deserialize (const Conf &c) const |
| void | reset_ptr () override |
Public Member Functions inherited from fable::schema::Base< Path > | |
| Base (JsonType t, std::string &&desc) | |
| Base (JsonType t) | |
| Base (std::string &&desc) | |
| Interface * | clone () const override |
| operator Box () const | |
| JsonType | type () const override |
| std::string | type_string () const override |
| Json | usage () const override |
| bool | is_required () const override |
| Path | require () && |
| Path | required (bool value) && |
| Path | reset_pointer () && |
| bool | has_description () const |
| void | set_description (const std::string &s) override |
| void | set_description (std::string &&s) |
| const std::string & | description () const override |
| Path | description (std::string &&desc) && |
Public Member Functions inherited from fable::schema::Interface | |
| virtual bool | is_variant () const |
| virtual bool | is_valid (const Conf &c) const |
| virtual Json | to_json () const |
Additional Inherited Members | |
Protected Member Functions inherited from fable::schema::Base< Path > | |
| void | validate_type (const Conf &c) const |
| void | throw_error (const Conf &c, const char *format, Args... args) const |
| void | throw_error (const ConfError &e) const |
| void | throw_wrong_type (const Conf &c) const |
| void | augment_schema (Json &j) const |
Protected Attributes inherited from fable::schema::Base< Path > | |
| JsonType | type_ |
| bool | required_ |
| std::string | desc_ |
Path de-/serializes a string that represents a filesystem path.
Filesystem paths are special strings. We must take things into consideration such as:
The Path schema type allows the user to specify these properties and will validate these during deserialization.
|
strong |
State represents valid states a path can be in relative to the filesystem.
|
inline |
Require the input path to be absolute.
|
inlineoverridevirtual |
Apply the input JSON configuration.
This does not validate the input.
Implements fable::schema::Interface.
|
overridevirtual |
Return the JSON schema.
Example output:
{ "$schema": "http://json-schema.org/draft-07/schema#", "description": "stand-in no-operation simulator", "properties": { "vehicles": { "description": "list of vehicle names to make available", "items": { "type": "string" }, "type": "array" } }, "title": "nop", "additionalProperties": false, "type": "object" }
See the following links for the specification:
Implements fable::schema::Interface.
|
inlineoverridevirtual |
Reset the internal pointer to nullptr, protecting against invalid access.
This should be used when a schema is used after the backing data has been deleted.
Implements fable::schema::Interface.
|
inline |
Return whether path resolution is active.
By default this is true.
|
inline |
Set whether the configuration file location should be used to resolve the path being set.
This is particularly valuable when a configuration has references to other files. Instead of using the current-working-directory as the reference point, the file where the configuration value originates should be used as the reference point.
Resolve must be true if the search path should be used to resolve executables.
|
inline |
Return the required state of the path in the filesystem.
Set the required state of the path in the filesystem.
|
inlineoverridevirtual |
Return the current value of the destination.
Warning: This is NOT an efficient operation, but it can be useful for cases where speed is not important.
Implements fable::schema::Interface.
|
overridevirtual |
Validate the input JSON configuration.
If you don't have a Conf but would like to validate a Json type, then construct a Conf on the fly:
s.validate(Conf{j});
This function is not provided inline to prevent incorrect use.
Implements fable::schema::Interface.