]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/dbbi_tbl.h
ICU-6.2.22.tar.gz
[apple/icu.git] / icuSources / common / dbbi_tbl.h
CommitLineData
b75a7d8f
A
1/*
2**********************************************************************
3* Copyright (C) 1999-2000 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**********************************************************************
9*/
10
11#ifndef DBBI_TBL_H
12#define DBBI_TBL_H
13
14#include "unicode/utypes.h"
15#include "unicode/uobject.h"
16#include "unicode/udata.h"
17#include "brkdict.h"
18
19U_NAMESPACE_BEGIN
20
21/* forward declaration */
22class DictionaryBasedBreakIterator;
23
24//
25// DictionaryBasedBreakIteratorTables
26//
27// This class sits between instances of DictionaryBasedBreakIterator
28// and the dictionary data itself, which is of type BreakDictionary.
29// It provides reference counting, allowing multiple copies of a
30// DictionaryBasedBreakIterator to share a single instance of
31// BreakDictionary.
32//
33// TODO: it'd probably be cleaner to add the reference counting to
34// BreakDictionary and get rid of this class, but doing it this way
35// was a convenient transition from earlier code, and time is short...
36//
37class DictionaryBasedBreakIteratorTables : public UMemory {
38
39private:
40 int32_t fRefCount;
41
42
43public:
44 //=======================================================================
45 // constructor
46 //=======================================================================
47 /* @param dictionaryFilename The name of the dictionary file
48 * @param status The error code
49 * @return the newly created DictionaryBasedBreakIteratorTables
50 **/
51 DictionaryBasedBreakIteratorTables(const char* dictionaryFilename,
52 UErrorCode& status);
53
54 BreakDictionary *fDictionary;
55 void addReference();
56 void removeReference();
57 /**
58 * Destructor. Should not be used directly. Use removeReference() istead.
59 * (Not private to avoid compiler warnings.)
60 */
61 virtual ~DictionaryBasedBreakIteratorTables();
62
63private:
64 /**
65 * The copy constructor is declared private and not implemented.
66 * THIS CLASS MAY NOT BE COPIED.
67 * @param that The DictionaryBasedBreakIteratorTables to be copied.
68 * @return the newly constructed DictionaryBasedBreakIteratorTables.
69 */
70 DictionaryBasedBreakIteratorTables(const DictionaryBasedBreakIteratorTables& that);
71
72 //=======================================================================
73 // boilerplate
74 //=======================================================================
75
76
77 /**
78 * The assignment operator is declared private and not implemented.
79 * THIS CLASS MAY NOT BE COPIED.
80 * Call addReference() and share an existing copy instead.
81 * @that The object to be copied
82 * @return the newly created DictionaryBasedBreakIteratorTables.
83 */
84 DictionaryBasedBreakIteratorTables& operator=(
85 const DictionaryBasedBreakIteratorTables& that);
86};
87
88U_NAMESPACE_END
89
90#endif