MCPcopy Create free account
hub / github.com/PDAL/PDAL / lookup

Method lookup

plugins/e57/libE57Format/src/StructureNodeImpl.cpp:150–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150NodeImplSharedPtr StructureNodeImpl::lookup( const ustring &pathName )
151{
152 // don't checkImageFileOpen
153 //??? use lookup(fields, level) instead, for speed.
154 bool isRelative;
155 std::vector<ustring> fields;
156 ImageFileImplSharedPtr imf( destImageFile_ );
157 imf->pathNameParse( pathName, isRelative, fields ); // throws if bad pathName
158
159 if ( isRelative || isRoot() )
160 {
161 if ( fields.empty() )
162 {
163 if ( isRelative )
164 {
165 return {}; // empty pointer
166 }
167
168 NodeImplSharedPtr root( getRoot() );
169 return ( root );
170 }
171
172 // Find child with elementName that matches first field in path
173 unsigned i;
174 for ( i = 0; i < children_.size(); i++ )
175 {
176 if ( fields.at( 0 ) == children_.at( i )->elementName() )
177 {
178 break;
179 }
180 }
181 if ( i == children_.size() )
182 {
183 return {}; // empty pointer
184 }
185
186 if ( fields.size() == 1 )
187 {
188 return ( children_.at( i ) );
189 }
190
191 //??? use level here rather than unparse
192 // Remove first field in path
193 fields.erase( fields.begin() );
194
195 // Call lookup on child object with remaining fields in path name
196 return children_.at( i )->lookup( imf->pathNameUnparse( true, fields ) );
197 }
198
199 // Absolute pathname and we aren't at the root
200 // Find root of the tree
201 NodeImplSharedPtr root( getRoot() );
202
203 // Call lookup on root
204 return ( root->lookup( pathName ) );
205}
206
207void StructureNodeImpl::set( int64_t index64, NodeImplSharedPtr ni )

Callers 1

isTypeEquivalentMethod · 0.45

Calls 8

pathNameParseMethod · 0.80
atMethod · 0.80
pathNameUnparseMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
elementNameMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected