summaryrefslogtreecommitdiff
path: root/ace/OS_String.h
blob: 4f0cf3de936935c85a5fc67d95106f923a952522 (plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// -*- C++ -*-
// $Id$

// ============================================================================
//
// = LIBRARY
//   ace
//
// = FILENAME
//   OS_String.h
//
// = AUTHOR
//   (Originally in OS.h)
//   Doug Schmidt <schmidt@cs.wustl.edu>, Jesper S. M|ller
//   <stophph@diku.dk>, and a cast of thousands...
//
// ============================================================================

#ifndef ACE_OS_STRING_H
#define ACE_OS_STRING_H
#include "ace/pre.h"

#include "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/OS_Export.h"
#include /**/ <stddef.h>

class ACE_OS_Export ACE_OS_String
  // = TITLE
  //     This class is a wrapper for string operations
  //     Mainly includes the stuff found in string.h and ctype.h
  //
  // = DESCRIPTION
{
public:
  static char *strcat (char *s, const char *t);
  static char *strncat (char *s, const char *t, size_t len);
#if defined (ACE_HAS_WCHAR)
  static wchar_t *strcat (wchar_t *s, const wchar_t *t);
  static wchar_t *strncat (wchar_t *s, const wchar_t *t, size_t len);
#endif /* ACE_HAS_WCHAR */

  static char *strchr (char *s, int c);
  static const char *strchr (const char *s, int c);
  static char *strrchr (char *s, int c);
  static const char *strrchr (const char *s, int c);
  static char *strnchr (char *s, int c, size_t len);
  static const char *strnchr (const char *s, int c, size_t len);
#if defined (ACE_HAS_WCHAR)
  static wchar_t *strchr (wchar_t *s, wint_t c);
  static const wchar_t *strchr (const wchar_t *s, wint_t c);
  static wchar_t *strrchr (wchar_t *s, wint_t c);
  static const wchar_t *strrchr (const wchar_t *s, wint_t c);
  static wchar_t *strnchr (wchar_t *s, wint_t c, size_t len);
  static const wchar_t *strnchr (const wchar_t *s, wint_t c, size_t len);
#endif /* ACE_HAS_WCHAR */

  static int strcmp (const char *s, const char *t);
  static int strncmp (const char *s, const char *t, size_t len);
  static int strcasecmp (const char *s, const char *t);
  static int strncasecmp (const char *s, const char *t, size_t len);
#if defined (ACE_HAS_WCHAR)
  static int strcmp (const wchar_t *s, const wchar_t *t);
  static int strncmp (const wchar_t *s, const wchar_t *t, size_t len);
  static int strcasecmp (const wchar_t *s, const wchar_t *t);
  static int strncasecmp (const wchar_t *s, const wchar_t *t, size_t len);
#endif /* ACE_HAS_WCHAR */

  static char *strcpy (char *s, const char *t);
  static char *strecpy (char *des, const char *src);
  // Copies <src> to <des>, returning a pointer to the end of the
  // copied region, rather than the beginning, as <strcpy> does.
  static char *strncpy (char *s, const char *t, size_t len);
#if defined (ACE_HAS_WCHAR)
  static wchar_t *strcpy (wchar_t *s, const wchar_t *t);
  static wchar_t *strecpy (wchar_t *s, const wchar_t *t);
  static wchar_t *strncpy (wchar_t *s, const wchar_t *t, size_t len);
#endif /* ACE_HAS_WCHAR */

  static char *strpbrk (char *s1, const char *s2);
  static const char *strpbrk (const char *s1, const char *s2);
#if defined (ACE_HAS_WCHAR)
  static wchar_t *strpbrk (wchar_t *s1, const wchar_t *s2);
  static const wchar_t *strpbrk (const wchar_t *s1, const wchar_t *s2);
#endif /* ACE_HAS_WCHAR */

  static size_t strcspn (const char *s, const char *reject);

  static size_t strspn (const char *s1, const char *s2);
#if defined (ACE_HAS_WCHAR)
  static size_t strspn (const wchar_t *s1, const wchar_t *s2);
#endif /* ACE_HAS_WCHAR */

  static char *strstr (char *s, const char *t);
  static const char *strstr (const char *s, const char *t);
  static char *strnstr (char *s, const char *t, size_t len);
  static const char *strnstr (const char *s, const char *t, size_t len);
#if defined (ACE_HAS_WCHAR)
  static wchar_t *strstr (wchar_t *s, const wchar_t *t);
  static const wchar_t *strstr (const wchar_t *s, const wchar_t *t);
  static wchar_t *strnstr (wchar_t *s, const wchar_t *t, size_t len);
  static const wchar_t *strnstr (const wchar_t *s, const wchar_t *t, size_t len);
#endif /* ACE_HAS_WCHAR */

  static char *strdup (const char *s); // Uses malloc
#if defined (ACE_HAS_WCHAR)
  static wchar_t *strdup (const wchar_t *s);
#endif /* ACE_HAS_WCHAR */

  static size_t strlen (const char *s);
#if defined (ACE_HAS_WCHAR)
  static size_t strlen (const wchar_t *s);
#endif /* ACE_HAS_WCHAR */

  static char *strtok (char *s, const char *tokens);
  static char *strtok_r (char *s, const char *tokens, char **lasts);
#if defined (ACE_HAS_WCHAR)
  static wchar_t *strtok (wchar_t *s, const wchar_t *tokens);
#endif /* ACE_HAS_WCHAR */

  static long strtol (const char *s, char **ptr, int base);
  static unsigned long strtoul (const char *s, char **ptr, int base);
  static double strtod (const char *s, char **endptr);
#if defined (ACE_HAS_WCHAR)
  static long strtol (const wchar_t *s, wchar_t **ptr, int base);
  static unsigned long strtoul (const wchar_t *s, wchar_t **ptr, int base);
  static double strtod (const wchar_t *s, wchar_t **endptr);
#endif /* ACE_HAS_WCHAR */

  static int to_lower (int c);
#if defined (ACE_HAS_WCHAR)
  static wint_t to_lower (wint_t c);
#endif /* ACE_HAS_WCHAR */

  static int ace_isspace (const ACE_TCHAR s);
  static int ace_isprint (const ACE_TCHAR s);
};

# if defined (ACE_HAS_INLINED_OSCALLS)
#   if defined (ACE_INLINE)
#     undef ACE_INLINE
#   endif /* ACE_INLINE */
#   define ACE_INLINE inline
#   include "ace/OS_String.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */

#include "ace/post.h"
#endif /* ACE_OS_STRING_H */