2000-01-08 02:05:05 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
2000-01-14 00:13:59 +00:00
|
|
|
* Copyright (C) 1999-2000 IBM Corp. All rights reserved.
|
2000-01-08 02:05:05 +00:00
|
|
|
**********************************************************************
|
|
|
|
* Date Name Description
|
|
|
|
* 12/1/99 rgillam Complete port from Java.
|
2000-01-14 00:13:59 +00:00
|
|
|
* 01/13/2000 helena Added UErrorCode to ctors.
|
2000-01-08 02:05:05 +00:00
|
|
|
**********************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DBBI_TBL_H
|
|
|
|
#define DBBI_TBL_H
|
|
|
|
|
2002-06-27 01:19:20 +00:00
|
|
|
#include "unicode/utypes.h"
|
|
|
|
#include "unicode/uobject.h"
|
2000-07-12 05:01:53 +00:00
|
|
|
#include "unicode/udata.h"
|
2002-06-27 01:19:20 +00:00
|
|
|
#include "brkdict.h"
|
2000-01-08 02:05:05 +00:00
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2000-01-18 19:57:46 +00:00
|
|
|
/* forward declaration */
|
|
|
|
class DictionaryBasedBreakIterator;
|
|
|
|
|
2002-06-25 17:23:07 +00:00
|
|
|
//
|
|
|
|
// DictionaryBasedBreakIteratorTables
|
|
|
|
//
|
|
|
|
// This class sits between instances of DictionaryBasedBreakIterator
|
|
|
|
// and the dictionary data itself, which is of type BreakDictionary.
|
|
|
|
// It provides reference counting, allowing multiple copies of a
|
|
|
|
// DictionaryBasedBreakIterator to share a single instance of
|
|
|
|
// BreakDictionary.
|
|
|
|
//
|
|
|
|
// TODO: it'd probably be cleaner to add the reference counting to
|
|
|
|
// BreakDictionary and get rid of this class, but doing it this way
|
|
|
|
// was a convenient transition from earlier code, and time is short...
|
|
|
|
//
|
2002-06-27 01:19:20 +00:00
|
|
|
class DictionaryBasedBreakIteratorTables : public UObject {
|
2000-01-08 02:05:05 +00:00
|
|
|
|
|
|
|
private:
|
2002-06-25 17:23:07 +00:00
|
|
|
int32_t fRefCount;
|
2000-01-08 02:05:05 +00:00
|
|
|
|
|
|
|
|
2002-06-25 17:23:07 +00:00
|
|
|
public:
|
2000-01-08 02:05:05 +00:00
|
|
|
//=======================================================================
|
|
|
|
// constructor
|
|
|
|
//=======================================================================
|
2002-07-03 12:05:56 +00:00
|
|
|
/* @param dictionaryFilename The name of the dictionary file
|
|
|
|
* @param status The error code
|
|
|
|
* @return the newly created DictionaryBasedBreakIteratorTables
|
|
|
|
**/
|
2002-06-25 17:23:07 +00:00
|
|
|
DictionaryBasedBreakIteratorTables(const char* dictionaryFilename,
|
|
|
|
UErrorCode& status);
|
2000-01-08 02:05:05 +00:00
|
|
|
|
2002-06-25 17:23:07 +00:00
|
|
|
BreakDictionary *fDictionary;
|
|
|
|
void addReference();
|
|
|
|
void removeReference();
|
|
|
|
/**
|
|
|
|
* Destructor. Should not be used directly. Use removeReference() istead.
|
|
|
|
* (Not private to avoid compiler warnings.)
|
|
|
|
*/
|
|
|
|
virtual ~DictionaryBasedBreakIteratorTables();
|
|
|
|
|
2002-06-29 00:04:16 +00:00
|
|
|
/**
|
|
|
|
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.2
|
|
|
|
*/
|
|
|
|
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ICU "poor man's RTTI", returns a UClassID for this class.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.2
|
|
|
|
*/
|
|
|
|
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
|
|
|
|
|
2002-06-25 17:23:07 +00:00
|
|
|
private:
|
2000-01-08 02:05:05 +00:00
|
|
|
/**
|
|
|
|
* The copy constructor is declared private and not implemented.
|
|
|
|
* THIS CLASS MAY NOT BE COPIED.
|
2002-07-03 12:05:56 +00:00
|
|
|
* @param that The DictionaryBasedBreakIteratorTables to be copied.
|
|
|
|
* @return the newly constructed DictionaryBasedBreakIteratorTables.
|
2000-01-08 02:05:05 +00:00
|
|
|
*/
|
|
|
|
DictionaryBasedBreakIteratorTables(const DictionaryBasedBreakIteratorTables& that);
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// boilerplate
|
|
|
|
//=======================================================================
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The assignment operator is declared private and not implemented.
|
|
|
|
* THIS CLASS MAY NOT BE COPIED.
|
2002-06-25 17:23:07 +00:00
|
|
|
* Call addReference() and share an existing copy instead.
|
2002-07-03 12:05:56 +00:00
|
|
|
* @that The object to be copied
|
|
|
|
* @return the newly created DictionaryBasedBreakIteratorTables.
|
2000-01-08 02:05:05 +00:00
|
|
|
*/
|
|
|
|
DictionaryBasedBreakIteratorTables& operator=(
|
|
|
|
const DictionaryBasedBreakIteratorTables& that);
|
|
|
|
|
2002-06-29 00:04:16 +00:00
|
|
|
/**
|
|
|
|
* The address of this static class variable serves as this class's ID
|
|
|
|
* for ICU "poor man's RTTI".
|
|
|
|
*/
|
|
|
|
static const char fgClassID;
|
2000-01-08 02:05:05 +00:00
|
|
|
};
|
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_END
|
|
|
|
|
2000-01-08 02:05:05 +00:00
|
|
|
#endif
|