mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 02:25:53 +00:00
Reduce likelihood of malformed SOTemplate:
Formerly an SOTemplate was default constructed and its elements added using push_back(). This left open the possibility of a malformed SOTemplate if adding one of the elements caused a throw. With this commit the SOTemplate requires an initializer_list of its elements at construction. Elements may not be added after construction. With this approach either the SOTemplate is fully constructed with all of its elements or the constructor throws, which prevents an invalid SOTemplate from even existing. This change requires all SOTemplate construction to be adjusted at the call site. Those changes are also in this commit. The SOE_Flags enum is also renamed to SOEStyle, which harmonizes the name with other uses in the code base. SOEStyle elements are renamed (slightly) to have an "soe" prefix rather than "SOE_". This heads toward reserving identifiers with all upper case for macros. The new style also aligns with other prominent enums in the code base like the collection of TER identifiers. SOElement is adjusted so it can be stored directly in an STL container, rather than requiring storage in a unique_ptr. Correspondingly, unique_ptr usage is removed from both SOTemplate and KnownFormats.
This commit is contained in:
committed by
Nik Bougalis
parent
57fe197d3e
commit
afcc4ff296
@@ -65,14 +65,12 @@ enum TxType
|
||||
class TxFormats : public KnownFormats <TxType>
|
||||
{
|
||||
private:
|
||||
void addCommonFields (Item& item) override;
|
||||
|
||||
public:
|
||||
/** Create the object.
|
||||
This will load the object will all the known transaction formats.
|
||||
This will load the object with all the known transaction formats.
|
||||
*/
|
||||
TxFormats ();
|
||||
|
||||
public:
|
||||
static TxFormats const& getInstance ();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user