Debian Codegraph @

lib/dat/cursor-factory.cpp

raw symbols SCIP
1 /* Copyright(C) 2011 Brazil
2
3 This library is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Lesser General Public
5 License as published by the Free Software Foundation; either
6 version 2.1 of the License, or (at your option) any later version.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Lesser General Public License for more details.
12
13 You should have received a copy of the GNU Lesser General Public
14 License along with this library; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17
18 #include "cursor-factory.hpp"cxx . . $ `<file>/lib/dat/cursor-factory.hpp`/
19 #include "id-cursor.hpp"cxx . . $ `<file>/lib/dat/id-cursor.hpp`/
20 #include "key-cursor.hpp"cxx . . $ `<file>/lib/dat/key-cursor.hpp`/
21 #include "prefix-cursor.hpp"cxx . . $ `<file>/lib/dat/prefix-cursor.hpp`/
22 #include "predictive-cursor.hpp"cxx . . $ `<file>/lib/dat/predictive-cursor.hpp`/
23
24 #include <new>
25
26 namespace grncxx . . $ grn/ {
27 namespace datcxx . . $ grn/dat/ {
28
29 Cursorcxx . . $ grn/dat/Cursor# *CursorFactorycxx . . $ grn/dat/CursorFactory#::opencxx . . $ grn/dat/CursorFactory#open(60734bb5c370655a).(const Triecxx . . $ grn/dat/Trie# &trie,
30 const void *min_ptr, UInt32cxx . . $ grn/dat/UInt32# min_length,
31 const void *max_ptr, UInt32cxx . . $ grn/dat/UInt32# max_length,
32 UInt32cxx . . $ grn/dat/UInt32# offset,
33 UInt32cxx . . $ grn/dat/UInt32# limit,
34 UInt32cxx . . $ grn/dat/UInt32# flags) {
35 const UInt32cxx . . $ grn/dat/UInt32# cursor_type = flags & CURSOR_TYPE_MASKcxx . . $ grn/dat/CURSOR_TYPE_MASK.;
36 switch (cursor_type) {
37 case ID_RANGE_CURSORcxx . . $ grn/dat/ID_RANGE_CURSOR.: {
38 IdCursorcxx . . $ grn/dat/IdCursor# *cursor = new (std::nothrowcxx . . $ std/nothrow.) IdCursorcxx . . $ grn/dat/IdCursor#;
39 GRN_DAT_THROW_IFcxx . . $ `lib/dat/dat.hpp:232:9`!(MEMORY_ERROR, cursor == NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!);
40 try {
41 cursor->opencxx . . $ grn/dat/IdCursor#open(ff67b50667d7ad53).(trie, Stringcxx . . $ grn/dat/String#String(d249e89a313417f2).(min_ptr, min_length),
42 Stringcxx . . $ grn/dat/String#String(d249e89a313417f2).(max_ptr, max_length), offset, limit, flags);
43 } catch (...) {
44 delete cursor;
45 throw;
46 }
47 return cursor;
48 }
49 case KEY_RANGE_CURSORcxx . . $ grn/dat/KEY_RANGE_CURSOR.: {
50 KeyCursorcxx . . $ grn/dat/KeyCursor# *cursor = new (std::nothrowcxx . . $ std/nothrow.) KeyCursorcxx . . $ grn/dat/KeyCursor#;
51 GRN_DAT_THROW_IFcxx . . $ `lib/dat/dat.hpp:232:9`!(MEMORY_ERROR, cursor == NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!);
52 try {
53 cursor->opencxx . . $ grn/dat/KeyCursor#open(ff67b50667d7ad53).(trie, Stringcxx . . $ grn/dat/String#String(d249e89a313417f2).(min_ptr, min_length),
54 Stringcxx . . $ grn/dat/String#String(d249e89a313417f2).(max_ptr, max_length), offset, limit, flags);
55 } catch (...) {
56 delete cursor;
57 throw;
58 }
59 return cursor;
60 }
61 case PREFIX_CURSORcxx . . $ grn/dat/PREFIX_CURSOR.: {
62 PrefixCursorcxx . . $ grn/dat/PrefixCursor# *cursor = new (std::nothrowcxx . . $ std/nothrow.) PrefixCursorcxx . . $ grn/dat/PrefixCursor#;
63 GRN_DAT_THROW_IFcxx . . $ `lib/dat/dat.hpp:232:9`!(MEMORY_ERROR, cursor == NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!);
64 try {
65 cursor->opencxx . . $ grn/dat/PrefixCursor#open(eb3ebad4d3cb99d).(trie, Stringcxx . . $ grn/dat/String#String(d249e89a313417f2).(max_ptr, max_length), min_length,
66 offset, limit, flags);
67 } catch (...) {
68 delete cursor;
69 throw;
70 }
71 return cursor;
72 }
73 case PREDICTIVE_CURSORcxx . . $ grn/dat/PREDICTIVE_CURSOR.: {
74 PredictiveCursorcxx . . $ grn/dat/PredictiveCursor# *cursor = new (std::nothrowcxx . . $ std/nothrow.) PredictiveCursorcxx . . $ grn/dat/PredictiveCursor#;
75 GRN_DAT_THROW_IFcxx . . $ `lib/dat/dat.hpp:232:9`!(MEMORY_ERROR, cursor == NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!);
76 try {
77 cursor->opencxx . . $ grn/dat/PredictiveCursor#open(51969a13d721bec0).(trie, Stringcxx . . $ grn/dat/String#String(d249e89a313417f2).(min_ptr, min_length),
78 offset, limit, flags);
79 } catch (...) {
80 delete cursor;
81 throw;
82 }
83 return cursor;
84 }
85 default: {
86 GRN_DAT_THROWcxx . . $ `lib/dat/dat.hpp:229:9`!(PARAM_ERROR, "unknown cursor type");
87 }
88 }
89 }
90
91 } // namespace dat
92 } // namespace grn