]>
git.ipfire.org Git - thirdparty/squid.git/blob - lib/libTrie/Trie.cc
2 * Copyright (c) 2002,2003 Robert Collins <rbtcollins@hotmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
26 #include "TrieCharTransform.h"
32 Trie::Trie(TrieCharTransform
*aTransform
) : head(0) , transform(aTransform
)
35 extern "C" void *TrieCreate()
46 extern "C" void TrieDestroy(void *aTrie
)
51 extern "C" void *TrieFind(void *aTrie
, char const *aString
, size_t theLength
)
53 return ((Trie
*)aTrie
)->find(aString
, theLength
);
57 Trie::add(char const *aString
, size_t theLength
, void *privatedata
)
63 if (find(aString
, theLength
))
66 return head
->add(aString
, theLength
, privatedata
, transform
);
71 return head
->add(aString
, theLength
, privatedata
, transform
);
74 extern "C" int TrieAdd(void *aTrie
, char const *aString
, size_t theLength
, void *privatedata
)
77 return ((Trie
*)aTrie
)->add(aString
, theLength
, privatedata
);