[poppler] std::unique_ptr

Albert Astals Cid aacid at kde.org
Sun May 21 16:57:26 UTC 2017


El diumenge, 21 de maig de 2017, a les 14:20:54 CEST, Carlos Garcia Campos va 
escriure:
> I've started to play with using std::unique_ptr in poppler now that we
> are using C++11. I've just submitted a new branch unique_ptr on top of
> better_object branch. For now I've only changed Annots. 

I'm really not a fan of 

-    title = obj1.getString()->copy();
+    title.reset(obj1.getString()->copy());

my lizard brain does "ctrl+f" and then "title =", when i want to see who is 
setting title.


> I'll move other
> files in follow up commits when I find some more time.

   if (obj1.isArray()) {
-    interiorColor = new AnnotColor(obj1.getArray());
-  } else {
-    interiorColor = NULL;
+    interiorColor = std::make_unique<AnnotColor>(obj1.getArray());
   }

this will abort if obj1 is not an array.

Cheers,
  Albert

> 
> Regards,




More information about the poppler mailing list