CssValueParser
Parse CSS properties values like numbers, Urls, etc.
Construtores
CssValueParser(RAdapter)
Init.
Métodos
GetActualBorderWidth(string, CssBoxProperties) : double
Parses a border value in CSS style; e.g. 1px, 1, thin, thick, medium
- borderValue
- b
GetActualColor(string) : RColor
Parses a color value in CSS style; e.g. #ff0000, red, rgb(255,0,0), rgb(100%, 0, 0)
- colorValue
- color string value to parse
Retorna: Color value
GetColorByHex(string, int, int, RColor) : bool
Get color by parsing given hex value color string (#A28B34).
Retorna: true - valid color, false - otherwise
GetColorByName(string, int, int, RColor) : bool
Get color by given name, including .NET name.
Retorna: true - valid color, false - otherwise
GetColorByRgb(string, int, int, RColor) : bool
Get color by parsing given RGB value color string (RGB(255,180,90))
Retorna: true - valid color, false - otherwise
GetColorByRgba(string, int, int, RColor) : bool
Get color by parsing given RGBA value color string (RGBA(255,180,90,180))
Retorna: true - valid color, false - otherwise
GetUnit(string, string, bool) : string
Get the unit to use for the length, use default if no unit found in length string.
IsColorValid(string) : bool
Check if the given color string value is valid.
- colorValue
- color string value to parse
Retorna: true - valid, false - invalid
IsFloat(string, int, int) : bool
Check if the given substring is a valid double number. Assume given substring is not empty and all indexes are valid!
Retorna: true - valid double number, false - otherwise
IsInt(string, int, int) : bool
Check if the given substring is a valid double number. Assume given substring is not empty and all indexes are valid!
Retorna: true - valid int number, false - otherwise
IsValidLength(string) : bool
Check if the given string is a valid length value.
- value
- the string value to check
Retorna: true - valid, false - invalid
ParseHexInt(string, int, int) : int
Parse the given hex number string to positive int value. Assume given substring is not empty and all indexes are valid!
Retorna: int value, -1 if not valid
ParseInt(string, int, int) : int
Parse the given decimal number string to positive int value. Assume given substring is not empty and all indexes are valid!
Retorna: int value, -1 if not valid
ParseIntAtIndex(string, int) : int
Parse the given decimal number string to positive int value. Start at given , ignore whitespaces and take as many digits as possible to parse to int.
- str
- the string to parse
- startIdx
- the index to start parsing at
Retorna: parsed int or 0
ParseLength(string, double, double, string, bool, bool) : double
Parses a length. Lengths are followed by an unit identifier (e.g. 10px, 3.1em)
- length
- Specified length
- hundredPercent
- Equivalent to 100 percent when length is percentage
- emFactor
- defaultUnit
- fontAdjust
- if the length is in pixels and the length is font related it needs to use 72/96 factor
- returnPoints
- Allows the return double to be in points. If false, result will be pixels
Retorna: the parsed length value with adjustments
ParseLength(string, double, CssBoxProperties, string) : double
Parses a length. Lengths are followed by an unit identifier (e.g. 10px, 3.1em)
- length
- Specified length
- hundredPercent
- Equivalent to 100 percent when length is percentage
- box
- defaultUnit
Retorna: the parsed length value with adjustments
ParseLength(string, double, CssBoxProperties, bool) : double
Parses a length. Lengths are followed by an unit identifier (e.g. 10px, 3.1em)
- length
- Specified length
- hundredPercent
- Equivalent to 100 percent when length is percentage
- fontAdjust
- if the length is in pixels and the length is font related it needs to use 72/96 factor
- box
Retorna: the parsed length value with adjustments
ParseNumber(string, double) : double
Evals a number and returns it. If number is a percentage, it will be multiplied by
- number
- Number to be parsed
- hundredPercent
- Number that represents the 100% if parsed number is a percentage
Retorna: Parsed number. Zero if error while parsing.