! * \brief boxaaCopy() * * \param[in] baas input boxaa to be copied * \param[in] copyflag L_COPY, L_CLONE * \return baad new boxaa, composed of copies or clones of the boxa * in baas, or NULL on error * * * Notes: * (1) L_COPY makes a copy of each boxa in baas. * L_CLONE makes a clone of each boxa in baas. * */
| 1270 | * </pre> |
| 1271 | */ |
| 1272 | BOXAA * |
| 1273 | boxaaCopy(BOXAA *baas, |
| 1274 | l_int32 copyflag) |
| 1275 | { |
| 1276 | l_int32 i, n; |
| 1277 | BOXA *boxa; |
| 1278 | BOXAA *baad; |
| 1279 | |
| 1280 | PROCNAME("boxaaCopy"); |
| 1281 | |
| 1282 | if (!baas) |
| 1283 | return (BOXAA *)ERROR_PTR("baas not defined", procName, NULL); |
| 1284 | if (copyflag != L_COPY && copyflag != L_CLONE) |
| 1285 | return (BOXAA *)ERROR_PTR("invalid copyflag", procName, NULL); |
| 1286 | |
| 1287 | n = boxaaGetCount(baas); |
| 1288 | baad = boxaaCreate(n); |
| 1289 | for (i = 0; i < n; i++) { |
| 1290 | boxa = boxaaGetBoxa(baas, i, copyflag); |
| 1291 | boxaaAddBoxa(baad, boxa, L_INSERT); |
| 1292 | } |
| 1293 | |
| 1294 | return baad; |
| 1295 | } |
| 1296 | |
| 1297 | |
| 1298 | /*! |
nothing calls this directly
no test coverage detected