Flutter Engine
The Flutter Engine
Functions
SkParse.cpp File Reference
#include "include/core/SkScalar.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkTo.h"
#include "include/utils/SkParse.h"
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <limits>
#include <string>

Go to the source code of this file.

Functions

static bool is_between (int c, int min, int max)
 
static bool is_ws (int c)
 
static bool is_digit (int c)
 
static bool is_sep (int c)
 
static int to_hex (int c)
 
static bool is_hex (int c)
 
static const char * skip_ws (const char str[])
 
static const char * skip_sep (const char str[])
 
static bool lookup_str (const char str[], const char **table, int count)
 

Function Documentation

◆ is_between()

static bool is_between ( int  c,
int  min,
int  max 
)
inlinestatic

Definition at line 19 of file SkParse.cpp.

20{
21 return (unsigned)(c - min) <= (unsigned)(max - min);
22}
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48

◆ is_digit()

static bool is_digit ( int  c)
inlinestatic

Definition at line 29 of file SkParse.cpp.

30{
31 return is_between(c, '0', '9');
32}
static bool is_between(int c, int min, int max)
Definition: SkParse.cpp:19

◆ is_hex()

static bool is_hex ( int  c)
inlinestatic

Definition at line 51 of file SkParse.cpp.

52{
53 return to_hex(c) >= 0;
54}
static int to_hex(int c)
Definition: SkParse.cpp:39

◆ is_sep()

static bool is_sep ( int  c)
inlinestatic

Definition at line 34 of file SkParse.cpp.

35{
36 return is_ws(c) || c == ',' || c == ';';
37}
static bool is_ws(int c)
Definition: SkParse.cpp:24

◆ is_ws()

static bool is_ws ( int  c)
inlinestatic

Definition at line 24 of file SkParse.cpp.

25{
26 return is_between(c, 1, 32);
27}

◆ lookup_str()

static bool lookup_str ( const char  str[],
const char **  table,
int  count 
)
static

Definition at line 252 of file SkParse.cpp.

253{
254 while (--count >= 0)
255 if (!strcmp(str, table[count]))
256 return true;
257 return false;
258}
int count
Definition: FontMgrTest.cpp:50
SI F table(const skcms_Curve *curve, F v)

◆ skip_sep()

static const char * skip_sep ( const char  str[])
static

Definition at line 64 of file SkParse.cpp.

65{
66 SkASSERT(str);
67 while (is_sep(*str))
68 str++;
69 return str;
70}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static bool is_sep(int c)
Definition: SkParse.cpp:34

◆ skip_ws()

static const char * skip_ws ( const char  str[])
static

Definition at line 56 of file SkParse.cpp.

57{
58 SkASSERT(str);
59 while (is_ws(*str))
60 str++;
61 return str;
62}

◆ to_hex()

static int to_hex ( int  c)
static

Definition at line 39 of file SkParse.cpp.

40{
41 if (is_digit(c))
42 return c - '0';
43
44 c |= 0x20; // make us lower-case
45 if (is_between(c, 'a', 'f'))
46 return c + 10 - 'a';
47 else
48 return -1;
49}
static bool is_digit(int c)
Definition: SkParse.cpp:29