ReactOS  0.4.12-dev-51-ge94618b
__Named_exception Class Reference

#include <_stdexcept_base.h>

Inheritance diagram for __Named_exception:
Collaboration diagram for __Named_exception:

Public Member Functions

 __Named_exception (const string &__str)
 
 __Named_exception (const __Named_exception &)
 
__Named_exceptionoperator= (const __Named_exception &)
 
const charwhat () const _STLP_NOTHROW_INHERENTLY
 
 ~__Named_exception () _STLP_NOTHROW_INHERENTLY
 

Private Types

enum  { _S_bufsize = 256 }
 

Private Attributes

char _M_static_name [_S_bufsize]
 
char_M_name
 

Detailed Description

Definition at line 68 of file _stdexcept_base.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
_S_bufsize 

Definition at line 78 of file _stdexcept_base.h.

Constructor & Destructor Documentation

◆ __Named_exception() [1/2]

__Named_exception::__Named_exception ( const string __str)

Definition at line 19 of file _stdexcept_base.c.

19  {
20  size_t __size = strlen(_STLP_PRIV __get_c_string(__str)) + 1;
21  if (__size > _S_bufsize) {
22  _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char)));
23  if (!_M_name) {
24  __size = _S_bufsize;
26  }
27  else {
28  *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char);
29  }
30  }
31  else {
33  }
34 #if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
35  strncpy(_M_name, _STLP_PRIV __get_c_string(__str), __size - 1);
36  _M_name[__size - 1] = '\0';
37 #else
38  strncpy_s(_M_name, __size, _STLP_PRIV __get_c_string(__str), __size - 1);
39 #endif
40 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define __STATIC_CAST(__x, __y)
Definition: features.h:585
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
const char *_STLP_CALL __get_c_string(const string &__str)
Definition: _string.h:1163
#define _STLP_PRIV
Definition: _dm.h:70
#define __REINTERPRET_CAST(__x, __y)
Definition: features.h:586
char _M_static_name[_S_bufsize]
int CDECL strncpy_s(char *dest, size_t numberOfElements, const char *src, size_t count)
Definition: heap.c:577
#define malloc
Definition: debug_ros.c:4

◆ __Named_exception() [2/2]

__Named_exception::__Named_exception ( const __Named_exception __x)

Definition at line 42 of file _stdexcept_base.c.

42  {
43  size_t __size = strlen(__x._M_name) + 1;
44  if (__size > _S_bufsize) {
45  _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char)));
46  if (!_M_name) {
47  __size = _S_bufsize;
49  }
50  else {
51  *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char);
52  }
53  }
54  else {
56  }
57 #if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
58  strncpy(_M_name, __x._M_name, __size - 1);
59  _M_name[__size - 1] = '\0';
60 #else
61  strncpy_s(_M_name, __size, __x._M_name, __size - 1);
62 #endif
63 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define __STATIC_CAST(__x, __y)
Definition: features.h:585
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
#define __REINTERPRET_CAST(__x, __y)
Definition: features.h:586
char _M_static_name[_S_bufsize]
int CDECL strncpy_s(char *dest, size_t numberOfElements, const char *src, size_t count)
Definition: heap.c:577
#define malloc
Definition: debug_ros.c:4

◆ ~__Named_exception()

__Named_exception::~__Named_exception ( )

Definition at line 89 of file _stdexcept_base.c.

89  {
90  if (_M_name != _M_static_name)
91  free(_M_name);
92 }
#define free
Definition: debug_ros.c:5
char _M_static_name[_S_bufsize]

Member Function Documentation

◆ operator=()

Definition at line 65 of file _stdexcept_base.c.

65  {
66  size_t __size = strlen(__x._M_name) + 1;
67  size_t __buf_size = _M_name != _M_static_name ? *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) : _S_bufsize;
68  if (__size > __buf_size) {
69  // Being here necessarily mean that we need to allocate a buffer:
71  _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char)));
72  if (!_M_name) {
73  __size = _S_bufsize;
75  }
76  else {
77  *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char);
78  }
79  }
80 #if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
81  strncpy(_M_name, __x._M_name, __size - 1);
82  _M_name[__size - 1] = '\0';
83 #else
84  strncpy_s(_M_name, __size, __x._M_name, __size - 1);
85 #endif
86  return *this;
87 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define __STATIC_CAST(__x, __y)
Definition: features.h:585
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
#define free
Definition: debug_ros.c:5
#define __REINTERPRET_CAST(__x, __y)
Definition: features.h:586
char _M_static_name[_S_bufsize]
int CDECL strncpy_s(char *dest, size_t numberOfElements, const char *src, size_t count)
Definition: heap.c:577
#define malloc
Definition: debug_ros.c:4

◆ what()

const char * __Named_exception::what ( ) const

Definition at line 94 of file _stdexcept_base.c.

Referenced by LocaleTest::collate_by_name(), and LocaleTest::numpunct_by_name().

95 { return _M_name; }

Member Data Documentation

◆ _M_name

char* __Named_exception::_M_name
private

Definition at line 80 of file _stdexcept_base.h.

Referenced by __Named_exception(), operator=(), what(), and ~__Named_exception().

◆ _M_static_name

char __Named_exception::_M_static_name[_S_bufsize]
private

Definition at line 79 of file _stdexcept_base.h.

Referenced by __Named_exception(), operator=(), and ~__Named_exception().


The documentation for this class was generated from the following files: