Skip to content

Commit

Permalink
Merge pull request #27 from shutterbug2000/dataholder-hierarchy
Browse files Browse the repository at this point in the history
Add Hierarchy handling to DataHolder
  • Loading branch information
jonbarrow authored May 21, 2023
2 parents e4f0287 + bdf790d commit 05fa2c0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@ func (dataHolder *DataHolder) ExtractFromStream(stream *StreamIn) error {

// Bytes encodes the DataHolder and returns a byte array
func (dataHolder *DataHolder) Bytes(stream *StreamOut) []byte {
content := dataHolder.objectData.Bytes(NewStreamOut(stream.Server))
parents := dataHolder.objectData.Hierarchy()

content := []byte{}
for _, parent := range parents {
content = append(content, parent.Bytes(NewStreamOut(stream.Server))...)
}
content = append(content, dataHolder.objectData.Bytes(NewStreamOut(stream.Server))...)

/*
Technically this way of encoding a DataHolder is "wrong".
Expand Down

0 comments on commit 05fa2c0

Please sign in to comment.