/usr/include/CLucene/util/Equators.h is in libclucene-dev 0.9.21b-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | /*------------------------------------------------------------------------------
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
*
* Distributable under the terms of either the Apache License (Version 2.0) or
* the GNU Lesser General Public License, as specified in the COPYING file.
------------------------------------------------------------------------------*/
#ifndef _lucene_util_Equators_
#define _lucene_util_Equators_
#if defined(_LUCENE_PRAGMA_ONCE)
# pragma once
#endif
CL_NS_DEF(util)
////////////////////////////////////////////////////////////////////////////////
// Equators
////////////////////////////////////////////////////////////////////////////////
/** @internal */
class Equals{
public:
class Int32:public CL_NS_STD(binary_function)<const int32_t*,const int32_t*,bool>
{
public:
bool operator()( const int32_t val1, const int32_t val2 ) const;
};
class Char:public CL_NS_STD(binary_function)<const char*,const char*,bool>
{
public:
bool operator()( const char* val1, const char* val2 ) const;
};
#ifdef _UCS2
class WChar: public CL_NS_STD(binary_function)<const wchar_t*,const wchar_t*,bool>
{
public:
bool operator()( const wchar_t* val1, const wchar_t* val2 ) const;
};
class TChar: public WChar{
};
#else
class TChar: public Char{
};
#endif
template<typename _cl>
class Void:public CL_NS_STD(binary_function)<const void*,const void*,bool>
{
public:
bool operator()( _cl* val1, _cl* val2 ) const{
return val1==val2;
}
};
};
////////////////////////////////////////////////////////////////////////////////
// Comparors
////////////////////////////////////////////////////////////////////////////////
/** @internal */
class Comparable:LUCENE_BASE{
public:
virtual ~Comparable(){
}
virtual int32_t compareTo(void* o) = 0;
};
/** @internal */
class Compare{
public:
class _base
{ // traits class for hash containers
public:
enum
{ // parameters for hash table
bucket_size = 4, // 0 < bucket_size
min_buckets = 8
}; // min_buckets = 2 ^^ N, 0 < N
_base()
{
}
};
class Int32:public _base, public Comparable{
int32_t value;
public:
int32_t getValue() const;
Int32(int32_t val);
Int32();
int32_t compareTo(void* o);
bool operator()( int32_t t1, int32_t t2 ) const;
size_t operator()( int32_t t ) const;
};
class Float:public Comparable{
float_t value;
public:
float_t getValue() const;
Float(float_t val);
int32_t compareTo(void* o);
};
class Char: public _base //<char*>
{
public:
bool operator()( const char* val1, const char* val2 ) const;
size_t operator()( const char* val1) const;
};
#ifdef _UCS2
class WChar: public _base //<wchar_t*>
{
public:
bool operator()( const wchar_t* val1, const wchar_t* val2 ) const;
size_t operator()( const wchar_t* val1) const;
};
#endif
class TChar: public _base, public Comparable{
const TCHAR* s;
public:
const TCHAR* getValue() const;
TChar();
TChar(const TCHAR* str);
int32_t compareTo(void* o);
bool operator()( const TCHAR* val1, const TCHAR* val2 ) const;
size_t operator()( const TCHAR* val1) const;
};
template<typename _cl>
class Void:public _base //<const void*,const void*,bool>
{
public:
int32_t compareTo(_cl* o){
if ( this == o )
return o;
else
return this > o ? 1 : -1;
}
bool operator()( _cl* t1, _cl* t2 ) const{
return t1 > t2 ? true : false;
}
size_t operator()( _cl* t ) const{
return (size_t)t;
}
};
};
////////////////////////////////////////////////////////////////////////////////
// allocators
////////////////////////////////////////////////////////////////////////////////
/** @internal */
class Deletor{
public:
template<typename _kt>
class Array{
public:
static void doDelete(_kt* arr){
_CLDELETE_LARRAY(arr);
}
};
class tcArray{
public:
static void doDelete(const TCHAR* arr){
_CLDELETE_CARRAY(arr);
}
};
class acArray{
public:
static void doDelete(const char* arr){
_CLDELETE_CaARRAY(arr);
}
};
class Unintern{
public:
static void doDelete(TCHAR* arr);
};
template<typename _kt>
class Object{
public:
static void doDelete(_kt* obj){
_CLLDELETE(obj);
}
};
template<typename _kt>
class Void{
public:
static void doDelete(_kt* obj){
_CLVDELETE(obj);
}
};
class Dummy{
public:
static void doDelete(const void* nothing){
//todo: remove all occurances where it hits this point
//CND_WARNING(false,"Deletor::Dummy::doDelete run, set deleteKey or deleteValue to false");
}
};
class DummyInt32{
public:
static void doDelete(const int32_t nothing){
}
};
class DummyFloat{
public:
static void doDelete(const float_t nothing){
}
};
template <typename _type>
class ConstNullVal{
public:
static void doDelete(const _type nothing){
//todo: remove all occurances where it hits this point
//CND_WARNING(false,"Deletor::Dummy::doDelete run, set deleteKey or deleteValue to false");
}
};
template <typename _type>
class NullVal{
public:
static void doDelete(_type nothing){
//todo: remove all occurances where it hits this point
//CND_WARNING(false,"Deletor::Dummy::doDelete run, set deleteKey or deleteValue to false");
}
};
};
////////////////////////////////////////////////////////////////////////////////
CL_NS_END
#endif
|