reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef SkParse_DEFINED |
| 18 | #define SkParse_DEFINED |
| 19 | |
| 20 | #include "SkColor.h" |
| 21 | #include "SkMath.h" |
| 22 | |
| 23 | class SkParse { |
| 24 | public: |
| 25 | static int Count(const char str[]); // number of scalars or int values |
| 26 | static int Count(const char str[], char separator); |
| 27 | static const char* FindColor(const char str[], SkColor* value); |
| 28 | static const char* FindHex(const char str[], uint32_t* value); |
| 29 | static const char* FindMSec(const char str[], SkMSec* value); |
| 30 | static const char* FindNamedColor(const char str[], size_t len, SkColor* color); |
| 31 | static const char* FindS32(const char str[], int32_t* value); |
| 32 | static const char* FindScalar(const char str[], SkScalar* value); |
| 33 | static const char* FindScalars(const char str[], SkScalar value[], int count); |
| 34 | |
| 35 | static bool FindBool(const char str[], bool* value); |
| 36 | // return the index of str in list[], or -1 if not found |
| 37 | static int FindList(const char str[], const char list[]); |
| 38 | #ifdef SK_SUPPORT_UNITTEST |
| 39 | static void TestColor(); |
| 40 | static void UnitTest(); |
| 41 | #endif |
| 42 | }; |
| 43 | |
| 44 | #endif |
| 45 | |