aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/i18n/fpositer.cpp
diff options
context:
space:
mode:
authorneksard <neksard@yandex-team.ru>2022-02-10 16:45:33 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:33 +0300
commit1d9c550e7c38e051d7961f576013a482003a70d9 (patch)
treeb2cc84ee7850122e7ccf51d0ea21e4fa7e7a5685 /contrib/libs/icu/i18n/fpositer.cpp
parent8f7cf138264e0caa318144bf8a2c950e0b0a8593 (diff)
downloadydb-1d9c550e7c38e051d7961f576013a482003a70d9.tar.gz
Restoring authorship annotation for <neksard@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/icu/i18n/fpositer.cpp')
-rw-r--r--contrib/libs/icu/i18n/fpositer.cpp218
1 files changed, 109 insertions, 109 deletions
diff --git a/contrib/libs/icu/i18n/fpositer.cpp b/contrib/libs/icu/i18n/fpositer.cpp
index 6b6cf363c6..75d529eb8c 100644
--- a/contrib/libs/icu/i18n/fpositer.cpp
+++ b/contrib/libs/icu/i18n/fpositer.cpp
@@ -1,114 +1,114 @@
// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-* Copyright (C) 2009-2012, International Business Machines Corporation and
-* others. All Rights Reserved.
-******************************************************************************
-* Date Name Description
-* 12/14/09 doug Creation.
-******************************************************************************
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/fpositer.h"
-#include "cmemory.h"
-#include "uvectr32.h"
-
-U_NAMESPACE_BEGIN
-
-FieldPositionIterator::~FieldPositionIterator() {
- delete data;
- data = NULL;
- pos = -1;
-}
-
-FieldPositionIterator::FieldPositionIterator()
- : data(NULL), pos(-1) {
-}
-
-FieldPositionIterator::FieldPositionIterator(const FieldPositionIterator &rhs)
- : UObject(rhs), data(NULL), pos(rhs.pos) {
-
- if (rhs.data) {
- UErrorCode status = U_ZERO_ERROR;
- data = new UVector32(status);
- data->assign(*rhs.data, status);
- if (status != U_ZERO_ERROR) {
- delete data;
- data = NULL;
- pos = -1;
- }
- }
-}
-
-UBool FieldPositionIterator::operator==(const FieldPositionIterator &rhs) const {
- if (&rhs == this) {
- return TRUE;
- }
- if (pos != rhs.pos) {
- return FALSE;
- }
- if (!data) {
- return rhs.data == NULL;
- }
- return rhs.data ? data->operator==(*rhs.data) : FALSE;
-}
-
-void FieldPositionIterator::setData(UVector32 *adopt, UErrorCode& status) {
- // Verify that adopt has valid data, and update status if it doesn't.
- if (U_SUCCESS(status)) {
- if (adopt) {
- if (adopt->size() == 0) {
- delete adopt;
- adopt = NULL;
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+* Copyright (C) 2009-2012, International Business Machines Corporation and
+* others. All Rights Reserved.
+******************************************************************************
+* Date Name Description
+* 12/14/09 doug Creation.
+******************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/fpositer.h"
+#include "cmemory.h"
+#include "uvectr32.h"
+
+U_NAMESPACE_BEGIN
+
+FieldPositionIterator::~FieldPositionIterator() {
+ delete data;
+ data = NULL;
+ pos = -1;
+}
+
+FieldPositionIterator::FieldPositionIterator()
+ : data(NULL), pos(-1) {
+}
+
+FieldPositionIterator::FieldPositionIterator(const FieldPositionIterator &rhs)
+ : UObject(rhs), data(NULL), pos(rhs.pos) {
+
+ if (rhs.data) {
+ UErrorCode status = U_ZERO_ERROR;
+ data = new UVector32(status);
+ data->assign(*rhs.data, status);
+ if (status != U_ZERO_ERROR) {
+ delete data;
+ data = NULL;
+ pos = -1;
+ }
+ }
+}
+
+UBool FieldPositionIterator::operator==(const FieldPositionIterator &rhs) const {
+ if (&rhs == this) {
+ return TRUE;
+ }
+ if (pos != rhs.pos) {
+ return FALSE;
+ }
+ if (!data) {
+ return rhs.data == NULL;
+ }
+ return rhs.data ? data->operator==(*rhs.data) : FALSE;
+}
+
+void FieldPositionIterator::setData(UVector32 *adopt, UErrorCode& status) {
+ // Verify that adopt has valid data, and update status if it doesn't.
+ if (U_SUCCESS(status)) {
+ if (adopt) {
+ if (adopt->size() == 0) {
+ delete adopt;
+ adopt = NULL;
} else if ((adopt->size() % 4) != 0) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- } else {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ } else {
for (int i = 2; i < adopt->size(); i += 4) {
- if (adopt->elementAti(i) >= adopt->elementAti(i+1)) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- }
- }
- }
- }
-
- // We own the data, even if status is in error, so we need to delete it now
- // if we're not keeping track of it.
- if (!U_SUCCESS(status)) {
- delete adopt;
- return;
- }
-
- delete data;
- data = adopt;
- pos = adopt == NULL ? -1 : 0;
-}
-
-UBool FieldPositionIterator::next(FieldPosition& fp) {
- if (pos == -1) {
- return FALSE;
- }
-
+ if (adopt->elementAti(i) >= adopt->elementAti(i+1)) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // We own the data, even if status is in error, so we need to delete it now
+ // if we're not keeping track of it.
+ if (!U_SUCCESS(status)) {
+ delete adopt;
+ return;
+ }
+
+ delete data;
+ data = adopt;
+ pos = adopt == NULL ? -1 : 0;
+}
+
+UBool FieldPositionIterator::next(FieldPosition& fp) {
+ if (pos == -1) {
+ return FALSE;
+ }
+
// Ignore the first element of the tetrad: used for field category
pos++;
- fp.setField(data->elementAti(pos++));
- fp.setBeginIndex(data->elementAti(pos++));
- fp.setEndIndex(data->elementAti(pos++));
-
- if (pos == data->size()) {
- pos = -1;
- }
-
- return TRUE;
-}
-
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
+ fp.setField(data->elementAti(pos++));
+ fp.setBeginIndex(data->elementAti(pos++));
+ fp.setEndIndex(data->elementAti(pos++));
+
+ if (pos == data->size()) {
+ pos = -1;
+ }
+
+ return TRUE;
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+