sl@0: /*
sl@0: **********************************************************************
sl@0: *   Copyright (C) 1999-2000 IBM Corp. All rights reserved.
sl@0: **********************************************************************
sl@0: *   Date        Name        Description
sl@0: *   12/1/99    rgillam     Complete port from Java.
sl@0: *   01/13/2000 helena      Added UErrorCode to ctors.
sl@0: **********************************************************************
sl@0: */
sl@0: 
sl@0: #ifndef DBBI_TBL_H
sl@0: #define DBBI_TBL_H
sl@0: 
sl@0: #include "unicode/utypes.h"
sl@0: #include "unicode/uobject.h"
sl@0: #include "unicode/udata.h"
sl@0: #include "brkdict.h"
sl@0: 
sl@0: U_NAMESPACE_BEGIN
sl@0: 
sl@0: /* forward declaration */
sl@0: class DictionaryBasedBreakIterator;
sl@0: 
sl@0: //
sl@0: //   DictionaryBasedBreakIteratorTables
sl@0: //
sl@0: //        This class sits between instances of DictionaryBasedBreakIterator
sl@0: //        and the dictionary data itself,  which is of type BreakDictionary.
sl@0: //        It provides reference counting, allowing multiple copies of a
sl@0: //        DictionaryBasedBreakIterator to share a single instance of
sl@0: //        BreakDictionary.
sl@0: //
sl@0: //        TODO:  it'd probably be cleaner to add the reference counting to
sl@0: //        BreakDictionary and get rid of this class, but doing it this way
sl@0: //        was a convenient transition from earlier code, and time is short...
sl@0: //
sl@0: class DictionaryBasedBreakIteratorTables : public UMemory {
sl@0: 
sl@0: private:
sl@0:     int32_t      fRefCount;
sl@0: 
sl@0: 
sl@0: public:
sl@0:     //=======================================================================
sl@0:     // constructor
sl@0:     //=======================================================================
sl@0:     /* @param dictionaryFilename The name of the dictionary file
sl@0:      * @param status The error code
sl@0:      * @return the newly created DictionaryBasedBreakIteratorTables
sl@0:      **/
sl@0:     DictionaryBasedBreakIteratorTables(const char*       dictionaryFilename,
sl@0:                                              UErrorCode& status);
sl@0: 
sl@0:     BreakDictionary    *fDictionary;
sl@0:     void addReference();
sl@0:     void removeReference();
sl@0:     /**
sl@0:      * Destructor.  Should not be used directly.  Use removeReference() istead.
sl@0:      *              (Not private to avoid compiler warnings.)
sl@0:      */
sl@0:     virtual ~DictionaryBasedBreakIteratorTables();
sl@0: 
sl@0: private:
sl@0:     /**
sl@0:      * The copy constructor is declared private and not implemented.
sl@0:      * THIS CLASS MAY NOT BE COPIED.
sl@0:      * @param that The DictionaryBasedBreakIteratorTables to be copied.
sl@0:      * @return the newly constructed DictionaryBasedBreakIteratorTables.
sl@0:      */
sl@0:     DictionaryBasedBreakIteratorTables(const DictionaryBasedBreakIteratorTables& that);
sl@0: 
sl@0:     //=======================================================================
sl@0:     // boilerplate
sl@0:     //=======================================================================
sl@0: 
sl@0: 
sl@0:     /**
sl@0:      * The assignment operator is declared private and not implemented.
sl@0:      * THIS CLASS MAY NOT BE COPIED.
sl@0:      * Call addReference() and share an existing copy instead.
sl@0:      * @that The object to be copied
sl@0:      * @return the newly created  DictionaryBasedBreakIteratorTables.
sl@0:      */
sl@0:     DictionaryBasedBreakIteratorTables& operator=(
sl@0:             const DictionaryBasedBreakIteratorTables& that);
sl@0: };
sl@0: 
sl@0: U_NAMESPACE_END
sl@0: 
sl@0: #endif