Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2019-12-23 22:37:31 +0300
committerDavid Crocker <dcrocker@eschertech.com>2019-12-23 22:37:31 +0300
commitecbc545743695c73791ed8420bb4ad97266bec28 (patch)
tree4c33bb0c9efcd92e5bf8d219c447f6cfde894ae8 /src/ObjectModel/ObjectModel.h
parent7cf6080c42246a0bfea1e807325d312a457e13d3 (diff)
Handle command parsing errors using exceptions
Diffstat (limited to 'src/ObjectModel/ObjectModel.h')
-rw-r--r--src/ObjectModel/ObjectModel.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/ObjectModel/ObjectModel.h b/src/ObjectModel/ObjectModel.h
index e1226dd7..5c5e7ea7 100644
--- a/src/ObjectModel/ObjectModel.h
+++ b/src/ObjectModel/ObjectModel.h
@@ -23,15 +23,20 @@ constexpr TypeCode NoType = 0; // code for an invalid or unknown type
// Forward declarations
class ObjectModelTableEntry;
class ObjectModel;
+class StringParser;
-union ExpressionValue
+struct ExpressionValue
{
- bool bVal;
- float fVal;
- int32_t iVal;
- uint32_t uVal;
- const char *sVal;
- const ObjectModel *omVal;
+ TypeCode type;
+ union
+ {
+ bool bVal;
+ float fVal;
+ int32_t iVal;
+ uint32_t uVal;
+ const char *sVal;
+ const ObjectModel *omVal;
+ };
};
// Dummy types, used to define type codes
@@ -58,7 +63,7 @@ public:
TypeCode GetObjectType(const char *idString);
// Get the value of an object when we don't know what its type is
- TypeCode GetObjectValue(ExpressionValue& val, const char *idString);
+ ExpressionValue GetObjectValue(const StringParser& sp, const char *idString);
// Specialisation of above for float, allowing conversion from integer to float
bool GetObjectValue(float& val, const char *idString);