Abstract class for token I/O.
|
|
static int | parse_format_string (const std::string &fmtString) |
|
static int | guess_filename_format (const char *filename) |
|
static bool | is_empty_format (int fmt) |
|
static int | sanitize_format (int fmt, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
|
static int | parse_format_request (const char *request, const char *filename=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
|
static std::string | format_canonical_string (int fmt) |
|
|
static class TokenReader * | new_reader (int fmt) |
|
static class TokenWriter * | new_writer (int fmt) |
|
static class TokenReader * | file_reader (const char *filename, const char *fmt_request=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
|
static class TokenWriter * | file_writer (const char *filename, const char *fmt_request=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
|
|
static size_t | pipe_tokens (class TokenReader *reader, class TokenWriter *writer) |
|
static size_t | pipe_sentences (class TokenReader *reader, class TokenWriter *writer) |
|
◆ parse_format_string()
static int moot::TokenIO::parse_format_string |
( |
const std::string & |
fmtString | ) |
|
|
static |
Parse a format string, which should be a comma-separated list of moot::TokenIOFormat flag-names (without the 'tiof' prefix, matching is case-insensitive). A prefix of '!' indicates negation of the given flag. Returns the corresponding bitmask.
- See also
- parse_format_request
◆ guess_filename_format()
static int moot::TokenIO::guess_filename_format |
( |
const char * |
filename | ) |
|
|
static |
Guess basic format flags from a filename based on dot-separated extension substrings. Returns a bitmask suitable for passing to sanitize_format(). Recognizes filename extensions as documented in mootfiles(5).
- See also
- parse_format_request
◆ is_empty_format()
static bool moot::TokenIO::is_empty_format |
( |
int |
fmt | ) |
|
|
static |
◆ sanitize_format()
static int moot::TokenIO::sanitize_format |
( |
int |
fmt, |
|
|
int |
fmt_implied = tiofNone , |
|
|
int |
fmt_default = tiofNone |
|
) |
| |
|
static |
◆ parse_format_request()
static int moot::TokenIO::parse_format_request |
( |
const char * |
request, |
|
|
const char * |
filename = __null , |
|
|
int |
fmt_implied = tiofNone , |
|
|
int |
fmt_default = tiofNone |
|
) |
| |
|
static |
Top-level format-instantiation utility.
- Parameters
-
request | user-requested format string, has highest priority |
filename | filename used to guess basic format flags (only used if request is NULL or empty) |
fmt_implied | implied format bitmask (required information content) |
fmt_default | default format bitmask (for empty formats) |
◆ format_canonical_string()
static std::string moot::TokenIO::format_canonical_string |
( |
int |
fmt | ) |
|
|
static |
Convert a format bitmask to a canonical string form.
◆ new_reader()
static class TokenReader* moot::TokenIO::new_reader |
( |
int |
fmt | ) |
|
|
static |
Create a new TokenReader object suitable for reading the format fmt
.
- Parameters
-
- Warning
- Caller is responsible for deleting the object returned.
◆ new_writer()
static class TokenWriter* moot::TokenIO::new_writer |
( |
int |
fmt | ) |
|
|
static |
Create a new moot::TokenWriter object suitable for writing the format fmt
.
- Parameters
-
- Warning
- caller is responsible for delting the object returned.
◆ file_reader()
static class TokenReader* moot::TokenIO::file_reader |
( |
const char * |
filename, |
|
|
const char * |
fmt_request = __null , |
|
|
int |
fmt_implied = tiofNone , |
|
|
int |
fmt_default = tiofNone |
|
) |
| |
|
static |
Create a new TokenReader object for reading from the file filename. Wrapper for new_reader(parse_format_request(request,filename,fmt_implied,fmt_default)).from_filename(filename)
- Parameters
-
filename | filename from which to read, will be opened with TokenReader::from_filename() |
fmt_request | format request (overrides filename heuristics) |
fmt_implied | implied format flags |
fmt_default | default format flags |
- Returns
- new TokenReader for filename, or NULL if something went wrong.
- Warning
- Caller is responsible for deleting the object returned.
◆ file_writer()
static class TokenWriter* moot::TokenIO::file_writer |
( |
const char * |
filename, |
|
|
const char * |
fmt_request = __null , |
|
|
int |
fmt_implied = tiofNone , |
|
|
int |
fmt_default = tiofNone |
|
) |
| |
|
static |
Create a new TokenWriter object for writing to the file filename. Wrapper for new_writer(parse_format_request(request,filename,fmt_implied,fmt_default)).to_filename(filename)
- Parameters
-
filename | file to be written, will be opened with TokenWriter::to_filename() |
fmt_request | format request (overrides filename heuristics) |
fmt_implied | implied format flags |
fmt_default | default format flags |
- Returns
- new TokenWriter for filename, or NULL if something went wrong.
- Warning
- Caller is responsible for deleting the object returned.
◆ pipe_tokens()
Pipes tokens from reader to writer using reader->get_token() and writer->put_token().
- Returns
- number of tokens copied.
◆ pipe_sentences()
Pipes sentences from reader to writer using reader->get_sentence() and writer->put_sentence()
- Returns
- number of sentences copied.
The documentation for this class was generated from the following file: