diff options
Diffstat (limited to 'TAO/TAO_IDL/ast/ast_decl.cpp')
-rw-r--r-- | TAO/TAO_IDL/ast/ast_decl.cpp | 129 |
1 files changed, 105 insertions, 24 deletions
diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp index 34648949f09..2e117a429dc 100644 --- a/TAO/TAO_IDL/ast/ast_decl.cpp +++ b/TAO/TAO_IDL/ast/ast_decl.cpp @@ -84,6 +84,84 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // FUZZ: disable check_for_streams_include #include "ace/streams.h" +AST_Annotation_Appls::AST_Annotation_Appls () +{ +} + +AST_Annotation_Appls::AST_Annotation_Appls (const AST_Annotation_Appls& other) +{ + *this = other; +} + +AST_Annotation_Appls::~AST_Annotation_Appls () +{ +} + +AST_Annotation_Appls & +AST_Annotation_Appls::operator= (const AST_Annotation_Appls& other) +{ + vector_.clear (); + add (other); + return *this; +} + +void +AST_Annotation_Appls::add (AST_Annotation_Appl *appl) +{ + vector_.push_back (AST_Annotation_Appl_Ptr (appl)); +} + +void +AST_Annotation_Appls::add (const AST_Annotation_Appls &other) +{ + for (const_iterator i = other.begin (); i != other.end (); ++i) + { + vector_.push_back (*i); + } +} + +bool +AST_Annotation_Appls::empty () const +{ + return !vector_.size (); +} + +size_t +AST_Annotation_Appls::size () const +{ + return vector_.size (); +} + +AST_Annotation_Appls::iterator +AST_Annotation_Appls::begin () +{ + return vector_.begin (); +} + +AST_Annotation_Appls::iterator +AST_Annotation_Appls::end () +{ + return vector_.end (); +} + +AST_Annotation_Appls::const_iterator +AST_Annotation_Appls::begin () const +{ + return vector_.begin (); +} + +AST_Annotation_Appls::const_iterator +AST_Annotation_Appls::end () const +{ + return vector_.end (); +} + +AST_Annotation_Appl * +AST_Annotation_Appls::operator[] (size_t index) +{ + return vector_[index].get (); +} + COMMON_Base::COMMON_Base (bool local, bool abstract) : is_local_ (local), @@ -268,6 +346,9 @@ AST_Decl::destroy (void) delete [] this->flat_name_; this->flat_name_ = 0; + + delete annotation_appls_; + annotation_appls_ = 0; } AST_Decl * @@ -1570,11 +1651,12 @@ AST_Decl::in_tmpl_mod_not_aliased (bool val) IMPL_NARROW_FROM_DECL(AST_Decl) -void AST_Decl::annotation_appls (AST_Annotation_Appls *annotations) +void +AST_Decl::annotation_appls (const AST_Annotation_Appls &annotations) { if (annotatable ()) { - annotation_appls_ = annotations; + annotation_appls () = annotations; } else { @@ -1585,30 +1667,34 @@ void AST_Decl::annotation_appls (AST_Annotation_Appls *annotations) } } -AST_Annotation_Appls *AST_Decl::annotation_appls () +AST_Annotation_Appls& +AST_Decl::annotation_appls () { - return annotation_appls_; + if (!annotation_appls_) + { + annotation_appls_ = new AST_Annotation_Appls (); + } + return *annotation_appls_; } void AST_Decl::dump_annotations (ACE_OSTREAM_TYPE &o, bool print_inline) { - if (annotation_appls_) + AST_Annotation_Appls::iterator + i = annotation_appls_->begin (), + finished = annotation_appls_->end (); + for (; i != finished; ++i) { - for (size_t i = 0; i < annotation_appls_->size (); i++) + AST_Annotation_Appl* a = i->get (); + a->dump (o); + if (print_inline) { - AST_Annotation_Appl *a = (*annotation_appls_)[i]; - a->dump (o); - if (print_inline) - { - dump_i (o, " "); - } - else - { - dump_i (o, "\n"); - // We need to indent the next line (or not if we are not indented) - idl_global->indent ()->skip_to (o); - } + dump_i (o, " "); + } + else + { + dump_i (o, "\n"); + idl_global->indent ()->skip_to (o); } } } @@ -1665,12 +1751,7 @@ AST_Decl::should_be_dumped () const AST_Annotation_Appls & AST_Decl::annotations () { - if (!annotation_appls_) - { - annotation_appls_ = new AST_Annotation_Appls; - } - - return *annotation_appls_; + return annotation_appls (); } bool |