Coverage Report

Created: 2026-06-13 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libe-book/src/lib/EBOOKOPFToken.cpp
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/*
3
 * This file is part of the libe-book project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 */
9
10
#include <cstring>
11
12
#include "EBOOKOPFToken.h"
13
14
namespace libebook
15
{
16
namespace
17
{
18
19
#include "EBOOKOPFToken.inc"
20
21
}
22
}
23
24
namespace libebook
25
{
26
27
int getOPFTokenId(const char *const name, const char *const ns)
28
5.91k
{
29
5.91k
  if (ns)
30
5.74k
    return getOPFTokenId(name, strlen(name), ns, strlen(ns));
31
168
  return getOPFTokenId(name, strlen(name));
32
5.91k
}
33
34
int getOPFTokenId(const char *const name, const std::size_t nameLen, const char *const ns, const std::size_t nsLen)
35
5.74k
{
36
5.74k
  return getOPFTokenId(name, nameLen) | (ns ? getOPFTokenId(ns, nsLen) : 0);
37
5.74k
}
38
39
int getOPFTokenId(const char *const name, const std::size_t nameLen)
40
11.6k
{
41
11.6k
  if (!name)
42
0
    return EBOOKOPFToken::INVALID_TOKEN;
43
11.6k
  const Token *const token = Perfect_Hash::in_word_set(name, (unsigned) nameLen);
44
11.6k
  return token ? token->id : EBOOKOPFToken::INVALID_TOKEN;
45
11.6k
}
46
47
}
48
49
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */