@@ -83,10 +83,20 @@ namespace sdf
83
83
// / \return A copy of this Element.
84
84
public: ElementPtr Clone () const ;
85
85
86
+ // / \brief Create a copy of this Element.
87
+ // / \param[out] _errors Vector of errors.
88
+ // / \return A copy of this Element, NULL if there was an error.
89
+ public: ElementPtr Clone (sdf::Errors &_errors) const ;
90
+
86
91
// / \brief Copy values from an Element.
87
92
// / \param[in] _elem Element to copy value from.
88
93
public: void Copy (const ElementPtr _elem);
89
94
95
+ // / \brief Copy values from an Element.
96
+ // / \param[in] _elem Element to copy value from.
97
+ // / \param[out] _errors Vector of errors.
98
+ public: void Copy (const ElementPtr _elem, sdf::Errors &_errors);
99
+
90
100
// / \brief Get a pointer to this Element's parent.
91
101
// / \return Pointer to this Element's parent, NULL if there is no
92
102
// / parent.
@@ -220,6 +230,21 @@ namespace sdf
220
230
bool _required,
221
231
const std::string &_description = " " );
222
232
233
+ // / \brief Add an attribute value.
234
+ // / \param[in] _key Key value.
235
+ // / \param[in] _type Type of data the attribute will hold.
236
+ // / \param[in] _defaultValue Default value for the attribute.
237
+ // / \param[in] _required Requirement string. \as Element::SetRequired.
238
+ // / \param[out] _errors Vector of errors.
239
+ // / \param[in] _description A text description of the attribute.
240
+ // / \throws sdf::AssertionInternalError if an invalid type is given.
241
+ public: void AddAttribute (const std::string &_key,
242
+ const std::string &_type,
243
+ const std::string &_defaultvalue,
244
+ bool _required,
245
+ sdf::Errors &_errors,
246
+ const std::string &_description = " " );
247
+
223
248
// / \brief Add a value to this Element.
224
249
// / \param[in] _type Type of data the parameter will hold.
225
250
// / \param[in] _defaultValue Default value for the parameter.
@@ -230,6 +255,18 @@ namespace sdf
230
255
const std::string &_defaultValue, bool _required,
231
256
const std::string &_description = " " );
232
257
258
+ // / \brief Add a value to this Element.
259
+ // / \param[in] _type Type of data the parameter will hold.
260
+ // / \param[in] _defaultValue Default value for the parameter.
261
+ // / \param[in] _required Requirement string. \as Element::SetRequired.
262
+ // / \param[out] _errors Vector of errors.
263
+ // / \param[in] _description A text description of the parameter.
264
+ // / \throws sdf::AssertionInternalError if an invalid type is given.
265
+ public: void AddValue (const std::string &_type,
266
+ const std::string &_defaultValue, bool _required,
267
+ sdf::Errors &_errors,
268
+ const std::string &_description = " " );
269
+
233
270
// / \brief Add a value to this Element. This override allows passing min and
234
271
// / max values of the parameter.
235
272
// / \param[in] _type Type of data the parameter will hold.
@@ -245,6 +282,23 @@ namespace sdf
245
282
const std::string &_maxValue,
246
283
const std::string &_description = " " );
247
284
285
+ // / \brief Add a value to this Element. This override allows passing min and
286
+ // / max values of the parameter.
287
+ // / \param[in] _type Type of data the parameter will hold.
288
+ // / \param[in] _defaultValue Default value for the parameter.
289
+ // / \param[in] _required Requirement string. \as Element::SetRequired.
290
+ // / \param[in] _minValue Minimum allowed value for the parameter.
291
+ // / \param[in] _maxValue Maximum allowed value for the parameter.
292
+ // / \param[out] _errors Vector of errors.
293
+ // / \param[in] _description A text description of the parameter.
294
+ // / \throws sdf::AssertionInternalError if an invalid type is given.
295
+ public: void AddValue (const std::string &_type,
296
+ const std::string &_defaultValue, bool _required,
297
+ const std::string &_minValue,
298
+ const std::string &_maxValue,
299
+ sdf::Errors &_errors,
300
+ const std::string &_description = " " );
301
+
248
302
// / \brief Get the param of an attribute.
249
303
// / \param[in] _key the name of the attribute.
250
304
// / \return The parameter attribute value. NULL if the key is invalid.
@@ -309,6 +363,14 @@ namespace sdf
309
363
// / \return The element as a std::any.
310
364
public: std::any GetAny (const std::string &_key = " " ) const ;
311
365
366
+ // / \brief Get the element value/attribute as a std::any.
367
+ // / \param[in] _key The key of the attribute. If empty, get the value of
368
+ // / the element. Defaults to empty.
369
+ // / \param[out] _errors Vector of errors.
370
+ // / \return The element as a std::any.
371
+ public: std::any GetAny (sdf::Errors &_errors,
372
+ const std::string &_key = " " ) const ;
373
+
312
374
// / \brief Get the value of a key. This function assumes the _key
313
375
// / exists.
314
376
// / \param[in] _key the name of a child attribute or element.
@@ -431,6 +493,20 @@ namespace sdf
431
493
// / element if an existing child element did not exist.
432
494
public: ElementPtr GetElement (const std::string &_name);
433
495
496
+ // / \brief Return a pointer to the child element with the provided name.
497
+ // /
498
+ // / A new child element, with the provided name, is added to this element
499
+ // / if there is no existing child element. If this is not desired see \ref
500
+ // / FindElement
501
+ // / \remarks If there are multiple elements with the given tag, it returns
502
+ // / the first one.
503
+ // / \param[in] _name Name of the child element to retreive.
504
+ // / \param[out] _errors Vector of errors.
505
+ // / \return Pointer to the existing child element, or a new child
506
+ // / element if an existing child element did not exist.
507
+ public: ElementPtr GetElement (const std::string &_name,
508
+ sdf::Errors &_errors);
509
+
434
510
// / \brief Return a pointer to the child element with the provided name.
435
511
// /
436
512
// / Unlike \ref GetElement, this does not create a new child element if it
@@ -458,6 +534,13 @@ namespace sdf
458
534
// / \return A pointer to the newly created Element object.
459
535
public: ElementPtr AddElement (const std::string &_name);
460
536
537
+ // / \brief Add a named element.
538
+ // / \param[in] _name the name of the element to add.
539
+ // / \param[out] _errors Vector of errors.
540
+ // / \return A pointer to the newly created Element object.
541
+ public: ElementPtr AddElement (const std::string &_name,
542
+ sdf::Errors &_errors);
543
+
461
544
// / \brief Add an element object.
462
545
// / \param[in] _elem the element object to add.
463
546
public: void InsertElement (ElementPtr _elem);
@@ -476,6 +559,11 @@ namespace sdf
476
559
// / \param[in] _child Pointer to the child to remove.
477
560
public: void RemoveChild (ElementPtr _child);
478
561
562
+ // / \brief Remove a child element.
563
+ // / \param[in] _child Pointer to the child to remove.
564
+ // / \param[out] _errors Vector of errors.
565
+ public: void RemoveChild (ElementPtr _child, sdf::Errors &_errors);
566
+
479
567
// / \brief Remove all child elements.
480
568
public: void ClearElements ();
481
569
@@ -602,15 +690,16 @@ namespace sdf
602
690
// / int,...).
603
691
// / \param[in] _defaultValue Default value.
604
692
// / \param[in] _required True if the parameter is required to be set.
693
+ // / \param[out] _errors Vector of errors.
605
694
// / \param[in] _description Description of the parameter.
606
695
// / \return A pointer to the new Param object.
607
696
private: ParamPtr CreateParam (const std::string &_key,
608
697
const std::string &_type,
609
698
const std::string &_defaultValue,
610
699
bool _required,
700
+ sdf::Errors &_errors,
611
701
const std::string &_description = " " );
612
702
613
-
614
703
// / \brief Private data pointer
615
704
private: std::unique_ptr<ElementPrivate> dataPtr;
616
705
};
0 commit comments