2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.Collections.Generic;
19 using System.ComponentModel;
21 namespace Tizen.NUI.EXaml
23 internal static class LoadEXaml
25 internal static GlobalDataList GatherDataList(string xaml)
27 var globalDataList = new GlobalDataList();
29 Action currentAction = new RootAction(globalDataList);
30 var rootAction = currentAction;
34 for (; index < xaml.Length; index++)
38 if (currentAction == rootAction && '/' == c)
44 currentAction = currentAction.DealChar(c);
48 for (index++; index < xaml.Length; index++)
50 globalDataList.LongStrings += xaml[index];
53 foreach (var op in globalDataList.PreLoadOperations)
58 return globalDataList;
61 internal static void Load(object view, string xaml, out GlobalDataList xamlData)
63 var globalDataList = GatherDataList(xaml);
65 globalDataList.Root = view;
67 foreach (var op in globalDataList.Operations)
72 xamlData = globalDataList;
75 internal static void Load(object view, object preloadData)
77 var globalDataList = preloadData as GlobalDataList;
79 if (null == globalDataList)
84 globalDataList.Root = view;
86 foreach (var op in globalDataList.Operations)
92 internal static void RemoveEventsInXaml(object eXamlData)
94 if (eXamlData is GlobalDataList globalDataList)
96 foreach (var op in globalDataList.RemoveEventOperations)