1
/*------------------------------------------------------------------------------
2
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
4
* Distributable under the terms of either the Apache License (Version 2.0) or
5
* the GNU Lesser General Public License, as specified in the COPYING file.
6
------------------------------------------------------------------------------*/
7
#ifndef _lucene_util_StringIntern_H
8
#define _lucene_util_StringIntern_H
10
#if defined(_LUCENE_PRAGMA_ONCE)
16
typedef CL_NS(util)::CLHashMap<const TCHAR*,int,CL_NS(util)::Compare::TChar,CL_NS(util)::Equals::TChar,CL_NS(util)::Deletor::tcArray, CL_NS(util)::Deletor::DummyInt32 > __wcsintrntype;
17
typedef CL_NS(util)::CLHashMap<const char*,int,CL_NS(util)::Compare::Char,CL_NS(util)::Equals::Char,CL_NS(util)::Deletor::acArray, CL_NS(util)::Deletor::DummyInt32 > __strintrntype;
19
/** Functions for intern'ing strings. This
20
* is a process of pooling strings thus using less memory,
21
* and furthermore allows intern'd strings to be directly
23
* string1==string2, rather than _tcscmp(string1,string2)
26
static __wcsintrntype stringPool;
27
static __strintrntype stringaPool;
28
STATIC_DEFINE_MUTEX(THIS_LOCK)
31
* Internalise the specified string.
32
* \return Returns a pointer to the internalised string
34
static const char* internA(const char* str CL_FILELINEPARAM);
36
* Uninternalise the specified string. Decreases
37
* the reference count and frees the string if
38
* reference count is zero
39
* \returns true if string was destroyed, otherwise false
41
static bool uninternA(const char* str);
44
* Internalise the specified string.
45
* \return Returns a pointer to the internalised string
47
static const TCHAR* intern(const TCHAR* str CL_FILELINEPARAM);
50
* Uninternalise the specified string. Decreases
51
* the reference count and frees the string if
52
* reference count is zero
53
* \returns true if string was destroyed, otherwise false
55
static bool unintern(const TCHAR* str);
57
static void shutdown();