Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / TAO_IDL / ast / ast_annotation_appls.cpp
blobd96c302fbee2fab12f215d5d633b6a0411848b81
1 #include "ast_annotation_appls.h"
2 #include "ast_annotation_appl.h"
4 AST_Annotation_Appls::AST_Annotation_Appls ()
8 AST_Annotation_Appls::AST_Annotation_Appls (const AST_Annotation_Appls& other)
10 *this = other;
13 AST_Annotation_Appls::~AST_Annotation_Appls ()
17 AST_Annotation_Appls &
18 AST_Annotation_Appls::operator= (const AST_Annotation_Appls& other)
20 vector_.clear ();
21 add (other);
22 return *this;
25 void
26 AST_Annotation_Appls::add (AST_Annotation_Appl *appl)
28 vector_.push_back (AST_Annotation_Appl_Ptr (appl));
31 void
32 AST_Annotation_Appls::add (const AST_Annotation_Appls &other)
34 for (const_iterator i = other.begin (); i != other.end (); ++i)
36 vector_.push_back (*i);
40 bool
41 AST_Annotation_Appls::empty () const
43 return !vector_.size ();
46 size_t
47 AST_Annotation_Appls::size () const
49 return vector_.size ();
52 AST_Annotation_Appls::iterator
53 AST_Annotation_Appls::begin ()
55 return vector_.begin ();
58 AST_Annotation_Appls::iterator
59 AST_Annotation_Appls::end ()
61 return vector_.end ();
64 AST_Annotation_Appls::const_iterator
65 AST_Annotation_Appls::begin () const
67 return vector_.begin ();
70 AST_Annotation_Appls::const_iterator
71 AST_Annotation_Appls::end () const
73 return vector_.end ();
76 AST_Annotation_Appl *
77 AST_Annotation_Appls::operator[] (size_t index)
79 return vector_[index].get ();
82 AST_Annotation_Appl *
83 AST_Annotation_Appls::find (AST_Annotation_Decl *annotation)
85 AST_Annotation_Appl *result = 0;
86 for (iterator i = begin (); i != end (); ++i)
88 AST_Annotation_Appl *appl = i->get ();
89 if (appl && appl->annotation_decl () == annotation)
91 result = appl;
94 return result;
97 AST_Annotation_Appl *
98 AST_Annotation_Appls::find (const char *annotation)
100 if (!annotation)
102 return 0;
105 UTL_Scope* bottom = idl_global->scopes ().bottom ();
106 if (!bottom)
108 return 0;
111 AST_Decl* decl = bottom->lookup_by_name (annotation);
112 if (!decl)
114 return 0;
117 return find (dynamic_cast<AST_Annotation_Decl*> (decl));