diff options
Diffstat (limited to 'modules/TAO/TAO_IDL/util/utl_labellist.cpp')
-rw-r--r-- | modules/TAO/TAO_IDL/util/utl_labellist.cpp | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/modules/TAO/TAO_IDL/util/utl_labellist.cpp b/modules/TAO/TAO_IDL/util/utl_labellist.cpp index 199917a5dd9..87a9c834bfc 100644 --- a/modules/TAO/TAO_IDL/util/utl_labellist.cpp +++ b/modules/TAO/TAO_IDL/util/utl_labellist.cpp @@ -74,15 +74,17 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "utl_labellist.h" #include "ast_union_label.h" +#include "ast_expression.h" +#include "ast_generator.h" -ACE_RCSID (util, - utl_labellist, - "$Id$") +#include "global_extern.h" + +#include "ace/OS_Memory.h" UTL_LabelList::UTL_LabelList (AST_UnionLabel *s, UTL_LabelList *cdr) - : UTL_List(cdr), - pd_car_data(s) + : UTL_List (cdr), + pd_car_data (s) { } @@ -93,6 +95,35 @@ UTL_LabelList::head (void) return this->pd_car_data; } +// Copy a label list. +UTL_LabelList * +UTL_LabelList::copy (void) +{ + AST_Expression *val = this->pd_car_data->label_val (); + + AST_Expression *val_copy = 0; + ACE_NEW_RETURN (val_copy, + AST_Expression (val, val->ev ()->et), + 0); + + AST_UnionLabel *label_copy = + idl_global->gen ()->create_union_label (this->pd_car_data->label_kind (), + val_copy); + + UTL_LabelList *retval = 0; + ACE_NEW_RETURN (retval, + UTL_LabelList (label_copy, + 0), + 0); + + if (this->tail () != 0) + { + retval->nconc ((UTL_LabelList *) this->tail ()->copy ()); + } + + return retval; +} + void UTL_LabelList::destroy (void) { @@ -108,16 +139,15 @@ UTL_LabellistActiveIterator::UTL_LabellistActiveIterator (UTL_LabelList *s) { } - // Get current item. AST_UnionLabel * UTL_LabellistActiveIterator::item (void) { - if (source == 0) + if (this->source == 0) { return 0; } - return ((UTL_LabelList *) source)->head (); + return (dynamic_cast<UTL_LabelList *> (this->source))->head (); } |