* Print attributes in sorted order.
This commit is contained in:
		
							parent
							
								
									81a4b4e49b
								
							
						
					
					
						commit
						bd25ac2260
					
				
					 2 changed files with 8 additions and 3 deletions
				
			
		|  | @ -41,12 +41,17 @@ std::ostream & operator << (std::ostream & str, Value & v) | ||||||
|     case tNull: |     case tNull: | ||||||
|         str << "true"; |         str << "true"; | ||||||
|         break; |         break; | ||||||
|     case tAttrs: |     case tAttrs: { | ||||||
|         str << "{ "; |         str << "{ "; | ||||||
|  |         typedef std::map<string, Value *> Sorted; | ||||||
|  |         Sorted sorted; | ||||||
|         foreach (Bindings::iterator, i, *v.attrs) |         foreach (Bindings::iterator, i, *v.attrs) | ||||||
|             str << (string) i->first << " = " << i->second.value << "; "; |             sorted[i->first] = &i->second.value; | ||||||
|  |         foreach (Sorted::iterator, i, sorted) | ||||||
|  |             str << i->first << " = " << *i->second << "; "; | ||||||
|         str << "}"; |         str << "}"; | ||||||
|         break; |         break; | ||||||
|  |     } | ||||||
|     case tList: |     case tList: | ||||||
|         str << "[ "; |         str << "[ "; | ||||||
|         for (unsigned int n = 0; n < v.list.length; ++n) |         for (unsigned int n = 0; n < v.list.length; ++n) | ||||||
|  |  | ||||||
|  | @ -1 +1 @@ | ||||||
| { x = { value = "x"; success = true; }; y = { value = false; success = false; }; z = { value = false; success = false; }; } | { x = { success = true; value = "x"; }; y = { success = false; value = false; }; z = { success = false; value = false; }; } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue