/src/libreoffice/include/connectivity/IParseContext.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | #ifndef INCLUDED_CONNECTIVITY_IPARSECONTEXT_HXX |
20 | | #define INCLUDED_CONNECTIVITY_IPARSECONTEXT_HXX |
21 | | |
22 | | #include <rtl/ustring.hxx> |
23 | | |
24 | | namespace com::sun::star::lang { struct Locale; } |
25 | | |
26 | | namespace connectivity |
27 | | { |
28 | | |
29 | | //= IParseContext |
30 | | |
31 | | class IParseContext |
32 | | { |
33 | | public: |
34 | | enum class ErrorCode |
35 | | { |
36 | | General, // "Syntax error in SQL expression" |
37 | | ValueNoLike, // "The value #1 can not be used with LIKE." |
38 | | FieldNoLike, // "LIKE can not be used with this field." |
39 | | InvalidCompare, // "The entered criterion can not be compared with this field." |
40 | | InvalidIntCompare, // "The field can not be compared with a number." |
41 | | InvalidDateCompare, // "The field can not be compared with a date." |
42 | | InvalidRealCompare, // "The field can not be compared with a floating point number." |
43 | | InvalidTableNosuch, // "The database does not contain a table named \"#\"." |
44 | | // Named like this to avoid conflict with a #define in the Windows system ODBC headers. |
45 | | InvalidTableOrQuery, // "The database does contain neither a table nor a query named \"#\"." |
46 | | InvalidColumn, // "The column \"#1\" is unknown in the table \"#2\"." |
47 | | InvalidTableExist, // "The database already contains a table or view with name \"#\"." |
48 | | InvalidQueryExist // "The database already contains a query with name \"#\"."; |
49 | | }; |
50 | | |
51 | | enum class InternationalKeyCode |
52 | | { |
53 | | None = 0, |
54 | | Like, |
55 | | Not, |
56 | | Null, |
57 | | True, |
58 | | False, |
59 | | Is, |
60 | | Between, |
61 | | Or, |
62 | | And, |
63 | | Avg, |
64 | | Count, |
65 | | Max, |
66 | | Min, |
67 | | Sum, |
68 | | Every, |
69 | | Any, |
70 | | Some, |
71 | | StdDevPop, |
72 | | StdDevSamp, |
73 | | VarSamp, |
74 | | VarPop, |
75 | | Collect, |
76 | | Fusion, |
77 | | Intersection |
78 | | }; |
79 | | |
80 | | public: |
81 | | // retrieves language specific error messages |
82 | | virtual OUString getErrorMessage(ErrorCode _eCodes) const = 0; |
83 | | |
84 | | // retrieves language specific keyword strings (only ASCII allowed) |
85 | | virtual OString getIntlKeywordAscii(InternationalKeyCode _eKey) const = 0; |
86 | | |
87 | | // finds out, if we have an international keyword (only ASCII allowed) |
88 | | virtual InternationalKeyCode getIntlKeyCode(const OString& rToken) const = 0; |
89 | | |
90 | | /** gets a locale instance which should be used when parsing in the context specified by this instance |
91 | | <p>if this is not overridden by derived classes, it returns the static default locale.</p> |
92 | | */ |
93 | | virtual css::lang::Locale getPreferredLocale( ) const = 0; |
94 | | |
95 | | protected: |
96 | 21.3k | ~IParseContext() {} |
97 | | }; |
98 | | } |
99 | | |
100 | | #endif // INCLUDED_CONNECTIVITY_IPARSECONTEXT_HXX |
101 | | |
102 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |