def _parse_read_object(self, name): if len(self.indices) > 0: prev_index = self.indices[0] self.parameters[self.pidx].is_custom_obj = True value = self._get_nextval() if self.parameters[self.pidx].is_array and self.parameters[ self.pidx].is_custom_obj: customParam = Parameter(value) customParam.is_custom_obj = True self.parameters[self.pidx].values.append(customParam) self.parameters[self.pidx].flag = True if self.parameters[self.pidx].is_list and self.parameters[ self.pidx].is_custom_obj: customParam = Parameter(value) customParam.is_custom_obj = True self.parameters[self.pidx].values.append(customParam) # If this is the final parameter just read the remaining data as member variables if len(self.parameters) - 1 == self.pidx: while len( self.indices) > 0: # Read till the end of the index table if self._nextval_is_an_integer(prev_index): prev_index = self.indices[0] self._set_fuzzable(self.indices_read + self.columns, FUZZ_DIGIT) self._add_intval() continue else: prev_index = self.indices[0] value = self._get_nextval() if self.parameters[self.pidx].is_array or self.parameters[ self. pidx].is_list: # Am I reading an array of objects? if self._is_object_subtype( value): # Did I just read in an object subtype? self._indice_rollback(prev_index) break # Stop reading object and move onto the next object in the array if self._is_list_type(value): if self.parameters[self.pidx].flag is False: self._indice_rollback(prev_index) self._parse_read_list(self._get_typename(value), False) elif self._is_an_object( value ): # Is the value I just read in a subtype for another class prev_index = self.indices[0] else: self._add_stringval(value) self._set_fuzzable(prev_index, FUZZ_STRING) else: # There are more parameters so we must be careful with the parsing while len(self.indices) > 0: if self._nextval_is_an_integer(prev_index): self._set_fuzzable(self.indices_read + self.columns, FUZZ_DIGIT) prev_index = self.indices[0] self._add_intval() else: prev_index = self.indices[0] value = self._get_nextval() if self.parameters[self.pidx].is_array or self.parameters[ self.pidx].is_list: if self._is_object_subtype(value): self._indice_rollback(prev_index) break if self._is_end_of_object(prev_index, value): if self.parameters[ self.pidx].is_list or self.parameters[ self.pidx].is_array: self.pidx += 1 self._indice_rollback(prev_index) self._parse_value( self.parameters[self.pidx].typename) else: if not self._get_typename( self.parameters[self.pidx + 1].typename) in NUMERICS: self._indice_rollback(prev_index) break elif self._is_an_object(value): continue else: # store value self._set_fuzzable(prev_index, FUZZ_STRING) prev_index = self.indices[0] self._add_stringval(value) self.parameters[self.pidx].flag = False
def _parse_read_object(self,name): if len( self.indices ) > 0: prev_index = self.indices[0] self.parameters[self.pidx].is_custom_obj = True value = self._get_nextval() if self.parameters[self.pidx].is_array and self.parameters[self.pidx].is_custom_obj: customParam = Parameter( value ) customParam.is_custom_obj = True self.parameters[self.pidx].values.append( customParam ) self.parameters[self.pidx].flag = True if self.parameters[self.pidx].is_list and self.parameters[self.pidx].is_custom_obj: customParam = Parameter(value) customParam.is_custom_obj = True self.parameters[self.pidx].values.append(customParam) # If this is the final parameter just read the remaining data as member variables if len(self.parameters)-1 == self.pidx: while len(self.indices) > 0: # Read till the end of the index table if self._nextval_is_an_integer( prev_index ): prev_index = self.indices[0] self._set_fuzzable( self.indices_read+self.columns, FUZZ_DIGIT ) self._add_intval() continue else: prev_index = self.indices[0] value = self._get_nextval() if self.parameters[self.pidx].is_array or self.parameters[self.pidx].is_list: # Am I reading an array of objects? if self._is_object_subtype(value): # Did I just read in an object subtype? self._indice_rollback(prev_index) break # Stop reading object and move onto the next object in the array if self._is_list_type( value ): if self.parameters[self.pidx].flag is False: self._indice_rollback(prev_index) self._parse_read_list(self._get_typename(value), False) elif self._is_an_object(value): # Is the value I just read in a subtype for another class prev_index = self.indices[0] else: self._add_stringval(value) self._set_fuzzable( prev_index, FUZZ_STRING ) else: # There are more parameters so we must be careful with the parsing while len(self.indices) > 0: if self._nextval_is_an_integer( prev_index ): self._set_fuzzable( self.indices_read+self.columns, FUZZ_DIGIT ) prev_index = self.indices[0] self._add_intval() else: prev_index = self.indices[0] value = self._get_nextval() if self.parameters[self.pidx].is_array or self.parameters[self.pidx].is_list: if self._is_object_subtype(value): self._indice_rollback(prev_index) break; if self._is_end_of_object( prev_index, value ): if self.parameters[self.pidx].is_list or self.parameters[self.pidx].is_array: self.pidx += 1 self._indice_rollback(prev_index) self._parse_value( self.parameters[self.pidx].typename ) else: if not self._get_typename(self.parameters[self.pidx+1].typename) in NUMERICS: self._indice_rollback(prev_index) break elif self._is_an_object( value ): continue else: # store value self._set_fuzzable( prev_index, FUZZ_STRING ) prev_index = self.indices[0] self._add_stringval(value) self.parameters[self.pidx].flag = False