|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "MLAttributes.h" |
|
20 #include "MLAttributesParse.h" |
|
21 |
|
22 #include "LayoutCompilerErr.h" |
|
23 #include "CodeGenConsts.h" |
|
24 #include "UsefulDefinitions.h" |
|
25 |
|
26 // |
|
27 // class TMLAttributeSet |
|
28 // |
|
29 TMLAttributeSet::TMLAttributeSet() |
|
30 { |
|
31 |
|
32 } |
|
33 |
|
34 TMLAttributeSet::TMLAttributeSet(TMLAttributes* aAttributes) |
|
35 : |
|
36 iAttributes(aAttributes) |
|
37 { |
|
38 |
|
39 } |
|
40 |
|
41 TMLAttributeSet::~TMLAttributeSet() |
|
42 { |
|
43 |
|
44 } |
|
45 |
|
46 void TMLAttributeSet::Merge(TMLAttributeSet& aOther) |
|
47 { |
|
48 |
|
49 } |
|
50 |
|
51 void TMLAttributeSet::Compile() |
|
52 { |
|
53 |
|
54 } |
|
55 |
|
56 // |
|
57 // class TMLAttributes |
|
58 // |
|
59 |
|
60 TMLAttributes::TMLAttributes() |
|
61 { |
|
62 |
|
63 } |
|
64 |
|
65 TMLAttributes::~TMLAttributes() |
|
66 { |
|
67 for(iterator pComponent = begin(); pComponent != end(); ++pComponent) |
|
68 { |
|
69 TMLAttributeSetComponent& component = pComponent->second; |
|
70 for(TMLAttributeSetComponent::iterator pAttributeSet = component.begin(); pAttributeSet != component.end(); ++pAttributeSet) |
|
71 { |
|
72 TMLAttributeSet* nextSet = pAttributeSet->second; |
|
73 delete nextSet; |
|
74 } |
|
75 } |
|
76 } |
|
77 |
|
78 void TMLAttributes::Merge(TMLAttributes& aOther) |
|
79 { |
|
80 for(iterator pOtherComponent = aOther.begin(); pOtherComponent != aOther.end(); ++pOtherComponent) |
|
81 { |
|
82 int compId = pOtherComponent->first; |
|
83 TMLAttributeSetComponent& otherComponent = pOtherComponent->second; |
|
84 TMLAttributeSetComponent& thisComponent = (*this)[compId]; |
|
85 for(TMLAttributeSetComponent::iterator pOtherAttributeSet = otherComponent.begin(); pOtherAttributeSet != otherComponent.end(); ++pOtherAttributeSet) |
|
86 { |
|
87 string name = pOtherAttributeSet->first; |
|
88 TMLAttributeSet* otherSet = pOtherAttributeSet->second; |
|
89 TMLAttributeSetComponent::iterator foundThisSet = thisComponent.find(name); |
|
90 if(foundThisSet == thisComponent.end() && otherSet) |
|
91 { |
|
92 TMLAttributeSet* otherSetCopy = new TMLAttributeSet(*otherSet); |
|
93 thisComponent.insert(make_pair(name, otherSetCopy)); |
|
94 } |
|
95 } |
|
96 } |
|
97 for(TMLAttributeNames::iterator nextOtherName = aOther.iNames.begin(); nextOtherName != aOther.iNames.end(); ++nextOtherName) |
|
98 { |
|
99 // we want the superset of all the names, |
|
100 // it doesn't matter if there are names that correspond to attributes that don't actually exist |
|
101 // as it won't take up much memory and we won't look for them |
|
102 int& nextThisNameValue = iNames[nextOtherName->first]; |
|
103 nextThisNameValue = nextOtherName->second; |
|
104 } |
|
105 } |
|
106 |
|
107 void TMLAttributes::Compile() |
|
108 { |
|
109 |
|
110 } |
|
111 |
|
112 |
|
113 // End of File |