|
static void | fromString (const String &string, t_type &value) |
| Logic for converting an object from an NDEVR API String allowing it to be used automatically with getAs<>(), Files, GenericOptions, and various other data structures.
|
|
static const char * | getValidRegex () |
| Optionally specified to allow the software to do a check on user or file input to ensure that fromString will return a valid result or to limit user live input.
|
|
static void | toDisplayString (const t_type &value, TranslatedString &string) |
| Logic for converting an object to an NDEVR API translated, user facing string. This allows the object to be shown in a unique way to a user. If not overwritten, will default to the value returned from toString.
|
|
static void | toString (const t_type &value, String &string) |
| Logic for converting an object to an NDEVR API String allowing it to be used automatically with the String constructor, GenericOptions, Scanners, and various other data structures.
|
|
template<class t_type>
class NDEVR::StringStream< t_type >
Logic for reading or writing to a string or a user friendly, TranslatedString.
For example, to implement a given class or enum so that it can be cast to and from a string, or as a displayed to the end-user, you might add something similar to a CPP file.
Example Code For automatic conversion from another string class:
{
if (string.size() > 0)
value = QString::fromUtf8(string.c_str());
else
value.clear();
}
{
string.addAll(value.toUtf8().constData());
}
The core String class for the NDEVR API.
Definition String.h:69
static void toString(const t_type &value, String &string)
Logic for converting an object to an NDEVR API String allowing it to be used automatically with the S...
static void fromString(const String &string, t_type &value)
Logic for converting an object from an NDEVR API String allowing it to be used automatically with get...
Example Code For automatic conversion from a non-trivial structure
{
if (string.size() == 0)
else
{
{
}
}
}
{
}
{
String string;
string +=
_t(
"SHIFT").translation()+
"+";
string +=
_t(
"CTRL").translation() +
"+";
string +=
_t(
"FUNCTION").translation() +
"+";
string +=
_t(
"ALT").translation() +
"+";
char char_val = value.toChar();
switch(char_val)
{
case '\n':
case ' ':
{
switch (value.key_type)
{
default:
break;
}
} break;
default:
break;
}
translated_string = TranslatedString(string);
}
#define _t(english_string)
Definition Translator.h:90
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
constexpr t_index_type size() const
Definition Buffer.hpp:823
Buffer< t_other_type, t_other_index_type, t_other_memory_allocator, t_other_memory_manager > getAs() const
Gets a copy of this buffer, with filled objects t_other_type, where all objects are created using the...
Definition Buffer.hpp:172
A class which describes a user key press.
Definition Event.h:49
KeyEentType event_type
Definition Event.h:284
@ LIB_VK_BUTTON_R1
Definition Event.h:218
@ VK_KEY_F14
Definition Event.h:154
@ LIB_VK_DELETE
Definition Event.h:75
@ LIB_VK_BUTTON_A
Definition Event.h:213
@ VK_KEY_F15
Definition Event.h:155
@ LIB_VK_META
Definition Event.h:79
@ VK_KEY_F1
Definition Event.h:141
@ VK_KEY_F5
Definition Event.h:145
@ VK_KEY_F24
Definition Event.h:164
@ LIB_VK_VOLUME_DOWN
Definition Event.h:226
@ LIB_VK_BUTTON_L1
Definition Event.h:217
@ VK_KEY_F13
Definition Event.h:153
@ LIB_VK_BUTTON_MODE
Definition Event.h:221
@ LIB_VK_ESCAPE
Definition Event.h:82
@ LIB_VK_MENU
Definition Event.h:80
@ LIB_VK_LCONTROL
Definition Event.h:77
@ VK_KEY_F21
Definition Event.h:161
@ VK_KEY_F10
Definition Event.h:150
@ VK_KEY_F12
Definition Event.h:152
@ LIB_VK_BUTTON_THUMBR
Definition Event.h:223
@ VK_KEY_F18
Definition Event.h:158
@ LIB_VK_RCONTROL
Definition Event.h:78
@ VK_KEY_F4
Definition Event.h:144
@ VK_KEY_F6
Definition Event.h:146
@ LIB_VK_SPACE
Definition Event.h:206
@ VK_KEY_F23
Definition Event.h:163
@ VK_KEY_F16
Definition Event.h:156
@ LIB_VK_BUTTON_SELECT
Definition Event.h:219
@ LIB_VK_VOLUME_UP
Definition Event.h:225
@ VK_KEY_F20
Definition Event.h:160
@ LIB_VK_RETURN
Definition Event.h:203
@ VK_KEY_F2
Definition Event.h:142
@ VK_KEY_F17
Definition Event.h:157
@ VK_KEY_F22
Definition Event.h:162
@ LIB_VK_BUTTON_Y
Definition Event.h:216
@ LIB_VK_BUTTON_X
Definition Event.h:215
@ LIB_VK_BUTTON_B
Definition Event.h:214
@ LIB_VK_SHIFT
Definition Event.h:69
@ VK_KEY_F8
Definition Event.h:148
@ LIB_VK_BUTTON_THUMBL
Definition Event.h:222
@ VK_KEY_F7
Definition Event.h:147
@ VK_KEY_F9
Definition Event.h:149
@ LIB_VK_BUTTON_START
Definition Event.h:220
@ LIB_VK_EXECUTE
Definition Event.h:83
@ VK_KEY_F11
Definition Event.h:151
@ VK_KEY_F3
Definition Event.h:143
@ VK_KEY_F19
Definition Event.h:159
@ SHIFT
Definition Event.h:265
@ CTRL
Definition Event.h:266
@ FUNCTION
Definition Event.h:267
@ ALT
Definition Event.h:268
uint01 key_modifier
Definition Event.h:283
KEY key_type
Definition Event.h:282
static void toDisplayString(const t_type &value, TranslatedString &string)
Logic for converting an object to an NDEVR API translated, user facing string. This allows the object...
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:375
Example code for auomatic conversion to enums:
template<> void
{
switch (string.hashUpper())
{
}
}
template<> void
{
switch (value) {
case CompressionMode::e_default: string.addAll("DEFAULT"); break;
case CompressionMode::e_best: string.addAll("BEST"); break;
case CompressionMode::e_none: string.addAll("NONE"); break;
}
}
template<> void
{
switch (value) {
default:
lib_assert(
false,
"unknown value");
break;
}
}
#define lib_assert(expression, message)
Definition LibAssert.h:61
uint08 hash() const
Creates a simple, quick hash of the object. See hash(const char* value) for details of the implementa...
CompressionMode
Logical information about the type of compression implemented or requested.
Definition Compressor.h:16
@ e_best_compression
Definition Compressor.h:22
@ e_default_compression
Definition Compressor.h:18
@ e_no_compression
Definition Compressor.h:17
@ e_string_compression
Definition Compressor.h:20
@ e_best_speed
Definition Compressor.h:19
@ e_floating_point_compression
Definition Compressor.h:21
@ e_best
Definition RibbonLayoutMode.hpp:40