1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5#include "ex.h"
6
7inline SString& StringArrayList::operator[] (DWORD idx) const
8{
9 WRAPPER_NO_CONTRACT;
10 return Get(idx);
11}
12
13inline SString& StringArrayList::Get (DWORD idx) const
14{
15 WRAPPER_NO_CONTRACT;
16 PTR_SString ppRet=(PTR_SString)m_Elements.Get(idx);
17 return *ppRet;
18}
19
20inline DWORD StringArrayList::GetCount() const
21{
22 WRAPPER_NO_CONTRACT;
23 return m_Elements.GetCount();
24}
25
26#ifndef DACCESS_COMPILE
27inline void StringArrayList::Append(const SString& string)
28{
29 CONTRACTL
30 {
31 THROWS;
32 GC_NOTRIGGER;
33 }
34 CONTRACTL_END;
35 NewHolder<SString> pAdd=new SString(string);
36 pAdd->Normalize();
37 IfFailThrow(m_Elements.Append(pAdd));
38 pAdd.SuppressRelease();
39}
40
41inline void StringArrayList::AppendIfNotThere(const SString& string)
42{
43 CONTRACTL
44 {
45 THROWS;
46 GC_NOTRIGGER;
47 }
48 CONTRACTL_END;
49 for (DWORD i=0;i<GetCount();i++)
50 {
51 if(Get(i).Equals(string))
52 return;
53 }
54 Append(string);
55}
56
57#endif
58
59
60inline StringArrayList::~StringArrayList()
61{
62 CONTRACTL
63 {
64 DESTRUCTOR_CHECK;
65 NOTHROW;
66 GC_NOTRIGGER;
67 }
68 CONTRACTL_END;
69#ifndef DACCESS_COMPILE
70 for (DWORD i=0;i< GetCount() ;i++)
71 {
72 delete (SString*)m_Elements.Get(i);
73 }
74#endif
75}
76
77