acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
inline_string.h
1// Created by camilo on 2022-11-11 17:14 <3ThomasBorregaardSorensen!!
2#pragma once
3
4
5#include "acme/prototype/string/character_range.h"
6
7
8template < prototype_character CHARACTER, character_count m_sizeMaximumLength >
9class inline_string :
10 //public ::range < CHARACTER * >
11 public ::character_range < const CHARACTER * >
12{
13public:
14
15
16 CHARACTER m_sz[m_sizeMaximumLength + 1];
17
18
19 constexpr inline_string() :
20 ::character_range < const CHARACTER * >(no_initialize_t{})
21 {
22
23 this->m_begin = m_sz;
24 this->m_end = this->m_begin;
25 this->m_erange = e_range_none;
26 this->m_pbasedata = nullptr;
27 m_sz[0] = '\0';
28
29 }
30
31
32 constexpr inline_string(const CHARACTER* psz) :
33 inline_string()
34 {
35
36 while (*psz && this->size() < m_sizeMaximumLength)
37 {
38
39 *((CHARACTER*)this->m_end) = *psz;
40
41 this->m_end++;
42
43 psz++;
44
45 }
46
47 *((CHARACTER*)this->m_end) = '\0';
48
49 }
50
51
52 constexpr inline_string(const inline_string & inlinestring)
53 {
54 memory_copy(m_sz, inlinestring.m_sz, sizeof(m_sz));
55 this->m_begin = m_sz;
56 this->m_end = m_sz + inlinestring.size();
57 this->m_erange = inlinestring.m_erange;
58 this->m_pbasedata = inlinestring.m_pbasedata;
59 }
60
61
62 //const CHARACTER* c_str() { return m_sz; }
63
64
65 //operator const CHARACTER* () const { return m_sz; }
66 //operator CHARACTER* () { return m_sz; }
67
68
69 //const CHARACTER * data() const { return m_sz; }
70 //CHARACTER * data() { return m_sz; }
71
72 //const CHARACTER * begin() const { return data(); }
73 //CHARACTER * begin() { return data(); }
74
75 //const CHARACTER * end() const { return data() + size(); }
76 //CHARACTER * end() { return data() + size(); }
77
78 //character_count size() const { return ::maximum(0, m_iLength); }
79 //character_count length_in_bytes() const { return size() * sizeof(CHARACTER); }
80
81 //operator ::block() const { return { data(), size() }; }
82
83
84};
85
86
87template < prototype_number NUMBER >
88inline string as_string(NUMBER number, const_char_pointer pszFormat);
89
90// template < prototype_unsigned UNSIGNED >
91// inline inline_number_string as_string(UNSIGNED u, ::i32 radix = 10, enum_digit_case edigitcase = e_digit_case_lower);
92
93template < prototype_integral INTEGRAL >
94inline inline_number_string as_string(INTEGRAL i, ::i32 radix = 10, enum_digit_case edigitcase = e_digit_case_lower);
95
96
97
Definition _tags.h:5