Commit e2d6f035c0a6dcf2983b98bd8f6ff3410b0343bc
1 parent
a249f897
Fix comments in PointerHolder.hh
Showing
1 changed file
with
15 additions
and
20 deletions
include/qpdf/PointerHolder.hh
| @@ -43,11 +43,11 @@ | @@ -43,11 +43,11 @@ | ||
| 43 | 43 | ||
| 44 | // *** WHAT IS HAPPENING *** | 44 | // *** WHAT IS HAPPENING *** |
| 45 | 45 | ||
| 46 | -// In qpdf 11, PointerHolder will be replaced with std::shared_ptr | ||
| 47 | -// wherever it appears in the qpdf API. The PointerHolder object will | ||
| 48 | -// be derived from std::shared_ptr to provide a backward-compatible | ||
| 49 | -// interface and will be mutually assignable with std::shared_ptr. | ||
| 50 | -// Code that uses containers of PointerHolder will require adjustment. | 46 | +// In qpdf 11, PointerHolder was replaced with std::shared_ptr |
| 47 | +// wherever it appeared in the qpdf API. The PointerHolder object is | ||
| 48 | +// now derived from std::shared_ptr to provide a backward-compatible | ||
| 49 | +// interface and is mutually assignable with std::shared_ptr. Code | ||
| 50 | +// that uses containers of PointerHolder will require adjustment. | ||
| 51 | 51 | ||
| 52 | // *** HOW TO TRANSITION *** | 52 | // *** HOW TO TRANSITION *** |
| 53 | 53 | ||
| @@ -55,8 +55,9 @@ | @@ -55,8 +55,9 @@ | ||
| 55 | // transition your code away from PointerHolder. You can define it | 55 | // transition your code away from PointerHolder. You can define it |
| 56 | // before including any qpdf header files or including its definition | 56 | // before including any qpdf header files or including its definition |
| 57 | // in your build configuration. If not defined, it automatically gets | 57 | // in your build configuration. If not defined, it automatically gets |
| 58 | -// defined to 0, which enables full backward compatibility. That way, | ||
| 59 | -// you don't have to take action for your code to continue to work. | 58 | +// defined to 0 (with a warning), which enables full backward |
| 59 | +// compatibility. That way, you don't have to take action for your | ||
| 60 | +// code to continue to work. | ||
| 60 | 61 | ||
| 61 | // If you want to work gradually to transition your code away from | 62 | // If you want to work gradually to transition your code away from |
| 62 | // PointerHolder, you can define POINTERHOLDER_TRANSITION and fix the | 63 | // PointerHolder, you can define POINTERHOLDER_TRANSITION and fix the |
| @@ -64,7 +65,7 @@ | @@ -64,7 +65,7 @@ | ||
| 64 | // want to be able to continue to support old qpdf versions at the | 65 | // want to be able to continue to support old qpdf versions at the |
| 65 | // same time, you can write code like this: | 66 | // same time, you can write code like this: |
| 66 | 67 | ||
| 67 | -// #ifndef POINTERHOLDER_TRANSITION | 68 | +// #ifndef POINTERHOLDER_IS_SHARED_POINTER |
| 68 | // ... use PointerHolder as before 10.6 | 69 | // ... use PointerHolder as before 10.6 |
| 69 | // #else | 70 | // #else |
| 70 | // ... use PointerHolder or shared_ptr as needed | 71 | // ... use PointerHolder or shared_ptr as needed |
| @@ -75,8 +76,6 @@ | @@ -75,8 +76,6 @@ | ||
| 75 | // to increase POINTERHOLDER_TRANSITION in steps of 1 so that you can | 76 | // to increase POINTERHOLDER_TRANSITION in steps of 1 so that you can |
| 76 | // test and handle changes incrementally. | 77 | // test and handle changes incrementally. |
| 77 | 78 | ||
| 78 | -// *** Transitions available starting at qpdf 10.6.0 *** | ||
| 79 | - | ||
| 80 | // POINTERHOLDER_TRANSITION = 1 | 79 | // POINTERHOLDER_TRANSITION = 1 |
| 81 | // | 80 | // |
| 82 | // PointerHolder<T> has an implicit constructor that takes a T*, so | 81 | // PointerHolder<T> has an implicit constructor that takes a T*, so |
| @@ -93,14 +92,15 @@ | @@ -93,14 +92,15 @@ | ||
| 93 | // | 92 | // |
| 94 | // Also defined is a make_pointer_holder method that acts like | 93 | // Also defined is a make_pointer_holder method that acts like |
| 95 | // std::make_shared. You can use this as well, but it is not | 94 | // std::make_shared. You can use this as well, but it is not |
| 96 | -// compatible with qpdf prior to 10.6. Like std::make_shared<T>, | ||
| 97 | -// make_pointer_holder<T> can only be used when the constructor | ||
| 98 | -// implied by its arguments is public. If you use this, you should be | ||
| 99 | -// able to just replace it with std::make_shared when qpdf 11 is out. | 95 | +// compatible with qpdf prior to 10.6 and not necessary with qpdf |
| 96 | +// newer than 10.6.3. Like std::make_shared<T>, make_pointer_holder<T> | ||
| 97 | +// can only be used when the constructor implied by its arguments is | ||
| 98 | +// public. If you previously used this, you can replace it width | ||
| 99 | +// std::make_shared now. | ||
| 100 | 100 | ||
| 101 | // POINTERHOLDER_TRANSITION = 2 | 101 | // POINTERHOLDER_TRANSITION = 2 |
| 102 | // | 102 | // |
| 103 | -// std::shared_ptr as get() and use_count(). PointerHolder has | 103 | +// std::shared_ptr has get() and use_count(). PointerHolder has |
| 104 | // getPointer() and getRefcount(). In 10.6.0, get() and use_count() | 104 | // getPointer() and getRefcount(). In 10.6.0, get() and use_count() |
| 105 | // were added as well. When POINTERHOLDER_TRANSITION = 2, getPointer() | 105 | // were added as well. When POINTERHOLDER_TRANSITION = 2, getPointer() |
| 106 | // and getRefcount() are deprecated. Fix deprecation warnings by | 106 | // and getRefcount() are deprecated. Fix deprecation warnings by |
| @@ -113,11 +113,6 @@ | @@ -113,11 +113,6 @@ | ||
| 113 | // with std::shared_ptr are shared arrays and containers, and neither | 113 | // with std::shared_ptr are shared arrays and containers, and neither |
| 114 | // of these are used in the qpdf API. | 114 | // of these are used in the qpdf API. |
| 115 | 115 | ||
| 116 | -// *** Transitions available starting at qpdf 11.0.0 ** | ||
| 117 | - | ||
| 118 | -// NOTE: Until qpdf 11 is released, this is a plan and is subject to | ||
| 119 | -// change. Be sure to check again after qpdf 11 is released. | ||
| 120 | - | ||
| 121 | // POINTERHOLDER_TRANSITION = 3 | 116 | // POINTERHOLDER_TRANSITION = 3 |
| 122 | // | 117 | // |
| 123 | // Warn for all use of PointerHolder<T>. This helps you remove all use | 118 | // Warn for all use of PointerHolder<T>. This helps you remove all use |