-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathString.hpp
More file actions
94 lines (75 loc) · 2.41 KB
/
String.hpp
File metadata and controls
94 lines (75 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// AmigaOS MUI C++ wrapper
//
// (c) 2022-2026 TDolphin
//
#pragma once
#include "Area.hpp"
#include "ValueTypes/String/Format.hpp"
#undef String // undef macro from mui.h
namespace MUI
{
class String : public Area
{
public:
explicit String(Object *pMuiObject)
: Area(pMuiObject)
{
}
String(const Root &root)
: Area(root.muiObject())
{
}
// instanceOf
const static std::string className;
static inline bool instanceOf(Object *pMuiObject)
{
return MUI::instanceOf(pMuiObject, className.c_str());
}
static inline bool instanceOf(const Root &object)
{
return MUI::instanceOf(object.muiObject(), className.c_str());
}
// is/get/set (attributes), all setters return object reference
/// @brief [ @b MUIA_String_Contents ]
std::string getContents() const;
/// @brief [ @b MUIA_String_Contents ]
String &setContents(const std::string &contents);
// methods, some returns object reference
String &Clear();
};
template <typename T, typename U> class StringBuilderTemplate : public AreaBuilderTemplate<T, U>
{
public:
StringBuilderTemplate(const std::string &uniqueId = MUI::EmptyUniqueId, const std::string &muiClassName = MUIC_String)
: AreaBuilderTemplate<T, U>(uniqueId, muiClassName)
{
}
/// @brief [ @b MUIA_String_Contents ]
T &tagContents(const char *contents);
/// @brief [ @b MUIA_String_Contents ]
T &tagContents(const std::string &contents);
/// @brief [ @b MUIA_String_Format ]
T &tagFormat(const enum String_Format format);
/// @brief [ @b MUIA_String_MaxLen ]
T &tagMaxLen(const long maxLen);
#ifdef MUIA_String_Multiline
/// @brief [ @b MUIA_String_Multiline ]
T &tagMultiline(const bool multiline);
#endif
#ifdef MUIA_String_Placeholder
/// @brief [ @b MUIA_String_Placeholder ]
T &tagPlaceholder(const char *placeholder);
/// @brief [ @b MUIA_String_Placeholder ]
T &tagPlaceholder(const std::string &placeholder);
#endif
};
class StringBuilder : public StringBuilderTemplate<StringBuilder, String>
{
public:
StringBuilder();
};
}
#define MUI_STRING_TPP_INCLUDE
#include "String.tpp"
#undef MUI_STRING_TPP_INCLUDE