flap_object_t
Base (abstract) class upon which FLAP's concrete classes are built.
Source: src/lib/flap_object_t.F90
Dependencies
Contents
- object
- free_object
- print_version
- print_error_message
- print_warning
- set_examples
- inherit_error
- clear_error
- assign_object
- error_prefix
- is_json_format
Derived Types
object
Base (abstract) class upon which FLAP's concrete classes are built.
Inheritance
Attributes: abstract
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
progname | character(len=:) | allocatable | Program name. |
version | character(len=:) | allocatable | Program version. |
help | character(len=:) | allocatable | Help message. |
help_color | character(len=:) | allocatable | ANSI color of help messages. |
help_style | character(len=:) | allocatable | ANSI style of help messages. |
help_markdown | character(len=:) | allocatable | Longer help message, markdown formatted. |
description | character(len=:) | allocatable | Detailed description. |
license | character(len=:) | allocatable | License description. |
authors | character(len=:) | allocatable | Authors list. |
epilog | character(len=:) | allocatable | Epilogue message. |
m_exclude | character(len=:) | allocatable | Mutually exclude other CLA(s group). |
error_message | character(len=:) | allocatable | Meaningful error message to standard-error. |
error_color | character(len=:) | allocatable | ANSI color of error messages. |
error_style | character(len=:) | allocatable | ANSI style of error messages. |
examples | type(flap_string) | allocatable | Examples of correct usage (examples(i)%s). |
error | integer(kind=I4P) | Error trapping flag. | |
usage_lun | integer(kind=I4P) | Output unit to print help/usage messages | |
version_lun | integer(kind=I4P) | Output unit to print version message | |
error_lun | integer(kind=I4P) | Error unit to print error messages | |
case_insensitive | logical | Match switches and command names in any case (F14). | |
error_format | character(len=:) | allocatable | Format of the error messages: text (default) or json (#128). |
error_argument | character(len=:) | allocatable | Argument of the last error, when known (JSON format). |
error_suggestions | type(flap_string) | allocatable | "Did you mean" candidates of the last error (JSON format). |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
error_prefix | pass(self) | Prefix of error messages. |
free_object | pass(self) | Free dynamic memory. |
print_version | pass(self) | Print version. |
print_error_message | pass(self) | Print meaningful error message. |
print_warning | pass(self) | Print a warning. |
is_json_format | pass(self) | Check if the error messages are JSON lines. |
inherit_error | pass(self) | Take the error of another object, with its message. |
clear_error | pass(self) | Forget the error and its message. |
set_examples | pass(self) | Set examples of correct usage. |
assign_object | pass(lhs ) | Assignment overloading. |
Subroutines
free_object
Free dynamic memory.
Attributes: elemental
subroutine free_object(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(object) | inout | Object data. |
Call graph
print_version
Print version.
subroutine print_version(self, pref)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(object) | in | Object data. | |
pref | character(len=*) | in | optional | Prefixing string. |
Call graph
print_error_message
Print meaningful error message to standard-error.
subroutine print_error_message(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(object) | in | Object data. |
Call graph
print_warning
Print a warning on the error unit, in the format of the error messages.
subroutine print_warning(self, message)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(object) | in | Object data. | |
message | character(len=*) | in | Warning, its prefix included. |
Call graph
set_examples
Set the examples of correct usage: exactly the given ones, or none.
subroutine set_examples(self, examples)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(object) | inout | Object data. | |
examples | character(len=*) | in | optional | Examples of correct usage. |
Call graph
inherit_error
Take the error of another object, with its message: the error of an argument is reported by its group, the one of a group by the CLI, whose error_message is then the message of its error. A status (not positive) has no message.
Attributes: pure
subroutine inherit_error(self, from)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(object) | inout | Object data. | |
from | class(object) | in | Object that raised the error. |
Call graph
clear_error
Forget the error and its message.
Attributes: pure
subroutine clear_error(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(object) | inout | Object data. |
Call graph
assign_object
Assign two abstract objects.
Attributes: elemental
subroutine assign_object(lhs, rhs)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(object) | inout | Left hand side. | |
rhs | class(object) | in | Rigth hand side. |
Call graph
Functions
error_prefix
Return the prefix of every error message: the prefixing string, the program name and a (colorized) "error".
Returns: character(len=:)
function error_prefix(self, pref) result(prefd)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(object) | in | Object data. | |
pref | character(len=*) | in | optional | Prefixing string. |
Call graph
is_json_format
Check if the error messages are JSON lines (#128): an invalid format is text, and parse reports it.
Attributes: pure
Returns: logical
function is_json_format(self) result(is_json)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(object) | in | Object data. |
Call graph