OLD | NEW |
1 /* | 1 /* |
2 *************************************************************************** | 2 *************************************************************************** |
3 * Copyright (C) 1999-2010 International Business Machines Corporation | 3 * Copyright (C) 1999-2010 International Business Machines Corporation |
4 * and others. All rights reserved. | 4 * and others. All rights reserved. |
5 *************************************************************************** | 5 *************************************************************************** |
6 */ | 6 */ |
7 // | 7 // |
8 // file: rbbi.c Contains the implementation of the rule based break iterato
r | 8 // file: rbbi.c Contains the implementation of the rule based break iterato
r |
9 // runtime engine and the API implementation for | 9 // runtime engine and the API implementation for |
10 // class RuleBasedBreakIterator | 10 // class RuleBasedBreakIterator |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 if (clonedBI == 0) { | 1497 if (clonedBI == 0) { |
1498 status = U_MEMORY_ALLOCATION_ERROR; | 1498 status = U_MEMORY_ALLOCATION_ERROR; |
1499 } else { | 1499 } else { |
1500 status = U_SAFECLONE_ALLOCATED_WARNING; | 1500 status = U_SAFECLONE_ALLOCATED_WARNING; |
1501 } | 1501 } |
1502 return clonedBI; | 1502 return clonedBI; |
1503 } | 1503 } |
1504 | 1504 |
1505 // | 1505 // |
1506 // Clone the source BI into the caller-supplied buffer. | 1506 // Clone the source BI into the caller-supplied buffer. |
1507 // TODO: using an overloaded operator new to directly initialize the | |
1508 // copy in the user's buffer would be better, but it doesn't seem | |
1509 // to get along with namespaces. Investigate why. | |
1510 // | 1507 // |
1511 // The memcpy is only safe with an empty (default constructed) | 1508 RuleBasedBreakIterator *clone = new(buf) RuleBasedBreakIterator(*this); |
1512 // break iterator. Use on others can screw up reference counts | |
1513 // to data. memcpy-ing objects is not really a good idea... | |
1514 // | |
1515 RuleBasedBreakIterator localIter; // Empty break iterator, source for
memcpy | |
1516 RuleBasedBreakIterator *clone = (RuleBasedBreakIterator *)buf; | |
1517 uprv_memcpy(clone, &localIter, sizeof(RuleBasedBreakIterator)); // init C++
gorp, BreakIterator base class part | |
1518 clone->init(); // Init RuleBasedBreakIterator part, (user def
ault constructor) | |
1519 *clone = *this; // clone = the real BI we want. | |
1520 clone->fBufferClone = TRUE; // Flag to prevent deleting storage on close (
From C code) | 1509 clone->fBufferClone = TRUE; // Flag to prevent deleting storage on close (
From C code) |
1521 | 1510 |
1522 return clone; | 1511 return clone; |
1523 } | 1512 } |
1524 | 1513 |
1525 | 1514 |
1526 //------------------------------------------------------------------------------
- | 1515 //------------------------------------------------------------------------------
- |
1527 // | 1516 // |
1528 // isDictionaryChar Return true if the category lookup for this char | 1517 // isDictionaryChar Return true if the category lookup for this char |
1529 // indicates that it is in the set of dictionary lookup | 1518 // indicates that it is in the set of dictionary lookup |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 }*/ | 1861 }*/ |
1873 | 1862 |
1874 void RuleBasedBreakIterator::setBreakType(int32_t type) { | 1863 void RuleBasedBreakIterator::setBreakType(int32_t type) { |
1875 fBreakType = type; | 1864 fBreakType = type; |
1876 reset(); | 1865 reset(); |
1877 } | 1866 } |
1878 | 1867 |
1879 U_NAMESPACE_END | 1868 U_NAMESPACE_END |
1880 | 1869 |
1881 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ | 1870 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ |
OLD | NEW |