Ceetron Result Calculator Framework
CRCString.h
1 //##################################################################################################
2 //
3 // Ceetron Result Calculator Framework
4 //
5 // --------------------------------------------------------------------------------------------
6 // Copyright (C) 2019, Ceetron AS
7 //##################################################################################################
8 #pragma once
9 
10 #include "CRCBaseTypes.h"
11 
12 #include <cstddef>
13 #include <cstring>
14 
15 
16 //==================================================================================================
17 //
18 //
19 //
20 //==================================================================================================
21 class CRCString
22 {
23 public:
24  inline CRCString();
25  inline CRCString(const CRCString& other);
26  inline ~CRCString();
27 
28  inline CRCString& operator=(const CRCString& rhs);
29  inline bool operator==(const CRCString& rhs) const;
30  inline bool operator!=(const CRCString& rhs) const;
31  inline bool operator<(const CRCString& rhs) const;
32 
33  inline const crc_char_t* utf8() const;
34  inline crc_size_t byteCount() const;
35 
36  inline static CRCString fromUtf8(const crc_char_t* utf8Ptr);
37  inline static CRCString fromChar(const crc_char_t* charPtr);
38 
39 private:
40  crc_char_t* m_str;
41 };
42 
43 #include "CRCString.inl"
44 
45 
CRCString()
Constructor.
Definition: CRCString.inl:23
A simple class for handling strings.
Definition: CRCString.h:21
crc_size_t byteCount() const
Returns the number of bytes (length) of the string.
Definition: CRCString.inl:125
const crc_char_t * utf8() const
Returns a const ptr to the UTF-8 formatted string.
Definition: CRCString.inl:116
static CRCString fromChar(const crc_char_t *charPtr)
Returns a string created from an ASCII (char) string.
Definition: CRCString.inl:166
CRCString & operator=(const CRCString &rhs)
Assignment operator.
Definition: CRCString.inl:63
static CRCString fromUtf8(const crc_char_t *utf8Ptr)
Returns a string created from an UTF-8 array.
Definition: CRCString.inl:141
bool operator==(const CRCString &rhs) const
Equality operator.
Definition: CRCString.inl:85
bool operator!=(const CRCString &rhs) const
Inequality operator.
Definition: CRCString.inl:98
bool operator<(const CRCString &rhs) const
Check if this string is less than the passed string.
Definition: CRCString.inl:107
~CRCString()
Destructor.
Definition: CRCString.inl:53