• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "texgine/typography_types.h"
17 
18 #include <memory>
19 #include <variant>
20 
21 #include "texgine/any_span.h"
22 #include "texgine_exception.h"
23 #include "text_span.h"
24 
25 namespace OHOS {
26 namespace Rosen {
27 namespace TextEngine {
operator &(TextAlign a,TextAlign b)28 TextAlign operator&(TextAlign a, TextAlign b)
29 {
30     return static_cast<TextAlign>(static_cast<size_t>(a) & static_cast<size_t>(b));
31 }
32 
operator |(TextAlign a,TextAlign b)33 TextAlign operator|(TextAlign a, TextAlign b)
34 {
35     return static_cast<TextAlign>(static_cast<size_t>(a) | static_cast<size_t>(b));
36 }
37 
operator ^(TextAlign a,TextAlign b)38 TextAlign operator^(TextAlign a, TextAlign b)
39 {
40     return static_cast<TextAlign>(static_cast<size_t>(a) ^ static_cast<size_t>(b));
41 }
42 
operator ~(TextAlign a)43 TextAlign operator~(TextAlign a)
44 {
45     return static_cast<TextAlign>(~static_cast<size_t>(a));
46 }
47 
operator &=(TextAlign & a,const TextAlign & b)48 void operator&=(TextAlign &a, const TextAlign &b)
49 {
50     a = static_cast<TextAlign>(static_cast<size_t>(a) & static_cast<size_t>(b));
51 }
52 
operator |=(TextAlign & a,const TextAlign & b)53 void operator|=(TextAlign &a, const TextAlign &b)
54 {
55     a = static_cast<TextAlign>(static_cast<unsigned int>(a) | static_cast<unsigned int>(b));
56 }
57 
operator ^=(TextAlign & a,const TextAlign & b)58 void operator^=(TextAlign &a, const TextAlign &b)
59 {
60     a = static_cast<TextAlign>(static_cast<size_t>(a) ^ static_cast<size_t>(b));
61 }
62 
operator &(const TextDecoration & a,const TextDecoration & b)63 TextDecoration operator&(const TextDecoration &a, const TextDecoration &b)
64 {
65     return static_cast<enum TextDecoration>(static_cast<uint32_t>(a) & static_cast<uint32_t>(b));
66 }
67 
operator |(const TextDecoration & a,const TextDecoration & b)68 TextDecoration operator|(const TextDecoration &a, const TextDecoration &b)
69 {
70     return static_cast<enum TextDecoration>(static_cast<uint32_t>(a) | static_cast<uint32_t>(b));
71 }
72 
operator ^(const TextDecoration & a,const TextDecoration & b)73 TextDecoration operator^(const TextDecoration &a, const TextDecoration &b)
74 {
75     return static_cast<enum TextDecoration>(static_cast<uint32_t>(a) ^ static_cast<uint32_t>(b));
76 }
77 
operator +(const TextDecoration & a,const TextDecoration & b)78 TextDecoration operator+(const TextDecoration &a, const TextDecoration &b)
79 {
80     return static_cast<enum TextDecoration>(static_cast<int32_t>(a) + static_cast<int32_t>(b));
81 }
82 
operator &=(TextDecoration & a,const TextDecoration & b)83 void operator&=(TextDecoration &a, const TextDecoration &b)
84 {
85     a = static_cast<enum TextDecoration>(static_cast<uint32_t>(a) & static_cast<uint32_t>(b));
86 }
87 
operator |=(TextDecoration & a,const TextDecoration & b)88 void operator|=(TextDecoration &a, const TextDecoration &b)
89 {
90     a = static_cast<enum TextDecoration>(static_cast<uint32_t>(a) | static_cast<uint32_t>(b));
91 }
92 
operator ^=(TextDecoration & a,const TextDecoration & b)93 void operator^=(TextDecoration &a, const TextDecoration &b)
94 {
95     a = static_cast<enum TextDecoration>(static_cast<uint32_t>(a) ^ static_cast<uint32_t>(b));
96 }
97 
operator +=(TextDecoration & a,const TextDecoration & b)98 void operator+=(TextDecoration &a, const TextDecoration &b)
99 {
100     a = static_cast<enum TextDecoration>(static_cast<int32_t>(a) + static_cast<int32_t>(b));
101 }
102 } // namespace TextEngine
103 } // namespace Rosen
104 } // namespace OHOS
105