59 std::shared_ptr<StructureNodeImpl> si( std::static_pointer_cast<StructureNodeImpl>( ni ) );
72 if ( myChildsFieldName == si->children_.at( i )->elementName() )
74 if ( !
children_.at( i )->isTypeEquivalent( si->children_.at( i ) ) )
83 if ( !si->isDefined( myChildsFieldName ) )
87 if ( !
children_.at( i )->isTypeEquivalent( si->lookup( myChildsFieldName ) ) )
102 return ( ni !=
nullptr );
113 child->setAttachedRecursive();
126 if ( index < 0 || index >=
static_cast<int64_t
>(
children_.size() ) )
132 return (
children_.at(
static_cast<unsigned>( index ) ) );
152 std::vector<ustring>
fields;
156 if ( isRelative ||
isRoot() )
196 return children_.at( i )->lookup( imf->pathNameUnparse(
true,
fields ) );
205 return ( root->lookup(
pathName ) );
213 auto index =
static_cast<unsigned>( index64 );
216 if ( index64 < 0 || index64 > UINT_MAX || index >
children_.size() )
233 if ( thisDest != niDest )
236 "this->destImageFile" + thisDest->fileName() +
" ni->destImageFile" + niDest->fileName() );
249 ni->setParent( shared_from_this(),
elementName.str() );
261 #ifdef E57_MAX_VERBOSE
262 std::cout <<
"StructureNodeImpl::set(pathName=" <<
pathName <<
", ni, autoPathCreate=" << autoPathCreate
267 std::vector<ustring>
fields;
286 bool autoPathCreate )
288 #ifdef E57_MAX_VERBOSE
289 std::cout <<
"StructureNodeImpl::set: level=" << level <<
std::endl;
290 for (
unsigned i = 0; i <
fields.size(); i++ )
302 if ( level == 0 &&
fields.empty() )
311 if (
fields.at( level ) == child->elementName() )
313 if ( level ==
fields.size() - 1 )
317 "this->pathName=" + this->
pathName() +
" element=" + fields[level] );
321 child->set(
fields, level + 1, ni );
335 if ( level ==
fields.size() - 1 )
338 ni->setParent( shared_from_this(),
fields.at( level ) );
344 if ( !autoPathCreate )
347 "this->pathName=" + this->
pathName() +
" field=" + fields.at( level ) );
354 for ( ; level !=
fields.size() - 1; level++ )
380 child->checkLeavesInSet( pathNames, origin );
390 if ( forcedFieldName !=
nullptr )
392 fieldName = forcedFieldName;
399 cf <<
space( indent ) <<
"<" << fieldName <<
" type=\"Structure\"";
401 const int numSpaces = indent +
static_cast<int>( fieldName.length() ) + 2;
406 if (
isRoot() && shared_from_this() == imf->root() )
408 bool gotDefaultNamespace =
false;
409 for (
size_t i = 0; i < imf->extensionsCount(); i++ )
411 const char *xmlnsExtension;
412 if ( imf->extensionsPrefix( i ).empty() )
414 gotDefaultNamespace =
true;
415 xmlnsExtension =
"xmlns";
419 xmlnsExtension =
"xmlns:";
422 const int index =
static_cast<int>( i );
425 <<
space( numSpaces ) << xmlnsExtension << imf->extensionsPrefix( index ) <<
"=\""
426 << imf->extensionsUri( index ) <<
"\"";
431 if ( !gotDefaultNamespace )
443 child->writeXml( imf, cf, indent + 2 );
447 cf <<
space( indent ) <<
"</" << fieldName <<
">\n";
461 os <<
space( indent ) <<
"type: Structure"
464 for (
unsigned i = 0; i <
children_.size(); i++ )
467 children_.at( i )->dump( indent + 2, os );
std::vector< PCLPointField > fields
ImageFileImplWeakPtr destImageFile_
ImageFileImplSharedPtr destImageFile()
void checkImageFileOpen(const char *srcFileName, int srcLineNumber, const char *srcFunctionName) const
NodeImplSharedPtr getRoot()
ustring elementName() const
NodeImplSharedPtr parent()
friend class StructureNodeImpl
virtual void dump(int indent=0, std::ostream &os=std::cout) const
bool isTypeEquivalent(NodeImplSharedPtr ni) override
virtual NodeImplSharedPtr get(int64_t index)
NodeImplSharedPtr lookup(const ustring &pathName) override
virtual void set(int64_t index, NodeImplSharedPtr ni)
void setAttachedRecursive() override
std::vector< NodeImplSharedPtr > children_
NodeType type() const override
virtual int64_t childCount() const
void checkLeavesInSet(const StringSet &pathNames, NodeImplSharedPtr origin) override
virtual void append(NodeImplSharedPtr ni)
bool isDefined(const ustring &pathName) override
void writeXml(ImageFileImplSharedPtr imf, CheckedFile &cf, int indent, const char *forcedFieldName=nullptr) override
void dump(int indent=0, std::ostream &os=std::cout) const override
QTextStream & endl(QTextStream &stream)
constexpr char E57_V1_0_URI[]
Verify all checksums. This is the default. (slow)
std::shared_ptr< class NodeImpl > NodeImplSharedPtr
std::weak_ptr< class ImageFileImpl > ImageFileImplWeakPtr
std::shared_ptr< class ImageFileImpl > ImageFileImplSharedPtr
@ E57_ERROR_SET_TWICE
attempted to set an existing child element to a new value
@ E57_ERROR_HOMOGENEOUS_VIOLATION
@ E57_ERROR_CHILD_INDEX_OUT_OF_BOUNDS
a numerical index identifying a child was out of bounds
@ E57_ERROR_DIFFERENT_DEST_IMAGEFILE
nodes were constructed with different destImageFiles
@ E57_ERROR_PATH_UNDEFINED
E57 element path well formed but not defined.
std::string ustring
UTF-8 encodeded Unicode string.
std::set< std::string > StringSet
NodeType
Identifiers for types of E57 elements.
@ E57_STRUCTURE
StructureNode class.
std::string toString(T x)
std::string space(size_t n)