Documentation
¶
Overview ¶
Package warn holds what the readers share in saying what a fixed bound left out, and the messages of warnings several of them raise. The codes are go-fast-core's: this library has none of its own.
Index ¶
- Constants
- Variables
- func FitRows(budget *gofastcore.TextBudget, rows, cols int) int
- func Over(s string) int64
- func TextCut(noun string) string
- func Unmapped(n int) string
- func UnmappedEquation(n int) string
- type Cap
- type Lost
- func (l *Lost) Add(c Cap, n int64)
- func (l *Lost) AddCut(c Cap, n, bytes int64)
- func (l *Lost) Address(s string) string
- func (l *Lost) Any() bool
- func (l *Lost) Count(c Cap) int64
- func (l *Lost) Label(s string) string
- func (l *Lost) Merge(o *Lost)
- func (l *Lost) Name(s string) string
- func (l *Lost) NameOver(over int64)
- func (l *Lost) Say(p *gofastcore.Part) bool
- func (l *Lost) Take() *Lost
- func (l *Lost) Warnings() []gofastcore.Warning
- type Names
Constants ¶
const ( MaxProjects = 16 MaxProjectSize = 1 << 28 MaxModules = 1 << 12 MaxPropertyName = clean.MaxLabel MaxPropertyValue = 64 << 10 MaxCustomProps = 256 MaxProperties = 1 << 12 MaxObjects = 1 << 12 MaxObjectDepth = 64 MaxAddress = clean.MaxAddress MaxName = clean.MaxLabel MaxSheets = 1 << 16 MaxCols = 1 << 14 MaxComments = 1 << 18 MaxLinks = 1 << 18 MaxMerges = 1 << 18 MaxCellStyles = 1 << 17 MaxNumberFormats = 1 << 13 MaxFormula = 32 << 10 MaxNames = 1 << 14 MaxExternalLinks = 1 << 16 MaxExternalNames = 1 << 16 MaxSheetRefs = 1 << 16 MaxChoiceLists = 1 << 14 MaxChoiceRanges = 1 << 18 MaxChartSeries = 1 << 10 MaxChartPoints = 1 << 20 MaxChartTitle = 4096 MaxChartTotal = 1 << 21 MaxCharts = 1 << 12 MaxSlides = 1 << 16 MaxSlideShapes = 1 << 14 MaxFieldCode = 1 << 16 MaxFieldDepth = 64 MaxTableCells = 1 << 22 MaxPivotTables = 1 << 10 MaxChartLookup = 256 << 20 MaxShapes = 1 << 16 MaxPictures = 1 << 16 )
The bounds, where the code that keeps to them and the messages above both need them.
const ( DamagedOne = "stream could not be read to its end" DamagedMany = "streams could not be read to their end" )
The nouns of the warning that parts could not be read to their end.
Variables ¶
var ErrText = errors.New("the limit on the amount of text was reached")
ErrText is what a reader ends with when the document has taken all the text it may hold (gofastcore.Limits.MaxTextBytes).
Functions ¶
func FitRows ¶
FitRows returns how many of rows rows of cols cells a table block can have and stay within what budget has left, taking gofastcore.BlockCost for the block and gofastcore.CellCost for each cell (the cells' text was taken as it was read), and takes it. A result below rows means the table is cut there; 0 means not even its block fits, and nothing is taken.
func TextCut ¶
TextCut is the message of the limit.exceeded warning on a part cut off for that reason; what stands for "part" is the kind of part.
func Unmapped ¶
Unmapped is the message of gofastcore.WarnTextUnmappedGlyphs: n codes of a symbol font that have no character in Unicode.
func UnmappedEquation ¶
UnmappedEquation is the message of gofastcore.WarnTextUnmappedGlyphs for n characters of equations that Unicode has no character for.
Types ¶
type Cap ¶
type Cap uint8
Cap is a fixed bound of this library that can leave content out. Each is said once per part it left something out of, as limit.exceeded with severity error, with how much it left out; a bound that only bounds work loses nothing and is not here.
const ( // Shared by the three formats. CapProjects Cap = iota CapProjectSize CapModules CapPropertyName CapPropertyValue CapCustomProps CapProperties CapObjects CapObjectDepth CapAddress CapName // Excel. CapSheets CapSheetCols CapComments CapLinks CapMerges CapCellStyles CapNumberFormats CapFormula CapNames CapExternalLinks CapExternalNames CapExternalSheets CapSheetRefs CapChoiceLists CapChoiceRanges CapChartSeries CapChartPoints CapChartTitle CapChartTotal CapCharts CapShapes CapPictures CapChartLookup CapPivotTables // Word. CapFieldCode CapFieldDepth CapTableCells // PowerPoint. CapSlides CapSlideShapes )
type Lost ¶
type Lost struct {
// contains filtered or unexported fields
}
Lost counts what the fixed bounds left out of one part, or of the document, bound by bound in the order met, so that the warnings come in an order that does not vary. The zero value is ready to use, and a nil *Lost counts nothing. Several goroutines may use it at once: what parts share (a chart, a master) may be read by any of them.
func (*Lost) AddCut ¶
AddCut records that the bound c cut n more texts short, leaving bytes bytes out.
func (*Lost) NameOver ¶
NameOver counts a name over the bound by over bytes (Over), where it is put in the output.
type Names ¶
type Names struct {
// contains filtered or unexported fields
}
Names gathers what a warning that could repeat is about (parts that could not be read, references that lead nowhere), so that it is said once, with how many there are and the first few. The zero value is ready to use. Several goroutines may use it at once.