aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Dictionaries/Embedded/GeodataProviders/NamesFormatReader.cpp
blob: 9d0c57f18eb0cb8e6cf7ea7658fde016a5ce8263 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "NamesFormatReader.h"

#include <IO/ReadHelpers.h>


bool LanguageRegionsNamesFormatReader::readNext(RegionNameEntry & entry)
{
    while (!input->eof())
    {
        Int32 read_region_id;
        std::string region_name;

        DB::readIntText(read_region_id, *input);
        DB::assertChar('\t', *input);
        DB::readString(region_name, *input);
        DB::assertChar('\n', *input);

        if (read_region_id <= 0)
            continue;

        entry.id = read_region_id;
        entry.name = region_name;
        return true;
    }

    return false;
}