File: UTILS_CStr.h

package info (click to toggle)
otf2 3.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 28,980 kB
  • sloc: ansic: 92,997; python: 16,977; cpp: 9,057; sh: 6,299; makefile: 235; awk: 54
file content (82 lines) | stat: -rw-r--r-- 2,180 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * This file is part of the Score-P software ecosystem (http://www.score-p.org)
 *
 * Copyright (c) 2009-2012,
 * RWTH Aachen University, Germany
 *
 * Copyright (c) 2009-2012,
 * Gesellschaft fuer numerische Simulation mbH Braunschweig, Germany
 *
 * Copyright (c) 2009-2012, 2014,
 * Technische Universitaet Dresden, Germany
 *
 * Copyright (c) 2009-2012,
 * University of Oregon, Eugene, USA
 *
 * Copyright (c) 2009-2012,
 * Forschungszentrum Juelich GmbH, Germany
 *
 * Copyright (c) 2009-2012,
 * German Research School for Simulation Sciences GmbH, Juelich/Aachen, Germany
 *
 * Copyright (c) 2009-2012,
 * Technische Universitaet Muenchen, Germany
 *
 * This software may be modified and distributed under the terms of
 * a BSD-style license.  See the COPYING file in the package base
 * directory for details.
 *
 */

#ifndef UTILS_CSTR_H
#define UTILS_CSTR_H

#include <stddef.h>

#ifdef __cplusplus
extern "C"
{
#endif

/**
 * @file
 *
 * @brief           Declare helper functions for string handling
 */

/**
 * Defines a C value analog to std::string::npos
 */
#define UTILS_CStr_npos PACKAGE_MANGLE_NAME( UTILS_CStr_npos )
extern const size_t UTILS_CStr_npos;

/**
 * Duplicates the string @a source.
 */
#define UTILS_CStr_dup PACKAGE_MANGLE_NAME( UTILS_CStr_dup )
char*
UTILS_CStr_dup( const char* source );

/**
   Searches for the first appearance of substring @a pattern in the string
   @a str after position @a pos.
   @param str     A string where the function tries to find the given pattern.
   @param pattern The string which is searched for in @a str.
   @param pos     The index of the first character in @a str, where the search
                  is started.
   @return If an appearance of @a pattern is found in @a str. It returns the
           index of the first letter of the first appearance of @a pattern in
           @a str. If the pattern is not found in @a str, it returns
           UTILS_CStr_npos.
 */
#define UTILS_CStr_find PACKAGE_MANGLE_NAME( UTILS_CStr_find )
size_t
UTILS_CStr_find( const char* str,
                 const char* pattern,
                 size_t      pos );

#ifdef __cplusplus
}
#endif

#endif /* UTILS_CSTR_H */