1 /*
2 * Copyright 2019 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 #pragma once
18
19 #include <cstdint>
20 #include <string>
21 #include <type_traits>
22
23 #include <math/mat4.h>
24 #include <ui/FloatRect.h>
25 #include <ui/Rect.h>
26 #include <ui/Region.h>
27 #include <ui/Transform.h>
28
29 namespace android::compositionengine::impl {
30
31 void dumpVal(std::string& out, const char* name, bool);
32 void dumpVal(std::string& out, const char* name, const void*);
33 void dumpVal(std::string& out, const char* name, int);
34 void dumpVal(std::string& out, const char* name, float);
35 void dumpVal(std::string& out, const char* name, uint32_t);
36 void dumpHex(std::string& out, const char* name, uint64_t);
37 void dumpVal(std::string& out, const char* name, const char* value);
38 void dumpVal(std::string& out, const char* name, const std::string& value);
39
40 // For enums with named values
41 void dumpVal(std::string& out, const char* name, const char*, int);
42 void dumpVal(std::string& out, const char* name, const std::string&, int);
43
44 template <typename EnumType>
dumpVal(std::string & out,const char * name,const char * valueName,EnumType value)45 void dumpVal(std::string& out, const char* name, const char* valueName, EnumType value) {
46 dumpVal(out, name, valueName, static_cast<std::underlying_type_t<EnumType>>(value));
47 }
48
49 template <typename EnumType>
dumpVal(std::string & out,const char * name,const std::string & valueName,EnumType value)50 void dumpVal(std::string& out, const char* name, const std::string& valueName, EnumType value) {
51 dumpVal(out, name, valueName, static_cast<std::underlying_type_t<EnumType>>(value));
52 }
53
54 void dumpVal(std::string& out, const char* name, const FloatRect& rect);
55 void dumpVal(std::string& out, const char* name, const Rect& rect);
56 void dumpVal(std::string& out, const char* name, const Region& region);
57 void dumpVal(std::string& out, const char* name, const ui::Transform&);
58 void dumpVal(std::string& out, const char* name, const ui::Size&);
59
60 void dumpVal(std::string& out, const char* name, const mat4& tr);
61
62 } // namespace android::compositionengine::impl
63