]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /* |
2 | ********************************************************************** | |
3 | * Copyright (C) 1999-2002 IBM Corp. All rights reserved. | |
4 | ********************************************************************** | |
5 | * Date Name Description | |
6 | * 12/1/99 rgillam Complete port from Java. | |
7 | * 01/13/2000 helena Added UErrorCode to ctors. | |
8 | * 06/14/2002 andy Gutted for new RBBI impl. | |
9 | ********************************************************************** | |
10 | */ | |
11 | ||
12 | #include "unicode/utypes.h" | |
13 | ||
14 | #if !UCONFIG_NO_BREAK_ITERATION | |
15 | ||
16 | #include "dbbi_tbl.h" | |
17 | #include "unicode/dbbi.h" | |
18 | #include "umutex.h" | |
19 | ||
20 | U_NAMESPACE_BEGIN | |
21 | ||
22 | //======================================================================= | |
23 | // constructor | |
24 | //======================================================================= | |
25 | ||
26 | DictionaryBasedBreakIteratorTables::DictionaryBasedBreakIteratorTables( | |
27 | const char* dictionaryFilename, | |
28 | UErrorCode &status) { | |
29 | fDictionary = new BreakDictionary(dictionaryFilename, status); | |
30 | fRefCount = 1; | |
31 | } | |
32 | ||
33 | ||
34 | void DictionaryBasedBreakIteratorTables::addReference() { | |
35 | umtx_atomic_inc(&fRefCount); | |
36 | } | |
37 | ||
38 | ||
39 | void DictionaryBasedBreakIteratorTables::removeReference() { | |
40 | if (umtx_atomic_dec(&fRefCount) == 0) { | |
41 | delete this; | |
42 | } | |
43 | } | |
44 | ||
45 | ||
46 | /** | |
47 | * Destructor | |
48 | */ | |
49 | DictionaryBasedBreakIteratorTables::~DictionaryBasedBreakIteratorTables() { | |
50 | delete fDictionary; | |
51 | fDictionary = NULL; | |
52 | } | |
53 | ||
54 | ||
55 | U_NAMESPACE_END | |
56 | ||
57 | #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ | |
58 | ||
59 | /* eof */ |