Class CssDeclarationValueTokenizer
- java.lang.Object
-
- com.itextpdf.styledxmlparser.css.parse.CssDeclarationValueTokenizer
-
- Direct Known Subclasses:
CssDeclarationVarParser
public class CssDeclarationValueTokenizer extends java.lang.Object
Tokenizer for CSS declaration values.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CssDeclarationValueTokenizer.Token
The Token class.static class
CssDeclarationValueTokenizer.TokenType
Enumeration of the different token types.
-
Field Summary
Fields Modifier and Type Field Description protected int
functionDepth
The depth.protected int
index
The current index.protected boolean
inString
Indicates if we're inside a string.protected java.lang.String
src
The source string.protected char
stringQuote
The quote string, either "'" or "\"".
-
Constructor Summary
Constructors Constructor Description CssDeclarationValueTokenizer(java.lang.String propertyValue)
Creates a newCssDeclarationValueTokenizer
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CssDeclarationValueTokenizer.Token
getNextToken()
Gets the next token.CssDeclarationValueTokenizer.Token
getNextValidToken()
Gets the next valid token.private static boolean
isHexDigit(char c)
Checks if a character is a hexadecimal digit.private boolean
isSpaceNext()
protected CssDeclarationValueTokenizer.Token
parseFunctionToken(CssDeclarationValueTokenizer.Token token, int funcDepth)
Parse internal function token to full function token, e.g.private void
processFunctionToken(CssDeclarationValueTokenizer.Token token, java.lang.StringBuilder functionBuffer)
Processes a function token.
-
-
-
Field Detail
-
src
protected final java.lang.String src
The source string.
-
index
protected int index
The current index.
-
stringQuote
protected char stringQuote
The quote string, either "'" or "\"".
-
inString
protected boolean inString
Indicates if we're inside a string.
-
functionDepth
protected int functionDepth
The depth.
-
-
Constructor Detail
-
CssDeclarationValueTokenizer
public CssDeclarationValueTokenizer(java.lang.String propertyValue)
Creates a newCssDeclarationValueTokenizer
instance.- Parameters:
propertyValue
- the property value
-
-
Method Detail
-
getNextValidToken
public CssDeclarationValueTokenizer.Token getNextValidToken()
Gets the next valid token.- Returns:
- the next valid token
-
parseFunctionToken
protected CssDeclarationValueTokenizer.Token parseFunctionToken(CssDeclarationValueTokenizer.Token token, int funcDepth)
Parse internal function token to full function token, e.g.calc(calc(
tocalc(calc(50px + 5px) + 20px)
- Parameters:
token
- function token to expandfuncDepth
- function depth for resolving, e.g. if you want to resolve only nested function, not the whole declaration- Returns:
- expanded function token
-
getNextToken
protected CssDeclarationValueTokenizer.Token getNextToken()
Gets the next token.- Returns:
- the next token
-
isSpaceNext
private boolean isSpaceNext()
-
processFunctionToken
private void processFunctionToken(CssDeclarationValueTokenizer.Token token, java.lang.StringBuilder functionBuffer)
Processes a function token.- Parameters:
token
- the tokenfunctionBuffer
- the function buffer
-
isHexDigit
private static boolean isHexDigit(char c)
Checks if a character is a hexadecimal digit.- Parameters:
c
- the character- Returns:
- true, if it's a hexadecimal digit
-
-