# Path: importerUtils.py
# def getUInt16(data, offset):
# 	'''
# 	Returns a single unsingned 16-Bit value.
# 	Args:
# 		data
# 			A binary string.
# 		offset
# 			The zero based offset of the unsigned 16-Bit value.
# 	Returns:
# 		The unsigned 16-Bit value at offset.
# 		The new position in the 'stream'.
# 	'''
# 	val, = UINT16(data, offset)
# 	return val, offset + 2
# 
# def getUInt32(data, offset):
# 	'''
# 	Returns a single unsingned 32-Bit value.
# 	Args:
# 		data
# 			A binary string.
# 		offset
# 			The zero based offset of the unsigned 32-Bit value.
# 	Returns:
# 		The unsigned 32-Bit value at offset.
# 		The new position in the 'stream'.
# 	'''
# 	val, = UINT32(data, offset)
# 	return val, offset + 4
# 
# def getLen32Text8(data, offset):
# 	l, i = getUInt32(data, offset)
# 	try:
# 		txt, i = getText8(data, i, l)
# 	except UnicodeDecodeError:
# 		txt = data[i:i+l]
# 		i += l
# 	return txt, i
# 
# def getLen32Text16(data, offset):
# 	l, i = getUInt32(data, offset)
# 	end = i + 2 * l
# 	txt = data[i: end].decode('UTF-16LE')
# 	if (txt[-1:] == '\0'):
# 		txt = txt[:-1]
# 
# 	if (txt[-1:] == '\n'):
# 		txt = txt[:-1]
# 	return txt, end


from importerUtils import getUInt16, getUInt32, getLen32Text8, getLen32Text16

		self.data        = []
		self.orgPathW    = u''
		self.labelW      = u''
		self.defPathW    = u''

	def __repr__(self): return str(self.getDict())

	def getDict(self):
		"""populate temp dict that stores configurations"""
		return {
			"size":             self.size,
			"header":           self.header,
			"label":            self.label,
			"orgPath":          self.orgPath,
			"fmtId":            self.fmtId,
			"dataPath":         self.dataPath,
			"dataLen":          self.dataLen,
			"orgPathW":         self.orgPathW,
			"labelW":           self.labelW,
			"defPathW":         self.defPathW,
		}

	def read(self, data):
		""" parses olenative structure"""
		self.size, i        = getUInt32(data, 0)
		self.header, i      = getUInt16(data, i)# get flag1, typically a hardcoded value of 02 00
		self.label, i       = getText(data, i)
		self.orgPath, i     = getText(data, i)
		self.fmtId, i       = getUInt32(data, i) # 0x0300 => empedded, 0x0100 => linked
		self.dataPath, i    = getLen32Text8(data, i)

# Path: importerUtils.py
# def getUInt16(data, offset):
# 	'''
# 	Returns a single unsingned 16-Bit value.
# 	Args:
# 		data
# 			A binary string.
# 		offset
# 			The zero based offset of the unsigned 16-Bit value.
# 	Returns:
# 		The unsigned 16-Bit value at offset.
# 		The new position in the 'stream'.
# 	'''
# 	val, = UINT16(data, offset)
# 	return val, offset + 2
# 
# def getUInt32(data, offset):
# 	'''
# 	Returns a single unsingned 32-Bit value.
# 	Args:
# 		data
# 			A binary string.
# 		offset
# 			The zero based offset of the unsigned 32-Bit value.
# 	Returns:
# 		The unsigned 32-Bit value at offset.
# 		The new position in the 'stream'.
# 	'''
# 	val, = UINT32(data, offset)
# 	return val, offset + 4
# 
# def getLen32Text8(data, offset):
# 	l, i = getUInt32(data, offset)
# 	try:
# 		txt, i = getText8(data, i, l)
# 	except UnicodeDecodeError:
# 		txt = data[i:i+l]
# 		i += l
# 	return txt, i
# 
# def getLen32Text16(data, offset):
# 	l, i = getUInt32(data, offset)
# 	end = i + 2 * l
# 	txt = data[i: end].decode('UTF-16LE')
# 	if (txt[-1:] == '\0'):
# 		txt = txt[:-1]
# 
# 	if (txt[-1:] == '\n'):
# 		txt = txt[:-1]
# 	return txt, end


# Path: importerOle10Nateive.py
from importerUtils import getUInt16, getUInt32, getLen32Text8, getLen32Text16

		self.data        = []
		self.orgPathW    = u''
		self.labelW      = u''
		self.defPathW    = u''

	def __repr__(self): return str(self.getDict())

	def getDict(self):
		"""populate temp dict that stores configurations"""
		return {
			"size":             self.size,
			"header":           self.header,
			"label":            self.label,
			"orgPath":          self.orgPath,
			"fmtId":            self.fmtId,
			"dataPath":         self.dataPath,
			"dataLen":          self.dataLen,
			"orgPathW":         self.orgPathW,
			"labelW":           self.labelW,
			"defPathW":         self.defPathW,
		}

	def read(self, data):
		""" parses olenative structure"""
		self.size, i        = getUInt32(data, 0)
		self.header, i      = getUInt16(data, i)# get flag1, typically a hardcoded value of 02 00
		self.label, i       = getText(data, i)
		self.orgPath, i     = getText(data, i)
		self.fmtId, i       = getUInt32(data, i) # 0x0300 => empedded, 0x0100 => linked
		self.dataPath, i    = getLen32Text8(data, i)

		self.dataLen, i     = getUInt32(data, i)
