tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / connectivity / source / inc / file / FStringFunctions.hxx
blobb3d72294fa6803b694a78c5745a0663a214ab842
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <file/fcode.hxx>
24 namespace connectivity::file
26 /** UCASE(str)
27 UPPER(str)
28 Returns the string str with all characters changed to uppercase according to the current character set mapping (the default is ISO-8859-1 Latin1):
30 > SELECT UCASE('Hej');
31 -> 'HEJ'
34 class OOp_Upper : public OUnaryOperator
36 protected:
37 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
40 /** LCASE(str)
41 LOWER(str)
42 Returns the string str with all characters changed to lowercase according to the current character set mapping (the default is ISO-8859-1 Latin1):
44 > SELECT LCASE('QUADRATICALLY');
45 -> 'quadratically'
48 class OOp_Lower : public OUnaryOperator
50 protected:
51 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
54 /** ASCII(str)
55 Returns the ASCII code value of the leftmost character of the string str. Returns 0 if str is the empty string. Returns NULL if str is NULL:
57 > SELECT ASCII('2');
58 -> 50
59 > SELECT ASCII(2);
60 -> 50
61 > SELECT ASCII('dx');
62 -> 100
65 class OOp_Ascii : public OUnaryOperator
67 protected:
68 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
71 /** LENGTH(str)
72 OCTET_LENGTH(str)
73 CHAR_LENGTH(str)
74 CHARACTER_LENGTH(str)
75 Returns the length of the string str:
77 > SELECT LENGTH('text');
78 -> 4
79 > SELECT OCTET_LENGTH('text');
80 -> 4
83 class OOp_CharLength : public OUnaryOperator
85 protected:
86 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
89 /** CHAR(N,...)
90 CHAR() interprets the arguments as integers and returns a string consisting of the characters given by the ASCII code values of those integers. NULL values are skipped:
92 > SELECT CHAR(ascii('t'),ascii('e'),ascii('s'),ascii('t'));
93 -> 'test'
94 > SELECT CHAR(77,77.3,'77.3');
95 -> 'MMM'
98 class OOp_Char : public ONthOperator
100 protected:
101 virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override;
104 /** CONCAT(str1,str2,...)
105 Returns the string that results from concatenating the arguments. Returns NULL if any argument is NULL. May have more than 2 arguments. A numeric argument is converted to the equivalent string form:
107 > SELECT CONCAT('OO', 'o', 'OO');
108 -> 'OOoOO'
109 > SELECT CONCAT('OO', NULL, 'OO');
110 -> NULL
111 > SELECT CONCAT(14.3);
112 -> '14.3'
115 class OOp_Concat : public ONthOperator
117 protected:
118 virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override;
121 /** LOCATE(substr,str)
122 POSITION(substr IN str)
123 Returns the position of the first occurrence of substring substr in string str. Returns 0 if substr is not in str:
125 > SELECT LOCATE('bar', 'foobarbar');
126 -> 4
127 > SELECT LOCATE('xbar', 'foobar');
128 -> 0
129 LOCATE(substr,str,pos)
130 Returns the position of the first occurrence of substring substr in string str, starting at position pos. Returns 0 if substr is not in str:
132 > SELECT LOCATE('bar', 'foobarbar',5);
133 -> 7
136 class OOp_Locate : public ONthOperator
138 protected:
139 virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override;
142 /** SUBSTRING(str,pos)
143 SUBSTRING(str FROM pos)
144 Returns a substring from string str starting at position pos:
146 > SELECT SUBSTRING('Quadratically',5);
147 -> 'ratically'
148 > SELECT SUBSTRING('foobarbar' FROM 4);
149 -> 'barbar'
150 SUBSTRING(str,pos,len)
151 SUBSTRING(str FROM pos FOR len)
152 Returns a substring len characters long from string str, starting at position pos. The variant form that uses FROM is SQL-92 syntax:
154 > SELECT SUBSTRING('Quadratically',5,6);
155 -> 'ratica'
158 class OOp_SubString : public ONthOperator
160 protected:
161 virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override;
164 /** LTRIM(str)
165 Returns the string str with leading space characters removed:
167 > SELECT LTRIM(' barbar');
168 -> 'barbar'
171 class OOp_LTrim : public OUnaryOperator
173 protected:
174 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
177 /** RTRIM(str)
178 Returns the string str with trailing space characters removed:
180 > SELECT RTRIM('barbar ');
181 -> 'barbar'
184 class OOp_RTrim : public OUnaryOperator
186 protected:
187 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
190 /** SPACE(N)
191 Returns a string consisting of N space characters:
193 > SELECT SPACE(6);
194 -> ' '
197 class OOp_Space : public OUnaryOperator
199 protected:
200 virtual ORowSetValue operate(const ORowSetValue& lhs) const override;
203 /** REPLACE(str,from_str,to_str)
204 Returns the string str with all occurrences of the string from_str replaced by the string to_str:
206 > SELECT REPLACE('www.OOo.com', 'w', 'Ww');
207 -> 'WwWwWw.OOo.com'
210 class OOp_Replace : public ONthOperator
212 protected:
213 virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override;
216 /** REPEAT(str,count)
217 Returns a string consisting of the string str repeated count times. If count <= 0, returns an empty string. Returns NULL if str or count are NULL:
219 > SELECT REPEAT('OOo', 3);
220 -> 'OOoOOoOOo'
223 class OOp_Repeat : public OBinaryOperator
225 protected:
226 virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override;
229 /** INSERT(str,pos,len,newstr)
230 Returns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr:
232 > SELECT INSERT('Quadratic', 3, 4, 'What');
233 -> 'QuWhattic'
236 class OOp_Insert : public ONthOperator
238 protected:
239 virtual ORowSetValue operate(const std::vector<ORowSetValue>& lhs) const override;
242 /** LEFT(str,len)
243 Returns the leftmost len characters from the string str:
245 > SELECT LEFT('foobarbar', 5);
246 -> 'fooba'
249 class OOp_Left : public OBinaryOperator
251 protected:
252 virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override;
255 /** RIGHT(str,len)
256 Returns the rightmost len characters from the string str:
258 > SELECT RIGHT('foobarbar', 4);
259 -> 'rbar'
261 class OOp_Right : public OBinaryOperator
263 protected:
264 virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const override;
269 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */