xref: /aosp_15_r20/development/tools/winscope/src/viewers/common/preset_hierarchy.ts (revision 90c8c64db3049935a07c6143d7fd006e26f8ecca)
1/*
2 * Copyright (C) 2024 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
17import {FilterFlag} from 'common/filter_flag';
18import {UserOptions} from 'viewers/common/user_options';
19import {RectShowState} from './rect_show_state';
20import {TextFilter} from './text_filter';
21
22export class TextFilterValues {
23  private constructor(
24    public filterString: string,
25    public flags: FilterFlag[],
26  ) {}
27
28  static fromTextFilter(textFilter: TextFilter) {
29    return new TextFilterValues(textFilter.filterString, textFilter.flags);
30  }
31}
32
33export interface PresetHierarchy {
34  hierarchyUserOptions: UserOptions;
35  hierarchyFilter: TextFilterValues;
36  propertiesUserOptions: UserOptions;
37  propertiesFilter: TextFilterValues;
38  rectsUserOptions?: UserOptions;
39  rectIdToShowState?: Map<string, RectShowState> | undefined;
40}
41