Allow appending TextWithEntnties by const-ref.
This commit is contained in:
		
							parent
							
								
									43e9128014
								
							
						
					
					
						commit
						7ec9e05510
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		| 
						 | 
					@ -152,6 +152,16 @@ struct TextWithEntities {
 | 
				
			||||||
		entities.append(other.entities);
 | 
							entities.append(other.entities);
 | 
				
			||||||
		return *this;
 | 
							return *this;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						TextWithEntities &append(const TextWithEntities &other) {
 | 
				
			||||||
 | 
							const auto shift = text.size();
 | 
				
			||||||
 | 
							text.append(other.text);
 | 
				
			||||||
 | 
							entities.reserve(entities.size() + other.entities.size());
 | 
				
			||||||
 | 
							for (auto entity : other.entities) {
 | 
				
			||||||
 | 
								entity.shiftRight(shift);
 | 
				
			||||||
 | 
								entities.append(entity);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return *this;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	TextWithEntities &append(const QString &other) {
 | 
						TextWithEntities &append(const QString &other) {
 | 
				
			||||||
		text.append(other);
 | 
							text.append(other);
 | 
				
			||||||
		return *this;
 | 
							return *this;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue