1 /* libs/graphics/animator/SkDisplayInclude.cpp
2 **
3 ** Copyright 2006, The Android Open Source Project
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17
18 #include "SkDisplayInclude.h"
19 #include "SkAnimateMaker.h"
20 #include "SkAnimator.h"
21
22 #if 0
23 #undef SK_MEMBER
24 #define SK_MEMBER(_member, _type) \
25 { #_member, SK_OFFSETOF(BASE_CLASS::_A, _member), SkType_##_type, \
26 sizeof(((BASE_CLASS::_A*) 0)->_member) / sizeof(SkScalar) }
27 #endif
28
29 #if SK_USE_CONDENSED_INFO == 0
30
31 const SkMemberInfo SkInclude::fInfo[] = {
32 SK_MEMBER(src, String)
33 };
34
35 #endif
36
37 DEFINE_GET_MEMBER(SkInclude);
38
39 //SkInclude::SkInclude() {
40 // src.init();
41 //}
42
43 //SkInclude::~SkInclude() {
44 // src.unref();
45 //}
46
enable(SkAnimateMaker &)47 bool SkInclude::enable(SkAnimateMaker & ) {
48 return true;
49 }
50
hasEnable() const51 bool SkInclude::hasEnable() const {
52 return true;
53 }
54
onEndElement(SkAnimateMaker & maker)55 void SkInclude::onEndElement(SkAnimateMaker& maker) {
56 maker.fInInclude = true;
57 if (src.size() == 0 || maker.decodeURI(src.c_str()) == false) {
58 if (maker.getErrorCode() != SkXMLParserError::kNoError || maker.getNativeCode() != -1) {
59 maker.setInnerError(&maker, src);
60 maker.setErrorCode(SkDisplayXMLParserError::kInInclude);
61 } else {
62 maker.setErrorNoun(src);
63 maker.setErrorCode(SkDisplayXMLParserError::kIncludeNameUnknownOrMissing);
64 }
65 }
66 maker.fInInclude = false;
67 }
68