[−][src]Struct tidy::Tidy
Fields
errbuf: *mut TidyBuffer
output: *mut TidyBuffer
Implementations
impl Tidy
[src]
pub fn new() -> Result<Tidy, TidyError>
[src]
pub fn access_warning_count(&self) -> c_uint
[src]
Indicates the number of TidyAccess messages that were generated.
Returns
Returns the number of TidyAccess messages that were generated.
pub fn config_error_count(&self) -> c_uint
[src]
Indicates the number of configuration error messages that were generated.
Returns
Returns the number of configuration error messages that were generated.
pub fn detected_generic_xml(&self) -> bool
[src]
Indicates whether or not the input document was XML.
If TidyXml tags is true, or there was an XML declaration in the input document, then this function will return yes.
Returns
Returns true if the input document was XML.
pub fn detected_html_version(&self) -> c_int
[src]
Gets the version of HTML that was output, as an integer, times 100.
For example, HTML5 will return 500; HTML4.0.1 will return 401.
Returns
Returns the HTML version number (x100).
pub fn detected_xhtml(&self) -> bool
[src]
Indicates whether the output document is or isn't XHTML.
Returns
Returns true if the document is an XHTML type.
pub fn error_count(&self) -> c_uint
[src]
Indicates the number of TidyError messages that were generated.
For any value greater than 0, output is suppressed unless TidyForceOutput is set.
Returns
Returns the number of TidyError messages that were generated.
pub fn library_version(&self) -> String
[src]
Get the version number for the current library. Returns The string representing the version number.
pub fn load_config(&self, config_file: &str) -> Result<TidySeverity, TidyError>
[src]
Load an ASCII Tidy configuration file and set the configuration per its contents.
Returns
Returns TidySeverity::Success upon success, or a TidyError if there was an error.
Parameters
config_file The complete path to the file to load.
pub fn release_date(&self) -> String
[src]
pub fn set_char_encoding(&self, encnam: &str) -> Result<TidySeverity, TidyError>
[src]
Set the input/output character encoding for parsing markup.
Valid values include ascii, latin1, raw, utf8, iso2022, mac, win1252, utf16le, utf16be, utf16, big5, and shiftjis. These values are not case sensitive.
Note
This is the same as using set_in_char_encoding() and set_out_char_encoding() to set the same value.
Parameters
encnam The encoding name as described above.
Returns
Returns TidySeverity::Success upon success, or a TidyError if there was an error.
pub fn set_in_char_encoding(
&self,
encnam: &str
) -> Result<TidySeverity, TidyError>
[src]
&self,
encnam: &str
) -> Result<TidySeverity, TidyError>
Set the input encoding for parsing markup.
Valid values include ascii, latin1, raw, utf8, iso2022, mac, win1252, utf16le, utf16be, utf16, big5, and shiftjis. These values are not case sensitive.
Parameters
encnam The encoding name as described above.
Returns
Returns TidySeverity::Success upon success, or a TidyError if there was an error.
pub fn set_out_char_encoding(
&self,
encnam: &str
) -> Result<TidySeverity, TidyError>
[src]
&self,
encnam: &str
) -> Result<TidySeverity, TidyError>
Set the output encoding for writing markup.
Valid values include ascii, latin1, raw, utf8, iso2022, mac, win1252, utf16le, utf16be, utf16, big5, and shiftjis. These values are not case sensitive.
Parameters
encnam The encoding name as described above.
Returns
Returns TidySeverity::Success upon success, or a TidyError if there was an error.
pub fn status(&self) -> TidySeverity
[src]
Get status of current document.
Returns
Returns TidySeverity::Error indicating that errors were present in the document, TidySeverity::Warning indicating warnings, and TidySeverity::Success in the case of everything being okay.
pub fn warning_count(&self) -> c_uint
[src]
Indicates the number of TidyWarning messages that were generated.
Returns
Returns the number of warning messages that were generated.
pub fn get_option(&self, optid: TidyOptionId) -> TidyOption
[src]
Retrieves an instance of TidyOption given a valid TidyOptionId.
Parameters
optid The TidyOptionId to retrieve.
Returns
An instance of TidyOption matching the provided TidyOptionId.
pub fn get_option_by_name(&self, optnam: &str) -> TidyOption
[src]
Returns an instance of TidyOption by providing the name of a Tidy configuration option.
Parameters
optnam The name of the Tidy configuration option.
Returns
The TidyOption of the given optname.
pub fn opt_copy_config(
&self,
tdoc_to: TidyDoc
) -> Result<TidySeverity, TidyError>
[src]
&self,
tdoc_to: TidyDoc
) -> Result<TidySeverity, TidyError>
Copy current configuration settings from one document to another.
Note that the destination document's existing settings will be stored as that document's snapshot prior to having its option values overwritten by the source document's settings.
Parameters
tdoc_to The destination tidy document.
Returns
Returns TidySeverity::Success indicating success or a TidyError on failure.
pub fn opt_diff_than_default(&self) -> bool
[src]
Checks if settings are different than default
Returns
Returns a bool indicating whether or not a difference exists.
pub fn opt_diff_than_snapshot(&self) -> bool
[src]
Checks if settings are different than snapshot
Returns
Returns a bool indicating whether or not a difference exists.
pub fn tidyOptGetBool(&self, optid: TidyOptionId) -> bool
[src]
Get current option value as a Boolean flag.
Parameters
optid The option ID to get.
Returns
Returns a bool indicating the value.
pub fn opt_get_category(opt: TidyOption) -> TidyConfigCategory
[src]
Get category of given Option.
Parameters
opt An instance of a TidyOption to query.
Returns
The TidyConfigCategory of the specified option.
pub fn opt_get_default(opt: TidyOption) -> String
[src]
Get default value of given Option as a string.
Parameters
opt An instance of a TidyOption to query.
Returns
A string indicating the default value of the specified option.
pub fn opt_get_default_bool(opt: TidyOption) -> bool
[src]
Get default value of given Option as a Boolean value.
Parameters
opt An instance of a TidyOption to query.
Returns
A boolean indicating the default value of the specified option.
pub fn opt_get_default_int(opt: TidyOption) -> c_ulong
[src]
Get default value of given Option as an unsigned integer.
Parameters
opt An instance of a TidyOption to query.
Returns
An unsigned integer indicating the default value of the specified option.
pub fn opt_get_doc(&self, opt: TidyOption) -> String
[src]
Get the description of the specified option.
Parameters
opt An instance of a TidyOption to query.
Returns
Returns a string containing a description of the given option.
pub fn opt_get_enc_name(&self, optid: TidyOptionId) -> String
[src]
Get character encoding name.
Used with TidyCharEncoding, TidyOutCharEncoding, and TidyInCharEncoding.
Parameters
optid The option ID whose value to check.
Returns
The encoding name as a string for the specified option.
pub fn opt_get_name(opt: TidyOption) -> String
[src]
Get ID of given Option.
Parameters
opt An instance of a TidyOption to query.
Returns
The TidyOptionId of the given option.
pub fn opt_get_id(opt: TidyOption) -> TidyOptionId
[src]
Get ID of given Option.
Parameters
opt An instance of a TidyOption to query.
Returns
The TidyOptionId of the given option.
pub fn opt_get_id_for_name(optnam: &str) -> TidyOptionId
[src]
Returns the TidyOptionId (enum value) by providing the name of a Tidy configuration option.
Parameters
optnam The name of the option ID to retrieve.
Returns
The TidyOptionId of the given optname.
pub fn opt_get_int(&self, optid: TidyOptionId) -> c_ulong
[src]
Get current option value as an integer.
Parameters
optid The option ID to get.
Returns
Returns the integer value of the specified option.
pub fn opt_get_type(opt: TidyOption) -> TidyOptionType
[src]
Get datatype of given Option.
Parameters
opt An instance of a TidyOption to query.
Returns
The TidyOptionType of the given option.
pub fn opt_get_value(&self, optid: TidyOptionId) -> String
[src]
Get the current value of the option ID for the given document.
Remarks
The optid must have a TidyOptionType of TidyString!
Parameters
optid The option ID whose value you wish to check.
pub fn opt_parse_value(
&self,
optnam: &str,
val: &str
) -> Result<TidySeverity, TidyError>
[src]
&self,
optnam: &str,
val: &str
) -> Result<TidySeverity, TidyError>
Set named option value as a string, regardless of the TidyOptionType.
Remarks
This is good setter if you are unsure of the type.
Parameters
optnam The name of the option to set; this is the string value from the UI, e.g., error-file.
Returns
Returns TidySeverity::Success indicating success or a TidyError on failure. val The value to set.
pub fn opt_reset_all_to_default(&self) -> Result<TidySeverity, TidyError>
[src]
Reset all options to their default values.
Returns
Returns TidySeverity::Success indicating success or TidyError on failure.
pub fn opt_reset_to_default(
&self,
optid: TidyOptionId
) -> Result<TidySeverity, TidyError>
[src]
&self,
optid: TidyOptionId
) -> Result<TidySeverity, TidyError>
Reset option to default value by ID.
Parameters opt The option ID to reset
Returns
Returns a TidySeverity::Success indicating success or TidyError on failure.
pub fn opt_reset_to_snapshot(&self) -> Result<TidySeverity, TidyError>
[src]
Apply a snapshot of config settings to a document.
Returns
Returns a TidySeverity::Success indicating success or TidyError on failure.
pub fn opt_set_bool(
&self,
optid: TidyOptionId,
val: bool
) -> Result<TidySeverity, TidyError>
[src]
&self,
optid: TidyOptionId,
val: bool
) -> Result<TidySeverity, TidyError>
Set option value as a Boolean flag.
Parameters
optid The option ID to set. val The value to set.
Returns
Returns a TidySeverity::Success indicating success or TidyError on failure.
pub fn opt_set_int(
&self,
optid: TidyOptionId,
val: c_ulong
) -> Result<TidySeverity, TidyError>
[src]
&self,
optid: TidyOptionId,
val: c_ulong
) -> Result<TidySeverity, TidyError>
Set option value as an integer.
Parameters
optId The option ID to set. val The value to set.
Returns
Returns a TidySeverity::Success indicating success or TidyError on failure.
pub fn opt_set_value(
&self,
optid: TidyOptionId,
val: &str
) -> Result<TidySeverity, TidyError>
[src]
&self,
optid: TidyOptionId,
val: &str
) -> Result<TidySeverity, TidyError>
Set the option value as a string.
Parameters
optId The option ID of the value to set. val The string value to set.
Returns
Returns a TidySeverity::Success indicating success or TidyError on failure.
pub fn opt_snapshot(&self) -> Result<TidySeverity, TidyError>
[src]
Take a snapshot of current config settings.
These settings are stored within the tidy document. Note, however, that snapshots do not reliably survive the tidyParseXXX() process, as Tidy uses the snapshot mechanism in order to store the current configuration right at the beginning of the parsing process.
Returns
Returns a TidySeverity::Success indicating success or TidyError on failure.
pub fn clean_and_repair(&self) -> Result<TidySeverity, TidyError>
[src]
Execute configured cleanup and repair operations on parsed markup.
Returns
An integer representing the status.
pub fn report_doctype(&self) -> TidySeverity
[src]
pub fn run_diagnostics(&self) -> Result<TidySeverity, TidyError>
[src]
Reports the document type and diagnostic statistics on parsed and repaired markup.
You must call tidyCleanAndRepair() before using this function.
Returns
An integer representing the status.
pub fn parse_file(&self, filename: &str) -> Result<TidySeverity, TidyError>
[src]
Parse markup in named file.
Returns
Returns tTidySeverity::Error indicating that errors were present in the document, TidySeverity::Warning indicating warnings, and TidySeverity::Success in the case of everything being okay.
Parameters
filename The filename to parse.
pub fn parse_stdin(&self) -> Result<TidySeverity, TidyError>
[src]
Parse markup from the standard input.
Returns Returns tTidySeverity::Error indicating that errors were present in the document, TidySeverity::Warning indicating warnings, and TidySeverity::Success in the case of everything being okay.
pub fn parse_string(&self, content: Vec<u8>) -> Result<TidySeverity, TidyError>
[src]
Parse markup in given string.
Returns Returns tTidySeverity::Error indicating that errors were present in the document, TidySeverity::Warning indicating warnings, and TidySeverity::Success in the case of everything being okay.
Parameters
content The string to parse.
pub fn opt_save_file(&self, cfgfil: &str) -> Result<TidySeverity, TidyError>
[src]
Save current settings to named file.
Only writes non-default values.
Returns
A TidySeverity or a TidyError representing the status.
Parameters
cfgfil The filename to save the configuration to.
pub fn save_buffer(&self) -> Result<TidySeverity, TidyError>
[src]
Save the tidy document to given TidyBuffer object.
Returns
A TidySeverity or a TidyError representing the status.
pub fn save_file(&self, filename: &str) -> Result<TidySeverity, TidyError>
[src]
Save the tidy document to the named file.
Returns
A TidySeverity or a TidyError representing the status.
Parameters
filename The destination file name.
pub fn save_stdout(&self) -> Result<TidySeverity, TidyError>
[src]
Save the tidy document to standard output (FILE*).
Returns
A TidySeverity or a TidyError representing the status.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Tidy
impl !Send for Tidy
impl !Sync for Tidy
impl Unpin for Tidy
impl UnwindSafe for Tidy
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,