[xsde-users] variable length member : suggestion for "_present (bool x)" methods

Ivan Le Lann ivan.lelann at free.fr
Fri Sep 10 04:31:49 EDT 2010


Hi all,

It seems to me that working with variable-length elements
is not as transparent as it could be.

Editing an element schema, with C++ code going from fix to variable
length, you might silently break some code. Typically.

//
foo f;
f.bar_present(true);
f.bar().baz();
//

If "bar" becomes variable length some day, you're dead.
I propose to add an option to change generated code in "foo":

inline
void foo::
bar_present (bool x)
{
  if (!x)
  {
    delete this->bar_;
    this->bar_ = 0;
  }
  
  // patch suggestion : 
  else if (!bar_present())
  {
    this->bar_ = new bar;
  }
}

If by any chance this suggestion has some success,
I would be glad to provide a patch.

Regards,
Ivan.



More information about the xsde-users mailing list