Skip to content

Commit 8eeb581

Browse files
committed
Use internal keyword for functions in the internal package
1 parent 6516c51 commit 8eeb581

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

src/commonImplementation/kotlin/CodePoints.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ import de.cketti.codepoints.internal.toChars as commonToChars
1313
import de.cketti.codepoints.internal.toCodePoint as commonToCodePoint
1414

1515
actual object CodePoints {
16-
actual inline fun isValidCodePoint(codePoint: Int): Boolean {
16+
actual fun isValidCodePoint(codePoint: Int): Boolean {
1717
return commonIsValidCodePoint(codePoint)
1818
}
1919

20-
actual inline fun isBmpCodePoint(codePoint: Int): Boolean {
20+
actual fun isBmpCodePoint(codePoint: Int): Boolean {
2121
return commonIsBmpCodePoint(codePoint)
2222
}
2323

24-
actual inline fun isSupplementaryCodePoint(codePoint: Int): Boolean {
24+
actual fun isSupplementaryCodePoint(codePoint: Int): Boolean {
2525
return commonIsSupplementaryCodePoint(codePoint)
2626
}
2727

28-
actual inline fun charCount(codePoint: Int): Int {
28+
actual fun charCount(codePoint: Int): Int {
2929
return commonCharCount(codePoint)
3030
}
3131

32-
actual inline fun isSurrogatePair(highSurrogate: Char, lowSurrogate: Char): Boolean {
32+
actual fun isSurrogatePair(highSurrogate: Char, lowSurrogate: Char): Boolean {
3333
return commonIsSurrogatePair(highSurrogate, lowSurrogate)
3434
}
3535

@@ -41,15 +41,15 @@ actual object CodePoints {
4141
return commonLowSurrogate(codePoint)
4242
}
4343

44-
actual inline fun toCodePoint(highSurrogate: Char, lowSurrogate: Char): Int {
44+
actual fun toCodePoint(highSurrogate: Char, lowSurrogate: Char): Int {
4545
return commonToCodePoint(highSurrogate, lowSurrogate)
4646
}
4747

48-
actual inline fun toChars(codePoint: Int): CharArray {
48+
actual fun toChars(codePoint: Int): CharArray {
4949
return commonToChars(codePoint)
5050
}
5151

52-
actual inline fun toChars(codePoint: Int, destination: CharArray, offset: Int): Int {
52+
actual fun toChars(codePoint: Int, destination: CharArray, offset: Int): Int {
5353
return commonToChars(codePoint, destination, offset)
5454
}
5555
}

src/commonImplementation/kotlin/StringExtensions.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ import de.cketti.codepoints.internal.codePointBefore as commonCodePointBefore
77
import de.cketti.codepoints.internal.codePointCount as commonCodePointCount
88
import de.cketti.codepoints.internal.offsetByCodePoints as commonOffsetByCodePoints
99

10-
actual inline fun String.codePointAt(index: Int): Int {
10+
actual fun String.codePointAt(index: Int): Int {
1111
return commonCodePointAt(this, index)
1212
}
1313

14-
actual inline fun String.codePointBefore(index: Int): Int {
14+
actual fun String.codePointBefore(index: Int): Int {
1515
return commonCodePointBefore(this, index)
1616
}
1717

18-
actual inline fun String.codePointCount(beginIndex: Int, endIndex: Int): Int {
18+
actual fun String.codePointCount(beginIndex: Int, endIndex: Int): Int {
1919
return commonCodePointCount(this, beginIndex, endIndex)
2020
}
2121

22-
actual inline fun String.offsetByCodePoints(index: Int, codePointOffset: Int): Int {
22+
actual fun String.offsetByCodePoints(index: Int, codePointOffset: Int): Int {
2323
return commonOffsetByCodePoints(this, index, codePointOffset)
2424
}

src/commonImplementation/kotlin/internal/CommonCodePoints.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,47 @@ private const val SURROGATE_DECODE_OFFSET =
1212
private const val HIGH_SURROGATE_ENCODE_OFFSET =
1313
(MIN_HIGH_SURROGATE - (MIN_SUPPLEMENTARY_CODE_POINT ushr 10))
1414

15-
fun isValidCodePoint(codePoint: Int): Boolean {
15+
internal fun isValidCodePoint(codePoint: Int): Boolean {
1616
return codePoint in 0..MAX_CODE_POINT
1717
}
1818

19-
fun isBmpCodePoint(codePoint: Int): Boolean {
19+
internal fun isBmpCodePoint(codePoint: Int): Boolean {
2020
return codePoint ushr 16 == 0
2121
}
2222

23-
fun isSupplementaryCodePoint(codePoint: Int): Boolean {
23+
internal fun isSupplementaryCodePoint(codePoint: Int): Boolean {
2424
return codePoint in MIN_SUPPLEMENTARY_CODE_POINT..MAX_CODE_POINT
2525
}
2626

27-
fun charCount(codePoint: Int): Int {
27+
internal fun charCount(codePoint: Int): Int {
2828
return if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) 1 else 2
2929
}
3030

31-
fun isSurrogatePair(highSurrogate: Char, lowSurrogate: Char): Boolean {
31+
internal fun isSurrogatePair(highSurrogate: Char, lowSurrogate: Char): Boolean {
3232
return highSurrogate.isHighSurrogate() && lowSurrogate.isLowSurrogate()
3333
}
3434

35-
fun highSurrogate(codePoint: Int): Char {
35+
internal fun highSurrogate(codePoint: Int): Char {
3636
return ((codePoint ushr 10) + HIGH_SURROGATE_ENCODE_OFFSET).toChar()
3737
}
3838

39-
fun lowSurrogate(codePoint: Int): Char {
39+
internal fun lowSurrogate(codePoint: Int): Char {
4040
return ((codePoint and 0x3FF) + MIN_LOW_SURROGATE).toChar()
4141
}
4242

43-
fun toCodePoint(highSurrogate: Char, lowSurrogate: Char): Int {
43+
internal fun toCodePoint(highSurrogate: Char, lowSurrogate: Char): Int {
4444
return (highSurrogate.code shl 10) + lowSurrogate.code + SURROGATE_DECODE_OFFSET
4545
}
4646

47-
fun toChars(codePoint: Int): CharArray {
47+
internal fun toChars(codePoint: Int): CharArray {
4848
return if (isBmpCodePoint(codePoint)) {
4949
charArrayOf(codePoint.toChar())
5050
} else {
5151
charArrayOf(highSurrogate(codePoint), lowSurrogate(codePoint))
5252
}
5353
}
5454

55-
fun toChars(codePoint: Int, destination: CharArray, offset: Int): Int {
55+
internal fun toChars(codePoint: Int, destination: CharArray, offset: Int): Int {
5656
if (isBmpCodePoint(codePoint)) {
5757
destination.setSafe(offset, codePoint.toChar())
5858
return 1

src/commonImplementation/kotlin/internal/CommonStringBuilderFunctions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package de.cketti.codepoints.internal
22

33
import de.cketti.codepoints.CodePoints
44

5-
fun appendCodePoint(builder: StringBuilder, codePoint: Int) {
5+
internal fun appendCodePoint(builder: StringBuilder, codePoint: Int) {
66
if (CodePoints.isBmpCodePoint(codePoint)) {
77
builder.append(codePoint.toChar())
88
} else {

src/commonImplementation/kotlin/internal/CommonStringFunctions.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package de.cketti.codepoints.internal
22

3-
fun codePointAt(text: String, index: Int): Int {
3+
internal fun codePointAt(text: String, index: Int): Int {
44
if (index !in text.indices) throw IndexOutOfBoundsException()
55

66
val firstChar = text[index]
@@ -14,7 +14,7 @@ fun codePointAt(text: String, index: Int): Int {
1414
return firstChar.code
1515
}
1616

17-
fun codePointBefore(text: String, index: Int): Int {
17+
internal fun codePointBefore(text: String, index: Int): Int {
1818
val startIndex = index - 1
1919
if (startIndex !in text.indices) throw IndexOutOfBoundsException()
2020

@@ -29,7 +29,7 @@ fun codePointBefore(text: String, index: Int): Int {
2929
return firstChar.code
3030
}
3131

32-
fun codePointCount(text: String, beginIndex: Int, endIndex: Int): Int {
32+
internal fun codePointCount(text: String, beginIndex: Int, endIndex: Int): Int {
3333
if (beginIndex < 0 || endIndex > text.length || beginIndex > endIndex) throw IndexOutOfBoundsException()
3434

3535
var index = beginIndex
@@ -50,7 +50,7 @@ fun codePointCount(text: String, beginIndex: Int, endIndex: Int): Int {
5050
return count
5151
}
5252

53-
fun offsetByCodePoints(text: String, index: Int, codePointOffset: Int): Int {
53+
internal fun offsetByCodePoints(text: String, index: Int, codePointOffset: Int): Int {
5454
if (index !in 0..text.length) throw IndexOutOfBoundsException()
5555
if (codePointOffset == 0) return index
5656

0 commit comments

Comments
 (0)