Changeset dcf792a
- Timestamp:
- Aug 31, 2021, 11:35:29 AM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
- Children:
- a75cd3d
- Parents:
- 3be4078
- Location:
- libcfa/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/parseconfig.cfa
r3be4078 rdcf792a 11 11 static vtable(Missing_Config_Entries) Missing_Config_Entries_vt; 12 12 13 void ?{}( Missing_Config_Entries & this, unsigned int num_missing ) with ( this ) { 14 virtual_table = &Missing_Config_Entries_vt; 15 missing = num_missing; 16 } 13 void ?{}( Missing_Config_Entries & this, unsigned int num_missing ) { 14 this.virtual_table = &Missing_Config_Entries_vt; 15 this.num_missing = num_missing; 16 } 17 17 18 18 19 static vtable(Parse_Failure) Parse_Failure_vt; 19 20 20 void ?{}( Parse_Failure & this ) with ( this ) { 21 virtual_table = &Parse_Failure_vt; 22 } 21 void ?{}( Parse_Failure & this, char * failed_key, char * failed_value ) { 22 this.virtual_table = &Parse_Failure_vt; 23 24 this.failed_key = alloc( strlen( failed_key ) ); 25 this.failed_value = alloc( strlen( failed_value ) ); 26 strcpy( this.failed_key, failed_key ); 27 strcpy( this.failed_value, failed_value ); 28 } 29 30 void ^?{}( Parse_Failure & this ) with ( this ) { 31 free( failed_key ); 32 free( failed_value ); 33 } 34 23 35 24 36 static vtable(Validation_Failure) Validation_Failure_vt; 25 37 26 void ?{}( Validation_Failure & this ) with ( this ) { 27 virtual_table = &Validation_Failure_vt; 38 void ?{}( Validation_Failure & this, char * failed_key, char * failed_value ) { 39 this.virtual_table = &Validation_Failure_vt; 40 41 this.failed_key = alloc( strlen( failed_key ) ); 42 this.failed_value = alloc( strlen( failed_value ) ); 43 strcpy( this.failed_key, failed_key ); 44 strcpy( this.failed_value, failed_value ); 45 } 46 47 void ^?{}( Validation_Failure & this ) with ( this ) { 48 free( failed_key ); 49 free( failed_value ); 50 } 28 51 } 29 52 … … 128 151 // Parse the data 129 152 if ( !entries[j].parse( src_value, entries[j].variable ) ) { 153 Parse_Failure * ex = new( src_key, src_value ); 130 154 delete( kv_pairs ); 131 throw (Parse_Failure){};155 throw *ex; 132 156 } 133 157 134 158 // Validate the data 135 159 if ( !entries[j].validate( entries[j].variable ) ) { 160 Validation_Failure * ex = new( src_key, src_value ); 136 161 delete( kv_pairs ); 137 throw (Validation_Failure){};162 throw *ex; 138 163 } 139 164 -
libcfa/src/parseconfig.hfa
r3be4078 rdcf792a 59 59 60 60 exception Missing_Config_Entries { 61 unsigned int missing;61 unsigned int num_missing; 62 62 }; 63 63 64 64 void ?{}( Missing_Config_Entries & this ); 65 65 66 exception Parse_Failure {}; 66 exception Parse_Failure { 67 * char failed_key; 68 * char failed_value; 69 }; 67 70 68 71 void ?{}( Parse_Failure & this ); 69 72 70 exception Validation_Failure {}; 73 exception Validation_Failure { 74 * char failed_key; 75 * char failed_value; 76 }; 71 77 72 78 void ?{}( Validation_Failure & this );
Note: See TracChangeset
for help on using the changeset viewer.