Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1845)

Unified Diff: core/include/fxcrt/fx_bidi.h

Issue 1825953002: Move core/include/fxcrt to core/fxcrt/include. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/include/fxcrt/fx_basic.h ('k') | core/include/fxcrt/fx_coordinates.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/include/fxcrt/fx_bidi.h
diff --git a/core/include/fxcrt/fx_bidi.h b/core/include/fxcrt/fx_bidi.h
deleted file mode 100644
index 4ea17dae861badc6922ad8b5f7a7b97adba14326..0000000000000000000000000000000000000000
--- a/core/include/fxcrt/fx_bidi.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_INCLUDE_FXCRT_FX_BIDI_H_
-#define CORE_INCLUDE_FXCRT_FX_BIDI_H_
-
-#include <memory>
-#include <vector>
-
-#include "core/include/fxcrt/fx_string.h"
-#include "core/include/fxcrt/fx_system.h"
-
-// Processes characters and group them into segments based on text direction.
-class CFX_BidiChar {
- public:
- enum Direction { NEUTRAL, LEFT, RIGHT };
- struct Segment {
- int32_t start; // Start position.
- int32_t count; // Character count.
- Direction direction; // Segment direction.
- };
-
- CFX_BidiChar();
-
- // Append a character and classify it as left, right, or neutral.
- // Returns true if the character has a different direction than the
- // existing direction to indicate there is a segment to process.
- bool AppendChar(FX_WCHAR wch);
-
- // Call this after the last character has been appended. AppendChar()
- // must not be called after this.
- // Returns true if there is still a segment to process.
- bool EndChar();
-
- // Call after a change in direction is indicated by the above to get
- // information about the segment to process.
- Segment GetSegmentInfo() const { return m_LastSegment; }
-
- private:
- void StartNewSegment(CFX_BidiChar::Direction direction);
-
- Segment m_CurrentSegment;
- Segment m_LastSegment;
-};
-
-class CFX_BidiString {
- public:
- using const_iterator = std::vector<CFX_BidiChar::Segment>::const_iterator;
- explicit CFX_BidiString(const CFX_WideString& str);
-
- // Overall direction is always LEFT or RIGHT, never NEUTRAL.
- CFX_BidiChar::Direction OverallDirection() const {
- return m_eOverallDirection;
- }
-
- // Force the overall direction to be R2L regardless of what was detected.
- void SetOverallDirectionRight();
-
- FX_WCHAR CharAt(size_t x) const { return m_Str[x]; }
- const_iterator begin() const { return m_Order.begin(); }
- const_iterator end() const { return m_Order.end(); }
-
- private:
- const CFX_WideString m_Str;
- std::unique_ptr<CFX_BidiChar> m_pBidiChar;
- std::vector<CFX_BidiChar::Segment> m_Order;
- CFX_BidiChar::Direction m_eOverallDirection;
-};
-
-#endif // CORE_INCLUDE_FXCRT_FX_BIDI_H_
« no previous file with comments | « core/include/fxcrt/fx_basic.h ('k') | core/include/fxcrt/fx_coordinates.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698