bump product version to 5.0.4.1
[LibreOffice.git] / connectivity / source / inc / file / FStringFunctions.hxx
blob909c4932246ff9e18131d9a6b2f15d4922043dbc
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 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FSTRINGFUNCTIONS_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FSTRINGFUNCTIONS_HXX
23 #include "file/fcode.hxx"
24 #include "file/filedllapi.hxx"
26 namespace connectivity
28 namespace file
30 /** UCASE(str)
31 UPPER(str)
32 Returns the string str with all characters changed to uppercase according to the current character set mapping (the default is ISO-8859-1 Latin1):
34 > SELECT UCASE('Hej');
35 -> 'HEJ'
38 class OOp_Upper : public OUnaryOperator
40 protected:
41 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
44 /** LCASE(str)
45 LOWER(str)
46 Returns the string str with all characters changed to lowercase according to the current character set mapping (the default is ISO-8859-1 Latin1):
48 > SELECT LCASE('QUADRATICALLY');
49 -> 'quadratically'
52 class OOp_Lower : public OUnaryOperator
54 protected:
55 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
58 /** ASCII(str)
59 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:
61 > SELECT ASCII('2');
62 -> 50
63 > SELECT ASCII(2);
64 -> 50
65 > SELECT ASCII('dx');
66 -> 100
69 class OOp_Ascii : public OUnaryOperator
71 protected:
72 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
75 /** LENGTH(str)
76 OCTET_LENGTH(str)
77 CHAR_LENGTH(str)
78 CHARACTER_LENGTH(str)
79 Returns the length of the string str:
81 > SELECT LENGTH('text');
82 -> 4
83 > SELECT OCTET_LENGTH('text');
84 -> 4
87 class OOp_CharLength : public OUnaryOperator
89 protected:
90 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
93 /** CHAR(N,...)
94 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:
96 > SELECT CHAR(ascii('t'),ascii('e'),ascii('s'),ascii('t'));
97 -> 'test'
98 > SELECT CHAR(77,77.3,'77.3');
99 -> 'MMM'
102 class OOp_Char : public ONthOperator
104 protected:
105 virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const SAL_OVERRIDE;
108 /** CONCAT(str1,str2,...)
109 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:
111 > SELECT CONCAT('OO', 'o', 'OO');
112 -> 'OOoOO'
113 > SELECT CONCAT('OO', NULL, 'OO');
114 -> NULL
115 > SELECT CONCAT(14.3);
116 -> '14.3'
119 class OOp_Concat : public ONthOperator
121 protected:
122 virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const SAL_OVERRIDE;
125 /** LOCATE(substr,str)
126 POSITION(substr IN str)
127 Returns the position of the first occurrence of substring substr in string str. Returns 0 if substr is not in str:
129 > SELECT LOCATE('bar', 'foobarbar');
130 -> 4
131 > SELECT LOCATE('xbar', 'foobar');
132 -> 0
133 LOCATE(substr,str,pos)
134 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:
136 > SELECT LOCATE('bar', 'foobarbar',5);
137 -> 7
140 class OOp_Locate : public ONthOperator
142 protected:
143 virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const SAL_OVERRIDE;
146 /** SUBSTRING(str,pos)
147 SUBSTRING(str FROM pos)
148 Returns a substring from string str starting at position pos:
150 > SELECT SUBSTRING('Quadratically',5);
151 -> 'ratically'
152 > SELECT SUBSTRING('foobarbar' FROM 4);
153 -> 'barbar'
154 SUBSTRING(str,pos,len)
155 SUBSTRING(str FROM pos FOR len)
156 Returns a substring len characters long from string str, starting at position pos. The variant form that uses FROM is SQL-92 syntax:
158 > SELECT SUBSTRING('Quadratically',5,6);
159 -> 'ratica'
162 class OOp_SubString : public ONthOperator
164 protected:
165 virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const SAL_OVERRIDE;
168 /** LTRIM(str)
169 Returns the string str with leading space characters removed:
171 > SELECT LTRIM(' barbar');
172 -> 'barbar'
175 class OOp_LTrim : public OUnaryOperator
177 protected:
178 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
181 /** RTRIM(str)
182 Returns the string str with trailing space characters removed:
184 > SELECT RTRIM('barbar ');
185 -> 'barbar'
188 class OOp_RTrim : public OUnaryOperator
190 protected:
191 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
194 /** SPACE(N)
195 Returns a string consisting of N space characters:
197 > SELECT SPACE(6);
198 -> ' '
201 class OOp_Space : public OUnaryOperator
203 protected:
204 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
207 /** REPLACE(str,from_str,to_str)
208 Returns the string str with all occurrences of the string from_str replaced by the string to_str:
210 > SELECT REPLACE('www.OOo.com', 'w', 'Ww');
211 -> 'WwWwWw.OOo.com'
214 class OOp_Replace : public ONthOperator
216 protected:
217 virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const SAL_OVERRIDE;
220 /** REPEAT(str,count)
221 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:
223 > SELECT REPEAT('OOo', 3);
224 -> 'OOoOOoOOo'
227 class OOp_Repeat : public OBinaryOperator
229 protected:
230 virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const SAL_OVERRIDE;
233 /** INSERT(str,pos,len,newstr)
234 Returns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr:
236 > SELECT INSERT('Quadratic', 3, 4, 'What');
237 -> 'QuWhattic'
240 class OOp_Insert : public ONthOperator
242 protected:
243 virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const SAL_OVERRIDE;
246 /** LEFT(str,len)
247 Returns the leftmost len characters from the string str:
249 > SELECT LEFT('foobarbar', 5);
250 -> 'fooba'
253 class OOp_Left : public OBinaryOperator
255 protected:
256 virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const SAL_OVERRIDE;
259 /** RIGHT(str,len)
260 Returns the rightmost len characters from the string str:
262 > SELECT RIGHT('foobarbar', 4);
263 -> 'rbar'
265 class OOp_Right : public OBinaryOperator
267 protected:
268 virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const SAL_OVERRIDE;
273 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FSTRINGFUNCTIONS_HXX
275 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */