re: [Flightgear-devel] copying properties

2002-12-23 Thread David Megginson
Jim Wilson writes:

  Is there a way to copy a block of properties (ie an equivelent to
  cp -ax dir1 dir2)?  IIRC this was discussed at one time, and I'm
  wondering if it has been implemented yet.

See simgear/misc/props_io:

  /**
   * Copy properties from one node to another.
   */
  bool copyProperties (const SGPropertyNode *in, SGPropertyNode *out);


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] copying properties

2002-12-23 Thread David Megginson
Norman Vine writes:

  Jim Wilson writes:
  
   Is there a way to copy a block of properties
  
  #include simgear/misc/props_io.hxx
  copyProperties (const SGPropertyNode *in, SGPropertyNode *out)
  
  But AFAIK this requires that the 'out' nodes exist
  i.e. this copies but does not construct the nodes

No, that's wrong -- all of the nodes are created on demand except for
the root node.  This will work just fine:

  SGPropertyNode * saved_props = new SGPropertyNode();
  copyProperties(props, saved_props);


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] copying properties

2002-12-22 Thread Norman Vine
Jim Wilson writes:

 Is there a way to copy a block of properties

#include simgear/misc/props_io.hxx
copyProperties (const SGPropertyNode *in, SGPropertyNode *out)

But AFAIK this requires that the 'out' nodes exist
i.e. this copies but does not construct the nodes

I think the easiest way to 'clone' a branch is to write
the branch out to a temp file then read the 'clone' in

Norman

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel