|
1 /* |
|
2 * Copyright (c) 2009 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: Mifconv source file class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "mifconv.h" |
|
20 #include "mifconv_sourcefile.h" |
|
21 #include "mifconv_util.h" |
|
22 #include "mifconv_exception.h" |
|
23 #include "mifconv_argument.h" |
|
24 #include "mifconv_argumentmanager.h" |
|
25 |
|
26 MifConvSourceFile::MifConvSourceFile() |
|
27 : |
|
28 iDepth(IconDepth_Undefined), |
|
29 iMaskDepth(IconMaskDepth_Undefined), |
|
30 iDisplayMode(DisplayMode_None), |
|
31 iMaskDisplayMode(DisplayMode_None), |
|
32 iAnimated(false), |
|
33 iContent(0), |
|
34 iContentLen(0) |
|
35 { |
|
36 } |
|
37 |
|
38 MifConvSourceFile::MifConvSourceFile( const MifConvSourceFile& src ) |
|
39 : |
|
40 iFilename( src.Filename() ), |
|
41 iDepthString( src.DepthString() ), |
|
42 iMaskDepthString( src.MaskDepthString() ), |
|
43 iDepth(src.iDepth), |
|
44 iMaskDepth(src.iMaskDepth), |
|
45 iDisplayMode(src.iDisplayMode), |
|
46 iMaskDisplayMode(src.iMaskDisplayMode), |
|
47 iAnimated( src.IsAnimated() ), |
|
48 iMaskFilename( src.iMaskFilename ), |
|
49 iContent(src.iContent), |
|
50 iContentLen(src.iContentLen) |
|
51 { |
|
52 } |
|
53 |
|
54 MifConvSourceFile::~MifConvSourceFile() |
|
55 {} |
|
56 |
|
57 char* MifConvSourceFile::Content() const |
|
58 { |
|
59 return iContent; |
|
60 } |
|
61 |
|
62 int MifConvSourceFile::ContentLength() const |
|
63 { |
|
64 return iContentLen; |
|
65 } |
|
66 |
|
67 void MifConvSourceFile::SetContent(char* content, unsigned int len) |
|
68 { |
|
69 iContent = content; |
|
70 iContentLen = len; |
|
71 } |
|
72 |
|
73 const MifConvString& MifConvSourceFile::Filename() const |
|
74 { |
|
75 return iFilename; |
|
76 } |
|
77 |
|
78 void MifConvSourceFile::SetAnimated( bool isAnimated ) |
|
79 { |
|
80 iAnimated = isAnimated; |
|
81 } |
|
82 |
|
83 void MifConvSourceFile::SetFilename( const MifConvString& filename ) |
|
84 { |
|
85 iFilename = filename; |
|
86 } |
|
87 |
|
88 void MifConvSourceFile::SetDisplayMode( IconDisplayMode mode) |
|
89 { |
|
90 iDisplayMode = mode; |
|
91 } |
|
92 |
|
93 IconDisplayMode MifConvSourceFile::DisplayMode() const |
|
94 { |
|
95 return iDisplayMode; |
|
96 } |
|
97 |
|
98 void MifConvSourceFile::SetMaskDisplayMode( IconDisplayMode mode) |
|
99 { |
|
100 iMaskDisplayMode = mode; |
|
101 } |
|
102 |
|
103 IconDisplayMode MifConvSourceFile::MaskDisplayMode() const |
|
104 { |
|
105 return iMaskDisplayMode; |
|
106 } |
|
107 |
|
108 IconDepth MifConvSourceFile::Depth() const |
|
109 { |
|
110 return iDepth; |
|
111 } |
|
112 |
|
113 void MifConvSourceFile::SetDepth(IconDepth depth) |
|
114 { |
|
115 iDepth = depth; |
|
116 } |
|
117 |
|
118 const MifConvString& MifConvSourceFile::DepthString() const |
|
119 { |
|
120 return iDepthString; |
|
121 } |
|
122 |
|
123 IconMaskDepth MifConvSourceFile::MaskDepth() const |
|
124 { |
|
125 return iMaskDepth; |
|
126 } |
|
127 |
|
128 void MifConvSourceFile::SetMaskDepth(IconMaskDepth depth) |
|
129 { |
|
130 iMaskDepth = depth; |
|
131 } |
|
132 |
|
133 const MifConvString& MifConvSourceFile::MaskDepthString() const |
|
134 { |
|
135 return iMaskDepthString; |
|
136 } |
|
137 |
|
138 bool MifConvSourceFile::IsAnimated() const |
|
139 { |
|
140 return iAnimated; |
|
141 } |
|
142 |
|
143 const MifConvString& MifConvSourceFile::BmpMaskFilename() const |
|
144 { |
|
145 return iMaskFilename; |
|
146 } |
|
147 |
|
148 void MifConvSourceFile::SetBmpMaskFilename( const MifConvString& maskFilename ) |
|
149 { |
|
150 iMaskFilename = maskFilename; |
|
151 } |
|
152 |
|
153 void MifConvSourceFile::SetDepthString( const MifConvString& depth ) |
|
154 { |
|
155 iDepthString = depth; |
|
156 } |
|
157 |
|
158 void MifConvSourceFile::SetMaskDepthString( const MifConvString& mask ) |
|
159 { |
|
160 iMaskDepthString = mask; |
|
161 } |
|
162 |
|
163 void MifConvSourceFile::SetDepthAndMask( const MifConvString& depthAndMask ) |
|
164 { |
|
165 size_t separatorIndex = depthAndMask.find(","); |
|
166 |
|
167 if( separatorIndex != MifConvString::npos ) |
|
168 { |
|
169 iDepthString = MifConvString(depthAndMask.begin()+1, depthAndMask.begin()+separatorIndex); |
|
170 iMaskDepthString = MifConvString(depthAndMask.begin()+separatorIndex+1, depthAndMask.end()); |
|
171 iMaskDepth = MifConvArgumentManager::Instance()->ConvertToMaskDepth(iMaskDepthString); |
|
172 } |
|
173 else |
|
174 { |
|
175 iDepthString = MifConvString(depthAndMask.begin()+1, depthAndMask.end()); |
|
176 } |
|
177 iDepth = MifConvArgumentManager::Instance()->ConvertToDepth(iDepthString); |
|
178 } |
|
179 |