Repository: tesseract-ocr/tesseract
File: src/api/altorenderer.cpp (C++)

Code before:
// File:        altorenderer.cpp
// Description: ALTO rendering interface
// Author:      Jake Sebright

// (C) Copyright 2018
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "baseapi.h"
#include <memory.h>
#include "renderer.h"

namespace tesseract {

    ///
    /// Add coordinates to specified TextBlock, TextLine, or String bounding box
    /// Add word confidence if adding to a String bounding box
    ///
    static void AddBoxToAlto(const ResultIterator *it, PageIteratorLevel level,
                             STRING *alto_str) {
        int left, top, right, bottom;
        it->BoundingBox(level, &left, &top, &right, &bottom);

        int hpos = left;
        int vpos = top;
        int height = bottom - top;
        int width = right - left;

        *alto_str += " HPOS=\"";
        alto_str->add_str_int("", hpos);
        *alto_str += "\"";
        *alto_str += " VPOS=\"";
        alto_str->add_str_int("", vpos);
        *alto_str += "\"";
        *alto_str += " WIDTH=\"";

Review comment (suggestion):
```suggestion
#include <memory>            // for unique_ptr
```

Code after:
// File:        altorenderer.cpp
// Description: ALTO rendering interface
// Author:      Jake Sebright

// (C) Copyright 2018
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "baseapi.h"
#include <memory>
#include "renderer.h"

namespace tesseract {

    ///
    /// Add coordinates to specified TextBlock, TextLine, or String bounding box
    /// Add word confidence if adding to a String bounding box
    ///
    static void AddBoxToAlto(const ResultIterator *it, PageIteratorLevel level,
                             STRING *alto_str) {
        int left, top, right, bottom;
        it->BoundingBox(level, &left, &top, &right, &bottom);

        int hpos = left;
        int vpos = top;
        int height = bottom - top;
        int width = right - left;

        *alto_str += " HPOS=\"";
        alto_str->add_str_int("", hpos);
        *alto_str += "\"";
        *alto_str += " VPOS=\"";
        alto_str->add_str_int("", vpos);
        *alto_str += "\"";
        *alto_str += " WIDTH=\"";