Skip to content

Commit d1df61d

Browse files
committed
Added [[nodiscard]]
1 parent ae8f756 commit d1df61d

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

src/ParticleSystem.h

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct Pointf
2222
Pointf p{ x * f, y * f };
2323
return p;
2424
}
25-
float getAngle() const
25+
[[nodiscard]] float getAngle() const
2626
{
2727
return atan2f(y, x);
2828
}
@@ -150,13 +150,13 @@ class ParticleSystem
150150
*
151151
* @return True if the system is full.
152152
*/
153-
bool isFull() const;
153+
[[nodiscard]] bool isFull() const;
154154

155155
/** Whether or not the particle system removed self on finish.
156156
*
157157
* @return True if the particle system removed self on finish.
158158
*/
159-
virtual bool isAutoRemoveOnFinish() const;
159+
[[nodiscard]] virtual bool isAutoRemoveOnFinish() const;
160160

161161
/** Set the particle system auto removed it self on finish.
162162
*
@@ -179,7 +179,7 @@ class ParticleSystem
179179
*
180180
* @return The speed.
181181
*/
182-
virtual float getSpeed() const;
182+
[[nodiscard]] virtual float getSpeed() const;
183183
/** Sets the speed.
184184
*
185185
* @param speed The speed.
@@ -189,7 +189,7 @@ class ParticleSystem
189189
*
190190
* @return The speed variance.
191191
*/
192-
virtual float getSpeedVar() const;
192+
[[nodiscard]] virtual float getSpeedVar() const;
193193
/** Sets the speed variance.
194194
*
195195
* @param speed The speed variance.
@@ -199,7 +199,7 @@ class ParticleSystem
199199
*
200200
* @return The tangential acceleration.
201201
*/
202-
virtual float getTangentialAccel() const;
202+
[[nodiscard]] virtual float getTangentialAccel() const;
203203
/** Sets the tangential acceleration.
204204
*
205205
* @param t The tangential acceleration.
@@ -209,7 +209,7 @@ class ParticleSystem
209209
*
210210
* @return The tangential acceleration variance.
211211
*/
212-
virtual float getTangentialAccelVar() const;
212+
[[nodiscard]] virtual float getTangentialAccelVar() const;
213213
/** Sets the tangential acceleration variance.
214214
*
215215
* @param t The tangential acceleration variance.
@@ -219,7 +219,7 @@ class ParticleSystem
219219
*
220220
* @return The radial acceleration.
221221
*/
222-
virtual float getRadialAccel() const;
222+
[[nodiscard]] virtual float getRadialAccel() const;
223223
/** Sets the radial acceleration.
224224
*
225225
* @param t The radial acceleration.
@@ -229,7 +229,7 @@ class ParticleSystem
229229
*
230230
* @return The radial acceleration variance.
231231
*/
232-
virtual float getRadialAccelVar() const;
232+
[[nodiscard]] virtual float getRadialAccelVar() const;
233233
/** Sets the radial acceleration variance.
234234
*
235235
* @param t The radial acceleration variance.
@@ -239,7 +239,7 @@ class ParticleSystem
239239
*
240240
* @return True if the rotation is the direction.
241241
*/
242-
virtual bool getRotationIsDir() const;
242+
[[nodiscard]] virtual bool getRotationIsDir() const;
243243
/** Sets the rotation of each particle to its direction.
244244
*
245245
* @param t True if the rotation is the direction.
@@ -250,7 +250,7 @@ class ParticleSystem
250250
*
251251
* @return The start radius.
252252
*/
253-
virtual float getStartRadius() const;
253+
[[nodiscard]] virtual float getStartRadius() const;
254254
/** Sets the start radius.
255255
*
256256
* @param startRadius The start radius.
@@ -260,7 +260,7 @@ class ParticleSystem
260260
*
261261
* @return The start radius variance.
262262
*/
263-
virtual float getStartRadiusVar() const;
263+
[[nodiscard]] virtual float getStartRadiusVar() const;
264264
/** Sets the start radius variance.
265265
*
266266
* @param startRadiusVar The start radius variance.
@@ -270,7 +270,7 @@ class ParticleSystem
270270
*
271271
* @return The end radius.
272272
*/
273-
virtual float getEndRadius() const;
273+
[[nodiscard]] virtual float getEndRadius() const;
274274
/** Sets the end radius.
275275
*
276276
* @param endRadius The end radius.
@@ -280,7 +280,7 @@ class ParticleSystem
280280
*
281281
* @return The end radius variance.
282282
*/
283-
virtual float getEndRadiusVar() const;
283+
[[nodiscard]] virtual float getEndRadiusVar() const;
284284
/** Sets the end radius variance.
285285
*
286286
* @param endRadiusVar The end radius variance.
@@ -290,7 +290,7 @@ class ParticleSystem
290290
*
291291
* @return The number of degrees to rotate a particle around the source pos per second.
292292
*/
293-
virtual float getRotatePerSecond() const;
293+
[[nodiscard]] virtual float getRotatePerSecond() const;
294294
/** Sets the number of degrees to rotate a particle around the source pos per second.
295295
*
296296
* @param degrees The number of degrees to rotate a particle around the source pos per second.
@@ -300,7 +300,7 @@ class ParticleSystem
300300
*
301301
* @return The rotate per second variance.
302302
*/
303-
virtual float getRotatePerSecondVar() const;
303+
[[nodiscard]] virtual float getRotatePerSecondVar() const;
304304
/** Sets the rotate per second variance.
305305
*
306306
* @param degrees The rotate per second variance.
@@ -316,13 +316,13 @@ class ParticleSystem
316316
*
317317
* @return True if the particle system is active.
318318
*/
319-
virtual bool isActive() const;
319+
[[nodiscard]] virtual bool isActive() const;
320320

321321
/** Gets the index of system in batch node array.
322322
*
323323
* @return The index of system in batch node array.
324324
*/
325-
int getAtlasIndex() const { return _atlasIndex; }
325+
[[nodiscard]] int getAtlasIndex() const { return _atlasIndex; }
326326
/** Sets the index of system in batch node array.
327327
*
328328
* @param index The index of system in batch node array.
@@ -333,13 +333,13 @@ class ParticleSystem
333333
*
334334
* @return The Quantity of particles that are being simulated at the moment.
335335
*/
336-
unsigned int getParticleCount() const { return _particleCount; }
336+
[[nodiscard]] unsigned int getParticleCount() const { return _particleCount; }
337337

338338
/** Gets how many seconds the emitter will run. -1 means 'forever'.
339339
*
340340
* @return The seconds that the emitter will run. -1 means 'forever'.
341341
*/
342-
float getDuration() const { return _duration; }
342+
[[nodiscard]] float getDuration() const { return _duration; }
343343
/** Sets how many seconds the emitter will run. -1 means 'forever'.
344344
*
345345
* @param duration The seconds that the emitter will run. -1 means 'forever'.
@@ -350,7 +350,7 @@ class ParticleSystem
350350
*
351351
* @return The source position of the emitter.
352352
*/
353-
const Vec2& getSourcePosition() const { return _sourcePosition; }
353+
[[nodiscard]] const Vec2& getSourcePosition() const { return _sourcePosition; }
354354
/** Sets the source position of the emitter.
355355
*
356356
* @param pos The source position of the emitter.
@@ -361,7 +361,7 @@ class ParticleSystem
361361
*
362362
* @return The position variance of the emitter.
363363
*/
364-
const Vec2& getPosVar() const { return _posVar; }
364+
[[nodiscard]] const Vec2& getPosVar() const { return _posVar; }
365365
/** Sets the position variance of the emitter.
366366
*
367367
* @param pos The position variance of the emitter.
@@ -372,7 +372,7 @@ class ParticleSystem
372372
*
373373
* @return The life of each particle.
374374
*/
375-
float getLife() const { return _life; }
375+
[[nodiscard]] float getLife() const { return _life; }
376376
/** Sets the life of each particle.
377377
*
378378
* @param life The life of each particle.
@@ -383,7 +383,7 @@ class ParticleSystem
383383
*
384384
* @return The life variance of each particle.
385385
*/
386-
float getLifeVar() const { return _lifeVar; }
386+
[[nodiscard]] float getLifeVar() const { return _lifeVar; }
387387
/** Sets the life variance of each particle.
388388
*
389389
* @param lifeVar The life variance of each particle.
@@ -394,7 +394,7 @@ class ParticleSystem
394394
*
395395
* @return The angle of each particle.
396396
*/
397-
float getAngle() const { return _angle; }
397+
[[nodiscard]] float getAngle() const { return _angle; }
398398
/** Sets the angle of each particle.
399399
*
400400
* @param angle The angle of each particle.
@@ -405,7 +405,7 @@ class ParticleSystem
405405
*
406406
* @return The angle variance of each particle.
407407
*/
408-
float getAngleVar() const { return _angleVar; }
408+
[[nodiscard]] float getAngleVar() const { return _angleVar; }
409409
/** Sets the angle variance of each particle.
410410
*
411411
* @param angleVar The angle variance of each particle.
@@ -418,7 +418,7 @@ class ParticleSystem
418418
*
419419
* @return The mode of the emitter.
420420
*/
421-
Mode getEmitterMode() const { return _emitterMode; }
421+
[[nodiscard]] Mode getEmitterMode() const { return _emitterMode; }
422422
/** Sets the mode of the emitter.
423423
*
424424
* @param mode The mode of the emitter.
@@ -429,7 +429,7 @@ class ParticleSystem
429429
*
430430
* @return The start size in pixels of each particle.
431431
*/
432-
float getStartSize() const { return _startSize; }
432+
[[nodiscard]] float getStartSize() const { return _startSize; }
433433
/** Sets the start size in pixels of each particle.
434434
*
435435
* @param startSize The start size in pixels of each particle.
@@ -440,7 +440,7 @@ class ParticleSystem
440440
*
441441
* @return The start size variance in pixels of each particle.
442442
*/
443-
float getStartSizeVar() const { return _startSizeVar; }
443+
[[nodiscard]] float getStartSizeVar() const { return _startSizeVar; }
444444
/** Sets the start size variance in pixels of each particle.
445445
*
446446
* @param sizeVar The start size variance in pixels of each particle.
@@ -451,7 +451,7 @@ class ParticleSystem
451451
*
452452
* @return The end size in pixels of each particle.
453453
*/
454-
float getEndSize() const { return _endSize; }
454+
[[nodiscard]] float getEndSize() const { return _endSize; }
455455
/** Sets the end size in pixels of each particle.
456456
*
457457
* @param endSize The end size in pixels of each particle.
@@ -462,7 +462,7 @@ class ParticleSystem
462462
*
463463
* @return The end size variance in pixels of each particle.
464464
*/
465-
float getEndSizeVar() const { return _endSizeVar; }
465+
[[nodiscard]] float getEndSizeVar() const { return _endSizeVar; }
466466
/** Sets the end size variance in pixels of each particle.
467467
*
468468
* @param sizeVar The end size variance in pixels of each particle.
@@ -473,7 +473,7 @@ class ParticleSystem
473473
*
474474
* @return The start color of each particle.
475475
*/
476-
const Color4F& getStartColor() const { return _startColor; }
476+
[[nodiscard]] const Color4F& getStartColor() const { return _startColor; }
477477
/** Sets the start color of each particle.
478478
*
479479
* @param color The start color of each particle.
@@ -484,7 +484,7 @@ class ParticleSystem
484484
*
485485
* @return The start color variance of each particle.
486486
*/
487-
const Color4F& getStartColorVar() const { return _startColorVar; }
487+
[[nodiscard]] const Color4F& getStartColorVar() const { return _startColorVar; }
488488
/** Sets the start color variance of each particle.
489489
*
490490
* @param color The start color variance of each particle.
@@ -495,7 +495,7 @@ class ParticleSystem
495495
*
496496
* @return The end color and end color variation of each particle.
497497
*/
498-
const Color4F& getEndColor() const { return _endColor; }
498+
[[nodiscard]] const Color4F& getEndColor() const { return _endColor; }
499499
/** Sets the end color and end color variation of each particle.
500500
*
501501
* @param color The end color and end color variation of each particle.
@@ -506,7 +506,7 @@ class ParticleSystem
506506
*
507507
* @return The end color variance of each particle.
508508
*/
509-
const Color4F& getEndColorVar() const { return _endColorVar; }
509+
[[nodiscard]] const Color4F& getEndColorVar() const { return _endColorVar; }
510510
/** Sets the end color variance of each particle.
511511
*
512512
* @param color The end color variance of each particle.
@@ -517,7 +517,7 @@ class ParticleSystem
517517
*
518518
* @return The start spin of each particle.
519519
*/
520-
float getStartSpin() const { return _startSpin; }
520+
[[nodiscard]] float getStartSpin() const { return _startSpin; }
521521
/** Sets the start spin of each particle.
522522
*
523523
* @param spin The start spin of each particle.
@@ -528,7 +528,7 @@ class ParticleSystem
528528
*
529529
* @return The start spin variance of each particle.
530530
*/
531-
float getStartSpinVar() const { return _startSpinVar; }
531+
[[nodiscard]] float getStartSpinVar() const { return _startSpinVar; }
532532
/** Sets the start spin variance of each particle.
533533
*
534534
* @param pinVar The start spin variance of each particle.
@@ -539,7 +539,7 @@ class ParticleSystem
539539
*
540540
* @return The end spin of each particle.
541541
*/
542-
float getEndSpin() const { return _endSpin; }
542+
[[nodiscard]] float getEndSpin() const { return _endSpin; }
543543
/** Sets the end spin of each particle.
544544
*
545545
* @param endSpin The end spin of each particle.
@@ -550,7 +550,7 @@ class ParticleSystem
550550
*
551551
* @return The end spin variance of each particle.
552552
*/
553-
float getEndSpinVar() const { return _endSpinVar; }
553+
[[nodiscard]] float getEndSpinVar() const { return _endSpinVar; }
554554
/** Sets the end spin variance of each particle.
555555
*
556556
* @param endSpinVar The end spin variance of each particle.
@@ -561,7 +561,7 @@ class ParticleSystem
561561
*
562562
* @return The emission rate of the particles.
563563
*/
564-
float getEmissionRate() const { return _emissionRate; }
564+
[[nodiscard]] float getEmissionRate() const { return _emissionRate; }
565565
/** Sets the emission rate of the particles.
566566
*
567567
* @param rate The emission rate of the particles.
@@ -572,7 +572,7 @@ class ParticleSystem
572572
*
573573
* @return The maximum particles of the system.
574574
*/
575-
virtual int getTotalParticles() const;
575+
[[nodiscard]] virtual int getTotalParticles() const;
576576
/** Sets the maximum particles of the system.
577577
*
578578
* @param totalParticles The maximum particles of the system.
@@ -581,7 +581,7 @@ class ParticleSystem
581581

582582
/** does the alpha value modify color */
583583
void setOpacityModifyRgb(bool opacityModifyRgb) { _opacityModifyRGB = opacityModifyRgb; }
584-
bool isOpacityModifyRgb() const { return _opacityModifyRGB; }
584+
[[nodiscard]] bool isOpacityModifyRgb() const { return _opacityModifyRGB; }
585585

586586
void update();
587587

@@ -591,7 +591,7 @@ class ParticleSystem
591591
/** initializes a ParticleSystem*/
592592
virtual bool initWithTotalParticles(int numberOfParticles);
593593
virtual void resetTotalParticles(int numberOfParticles);
594-
virtual bool isPaused() const;
594+
[[nodiscard]] virtual bool isPaused() const;
595595
virtual void pauseEmissions();
596596
virtual void resumeEmissions();
597597

0 commit comments

Comments
 (0)