.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "LaTeXML::Common::Object 3pm" .TH LaTeXML::Common::Object 3pm 2024-02-27 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME "LaTeXML::Common::Object" \- abstract base class for most LaTeXML objects. .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`LaTeXML::Common::Object\*(C'\fR serves as an abstract base class for all other objects (both the data objects and control objects). It provides for common methods for stringification and comparison operations to simplify coding and to beautify error reporting. .SS "Generic functions" .IX Subsection "Generic functions" .ie n .IP """$string = Stringify($object);""" 4 .el .IP "\f(CW$string = Stringify($object);\fR" 4 .IX Item "$string = Stringify($object);" Returns a string identifying \f(CW$object\fR, for debugging. Works on any values and objects, but invokes the stringify method on blessed objects. More informative than the default perl conversion to a string. .ie n .IP """$string = ToString($object);""" 4 .el .IP "\f(CW$string = ToString($object);\fR" 4 .IX Item "$string = ToString($object);" Converts \f(CW$object\fR to string attempting, when possible, to generate straight text without TeX markup. This is most useful for converting Tokens or Boxes to document content or attribute values, or values to be used for pathnames, keywords, etc. Generally, however, it is not possible to convert Whatsits generated by Constructors into clean strings, without TeX markup. Works on any values and objects, but invokes the toString method on blessed objects. .ie n .IP """$boolean = Equals($x,$y);""" 4 .el .IP "\f(CW$boolean = Equals($x,$y);\fR" 4 .IX Item "$boolean = Equals($x,$y);" Compares the two objects for equality. Works on any values and objects, but invokes the equals method on blessed objects, which does a deep comparison of the two objects. .ie n .IP """$tokens = Revert($object);""" 4 .el .IP "\f(CW$tokens = Revert($object);\fR" 4 .IX Item "$tokens = Revert($object);" Returns a Tokens list containing the TeX that would create \f(CW$object\fR. Note that this is not necessarily the original TeX code; expansions or other substitutions may have taken place. .SS Methods .IX Subsection "Methods" .ie n .IP """$string = $object\->stringify;""" 4 .el .IP "\f(CW$string = $object\->stringify;\fR" 4 .IX Item "$string = $object->stringify;" Returns a readable representation of \f(CW$object\fR, useful for debugging. .ie n .IP """$string = $object\->toString;""" 4 .el .IP "\f(CW$string = $object\->toString;\fR" 4 .IX Item "$string = $object->toString;" Returns the string content of \f(CW$object\fR; most useful for extracting a clean, usable, Unicode string from tokens or boxes that might representing a filename or such. To the extent possible, this should provide a string that can be used as XML content, or attribute values, or for filenames or whatever. However, control sequences defined as Constructors may leave TeX code in the value. .ie n .IP """$boole = $object\->equals($other);""" 4 .el .IP "\f(CW$boole = $object\->equals($other);\fR" 4 .IX Item "$boole = $object->equals($other);" Returns whether \f(CW$object\fR and \f(CW$other\fR are equal. Should perform a deep comparison, but the default implementation just compares for object identity. .ie n .IP """$boole = $object\->isaToken;""" 4 .el .IP "\f(CW$boole = $object\->isaToken;\fR" 4 .IX Item "$boole = $object->isaToken;" Returns whether \f(CW$object\fR is an LaTeXML::Core::Token. .ie n .IP """$boole = $object\->isaBox;""" 4 .el .IP "\f(CW$boole = $object\->isaBox;\fR" 4 .IX Item "$boole = $object->isaBox;" Returns whether \f(CW$object\fR is an LaTeXML::Core::Box. .ie n .IP """$boole = $object\->isaDefinition;""" 4 .el .IP "\f(CW$boole = $object\->isaDefinition;\fR" 4 .IX Item "$boole = $object->isaDefinition;" Returns whether \f(CW$object\fR is an LaTeXML::Core::Definition. .ie n .IP """$digested = $object\->beDigested;""" 4 .el .IP "\f(CW$digested = $object\->beDigested;\fR" 4 .IX Item "$digested = $object->beDigested;" Does whatever is needed to digest the object, and return the digested representation. Tokens would be digested into boxes; Some objects, such as numbers can just return themselves. .ie n .IP """$object\->beAbsorbed($document);""" 4 .el .IP \f(CW$object\->beAbsorbed($document);\fR 4 .IX Item "$object->beAbsorbed($document);" Do whatever is needed to absorb the \f(CW$object\fR into the \f(CW$document\fR, typically by invoking appropriate methods on the \f(CW$document\fR. .SH AUTHOR .IX Header "AUTHOR" Bruce Miller .SH COPYRIGHT .IX Header "COPYRIGHT" Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.