acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
string_file.h
1
#pragma once
2
3
4
template
<
typename
TYPE_CHAR >
5
class
CLASS_DECL_ACME
string_buffer
6
{
7
public
:
8
9
string_base < TYPE_CHAR >& m_str;
10
char_pointer m_pszBuffer;
11
character_count m_nLength;
12
character_count m_nBufferLength;
13
14
// Private copy constructor and copy assignment operator to prevent accidental use
15
16
enum
17
{
18
AUTO_LENGTH = 0x01,
// Automatically determine the ___new length of the string at release. The string must be nullptr-terminated.
19
SET_LENGTH = 0x02
// set the length of the string matter at GetBuffer time
20
};
21
22
explicit
string_buffer(string_base < TYPE_CHAR >& str) THROWS :
23
m_str(str),
24
m_pszBuffer(
nullptr
),
25
m_nLength(str.length()),
26
m_nBufferLength(str.length())
27
{
28
29
m_pszBuffer = m_str.GetBuffer();
30
31
}
32
33
string_buffer(string_base& str, character_count nMinLength, ::u32 dwFlags = AUTO_LENGTH) THROWS :
34
m_str(str),
35
m_pszBuffer(
nullptr
),
36
m_nLength((dwFlags& AUTO_LENGTH) ? -1 : nMinLength),
37
m_nBufferLength(nMinLength)
38
{
39
40
if
(dwFlags & SET_LENGTH)
41
{
42
43
m_pszBuffer = m_str.get_buffer(nMinLength);
44
45
}
46
else
47
{
48
49
m_pszBuffer = m_str.GetBuffer(nMinLength);
50
51
}
52
53
}
54
55
56
~string_buffer()
57
{
58
59
m_str.ReleaseBuffer(m_nLength);
60
61
}
62
63
64
operator
char_pointer () noexcept
65
{
66
67
return
m_pszBuffer;
68
69
}
70
71
72
operator
const_char_pointer () const noexcept
73
{
74
75
return
m_pszBuffer;
76
}
77
78
79
inline
void
set_length(character_count nLength);
80
81
private
:
82
83
string_buffer(
const
string_buffer&)
noexcept
;
84
string_buffer& operator=(
const
string_buffer&)
noexcept
;
85
86
};
87
88
string_buffer
Definition
string_buffer.h:69
prototype
string
string_file.h
Generated by
1.17.0