Skip to content

Commit 2039fc6

Browse files
committed
Refactor a bit xr_token
Replace typedef by type alias for xr_string
1 parent e05649a commit 2039fc6

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/xrCommon/xr_string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "xalloc.h"
44

55
// string(char)
6-
typedef std::basic_string<char, std::char_traits<char>, xalloc<char>> xr_string;
6+
using xr_string = std::basic_string<char, std::char_traits<char>, xalloc<char>>;
77

88
inline void xr_strlwr(xr_string& src)
99
{

src/xrCore/xrCore.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,20 @@
9696
// stl ext
9797
struct XRCORE_API xr_rtoken
9898
{
99-
shared_str name;
99+
xr_string name;
100100
int id;
101101

102-
xr_rtoken(pcstr _nm, int _id)
102+
xr_rtoken(const pcstr _nm, const int _id)
103103
{
104104
name = _nm;
105105
id = _id;
106106
}
107107

108-
void rename(pcstr _nm) { name = _nm; }
109-
bool equal(pcstr _nm) const { return (0 == xr_strcmp(*name, _nm)); }
108+
void rename(const pcstr _nm) { name = _nm; }
109+
bool equal(const pcstr _nm) const
110+
{
111+
return name.compare(_nm) == 0;
112+
}
110113
};
111114

112115
#pragma pack(push, 1)

0 commit comments

Comments
 (0)