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

Side by Side Diff: third_party/WebKit/Source/wtf/text/TextPosition.h

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 12 matching lines...) Expand all
23 */ 23 */
24 24
25 #ifndef TextPosition_h 25 #ifndef TextPosition_h
26 #define TextPosition_h 26 #define TextPosition_h
27 27
28 #include "wtf/Allocator.h" 28 #include "wtf/Allocator.h"
29 #include "wtf/Assertions.h" 29 #include "wtf/Assertions.h"
30 #include "wtf/Vector.h" 30 #include "wtf/Vector.h"
31 #include "wtf/WTFExport.h" 31 #include "wtf/WTFExport.h"
32 #include "wtf/text/WTFString.h" 32 #include "wtf/text/WTFString.h"
33 #include <memory>
33 34
34 namespace WTF { 35 namespace WTF {
35 36
36 // An abstract number of element in a sequence. The sequence has a first element . 37 // An abstract number of element in a sequence. The sequence has a first element .
37 // This type should be used instead of integer because 2 contradicting tradition s can 38 // This type should be used instead of integer because 2 contradicting tradition s can
38 // call a first element '0' or '1' which makes integer type ambiguous. 39 // call a first element '0' or '1' which makes integer type ambiguous.
39 class OrdinalNumber final { 40 class OrdinalNumber final {
40 DISALLOW_NEW(); 41 DISALLOW_NEW();
41 public: 42 public:
42 static OrdinalNumber fromZeroBasedInt(int zeroBasedInt) { return OrdinalNumb er(zeroBasedInt); } 43 static OrdinalNumber fromZeroBasedInt(int zeroBasedInt) { return OrdinalNumb er(zeroBasedInt); }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // A value with line value less than a minimum; used as an impossible positi on. 80 // A value with line value less than a minimum; used as an impossible positi on.
80 static TextPosition belowRangePosition() { return TextPosition(OrdinalNumber ::beforeFirst(), OrdinalNumber::beforeFirst()); } 81 static TextPosition belowRangePosition() { return TextPosition(OrdinalNumber ::beforeFirst(), OrdinalNumber::beforeFirst()); }
81 82
82 // A value corresponding to a position with given offset within text having the specified line ending offsets. 83 // A value corresponding to a position with given offset within text having the specified line ending offsets.
83 WTF_EXPORT static TextPosition fromOffsetAndLineEndings(unsigned, const Vect or<unsigned>&); 84 WTF_EXPORT static TextPosition fromOffsetAndLineEndings(unsigned, const Vect or<unsigned>&);
84 85
85 OrdinalNumber m_line; 86 OrdinalNumber m_line;
86 OrdinalNumber m_column; 87 OrdinalNumber m_column;
87 }; 88 };
88 89
89 WTF_EXPORT PassOwnPtr<Vector<unsigned>> lineEndings(const String&); 90 WTF_EXPORT std::unique_ptr<Vector<unsigned>> lineEndings(const String&);
90 91
91 } // namespace WTF 92 } // namespace WTF
92 93
93 using WTF::OrdinalNumber; 94 using WTF::OrdinalNumber;
94 95
95 using WTF::TextPosition; 96 using WTF::TextPosition;
96 97
97 using WTF::lineEndings; 98 using WTF::lineEndings;
98 99
99 #endif // TextPosition_h 100 #endif // TextPosition_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/TextEncodingRegistry.cpp ('k') | third_party/WebKit/Source/wtf/text/TextPosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698