OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_FXCRT_FX_BIDI_H_ | 7 #ifndef CORE_FXCRT_FX_BIDI_H_ |
8 #define CORE_FXCRT_FX_BIDI_H_ | 8 #define CORE_FXCRT_FX_BIDI_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 private: | 42 private: |
43 void StartNewSegment(CFX_BidiChar::Direction direction); | 43 void StartNewSegment(CFX_BidiChar::Direction direction); |
44 | 44 |
45 Segment m_CurrentSegment; | 45 Segment m_CurrentSegment; |
46 Segment m_LastSegment; | 46 Segment m_LastSegment; |
47 }; | 47 }; |
48 | 48 |
49 class CFX_BidiString { | 49 class CFX_BidiString { |
50 public: | 50 public: |
51 using const_iterator = std::vector<CFX_BidiChar::Segment>::const_iterator; | 51 using const_iterator = std::vector<CFX_BidiChar::Segment>::const_iterator; |
| 52 |
52 explicit CFX_BidiString(const CFX_WideString& str); | 53 explicit CFX_BidiString(const CFX_WideString& str); |
| 54 ~CFX_BidiString(); |
53 | 55 |
54 // Overall direction is always LEFT or RIGHT, never NEUTRAL. | 56 // Overall direction is always LEFT or RIGHT, never NEUTRAL. |
55 CFX_BidiChar::Direction OverallDirection() const { | 57 CFX_BidiChar::Direction OverallDirection() const { |
56 return m_eOverallDirection; | 58 return m_eOverallDirection; |
57 } | 59 } |
58 | 60 |
59 // Force the overall direction to be R2L regardless of what was detected. | 61 // Force the overall direction to be R2L regardless of what was detected. |
60 void SetOverallDirectionRight(); | 62 void SetOverallDirectionRight(); |
61 | 63 |
62 FX_WCHAR CharAt(size_t x) const { return m_Str[x]; } | 64 FX_WCHAR CharAt(size_t x) const { return m_Str[x]; } |
63 const_iterator begin() const { return m_Order.begin(); } | 65 const_iterator begin() const { return m_Order.begin(); } |
64 const_iterator end() const { return m_Order.end(); } | 66 const_iterator end() const { return m_Order.end(); } |
65 | 67 |
66 private: | 68 private: |
67 const CFX_WideString m_Str; | 69 const CFX_WideString m_Str; |
68 std::unique_ptr<CFX_BidiChar> m_pBidiChar; | 70 std::unique_ptr<CFX_BidiChar> m_pBidiChar; |
69 std::vector<CFX_BidiChar::Segment> m_Order; | 71 std::vector<CFX_BidiChar::Segment> m_Order; |
70 CFX_BidiChar::Direction m_eOverallDirection; | 72 CFX_BidiChar::Direction m_eOverallDirection; |
71 }; | 73 }; |
72 | 74 |
73 #endif // CORE_FXCRT_FX_BIDI_H_ | 75 #endif // CORE_FXCRT_FX_BIDI_H_ |
OLD | NEW |