1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
30 * Duplicates the source string and returns it.
32 * @note Caller needs to release this memory by calling OICFree().
34 * @param str Original valid string which needs to be duplicated.
36 * @return a pointer to the duplicated string
38 char *OICStrdup(const char *str);
41 * Convert source string to lower case characters.
43 * @param str Original valid string which needs to be converted.
46 void OICStringToLower(char* str);
49 * Copies a C string into destination buffer. Ensures that the destination
52 * @param dest Destination C buffer.
53 * @param destSize The allocated size of the destination parameter.
54 * @param source Source C string.
57 * returns a pointer to the passed in 'dest' parameter
59 char* OICStrcpy(char* dest, size_t destSize, const char* source);
62 * Appends a C string into a previously allocated and initialized C string in a buffer. dest
63 * parameter is guaranteed to be null-terminated.
65 * @param dest Destination C buffer containing initial string.
66 * @param destSize The allocated size of the destination parameter.
67 * @param source Source C string.
70 * returns a pointer to the passed in 'dest' parameter
72 char* OICStrcat(char* dest, size_t destSize, const char* source);
75 * Copies a partial C string into destination buffer.
76 * Ensures that the destination is null terminated.
78 * @param dest Destination C buffer.
79 * @param destSize The allocated size of the destination parameter.
80 * @param source Source C string.
81 * @param sourceLen maximum number of characters to copy.
84 * returns a pointer to the passed in 'dest' parameter
86 char* OICStrcpyPartial(char* dest, size_t destSize, const char* source, size_t sourceLen);
89 * Appends a C string into a previously allocated and initialized C string in a buffer. dest
90 * parameter is guaranteed to be null-terminated.
92 * @param dest Destination C buffer containing initial string.
93 * @param destSize The allocated size of the destination parameter.
94 * @param source Source C string.
95 * @param sourceLen maximum number of characters to append, not including null termination
98 * returns a pointer to the passed in 'dest' parameter
100 char* OICStrcatPartial(char* dest, size_t destSize, const char* source, size_t sourceLen);
104 #endif // __cplusplus
105 #endif // OIC_STRING_H_