Coverage Report

Created: 2023-12-08 06:59

/src/aspell/common/getdata.hpp
Line
Count
Source (jump to first uncovered line)
1
// This file is part of The New Aspell
2
// Copyright (C) 2001 by Kevin Atkinson under the GNU LGPL license
3
// version 2.0 or 2.1.  You should have received a copy of the LGPL
4
// license along with this library if you did not you can find
5
// it at http://www.gnu.org/.
6
7
#ifndef ASPELL_GET_DATA__HPP
8
#define ASPELL_GET_DATA__HPP
9
10
#include <stddef.h>
11
#include <limits.h>
12
#include "string.hpp"
13
#include "mutable_string.hpp"
14
15
namespace acommon {
16
17
  class IStream;
18
  class String;
19
20
  // NOTE: getdata_pair WILL NOT unescape a string
21
22
  struct DataPair {
23
    MutableString key;
24
    MutableString value;
25
    size_t line_num;
26
15.8k
    DataPair() : line_num(0) {}
27
  };
28
29
  bool getdata_pair(IStream & in, DataPair & d, String & buf);
30
31
  char * unescape(char * dest, const char * src);
32
29.1k
  static inline char * unescape(char * dest) {return unescape(dest, dest);}
config.cpp:acommon::unescape(char*)
Line
Count
Source
32
29.1k
  static inline char * unescape(char * dest) {return unescape(dest, dest);}
Unexecuted instantiation: convert.cpp:acommon::unescape(char*)
Unexecuted instantiation: new_filter.cpp:acommon::unescape(char*)
Unexecuted instantiation: new_fmode.cpp:acommon::unescape(char*)
Unexecuted instantiation: find_speller.cpp:acommon::unescape(char*)
Unexecuted instantiation: getdata.cpp:acommon::unescape(char*)
Unexecuted instantiation: info.cpp:acommon::unescape(char*)
Unexecuted instantiation: language.cpp:acommon::unescape(char*)
Unexecuted instantiation: affix.cpp:acommon::unescape(char*)
Unexecuted instantiation: suggest.cpp:acommon::unescape(char*)
Unexecuted instantiation: multi_ws.cpp:acommon::unescape(char*)
Unexecuted instantiation: writable.cpp:acommon::unescape(char*)
Unexecuted instantiation: phonet.cpp:acommon::unescape(char*)
Unexecuted instantiation: typo_editdist.cpp:acommon::unescape(char*)
33
5.35k
  static inline void unescape(MutableString & d) {
34
5.35k
    char * e = unescape(d.str, d.str);
35
5.35k
    d.size = e - d.str;
36
5.35k
  }
Unexecuted instantiation: config.cpp:acommon::unescape(acommon::MutableString&)
Unexecuted instantiation: convert.cpp:acommon::unescape(acommon::MutableString&)
Unexecuted instantiation: new_filter.cpp:acommon::unescape(acommon::MutableString&)
new_fmode.cpp:acommon::unescape(acommon::MutableString&)
Line
Count
Source
33
5.35k
  static inline void unescape(MutableString & d) {
34
5.35k
    char * e = unescape(d.str, d.str);
35
5.35k
    d.size = e - d.str;
36
5.35k
  }
Unexecuted instantiation: find_speller.cpp:acommon::unescape(acommon::MutableString&)
Unexecuted instantiation: getdata.cpp:acommon::unescape(acommon::MutableString&)
Unexecuted instantiation: info.cpp:acommon::unescape(acommon::MutableString&)
Unexecuted instantiation: language.cpp:acommon::unescape(acommon::MutableString&)
Unexecuted instantiation: affix.cpp:acommon::unescape(acommon::MutableString&)
Unexecuted instantiation: suggest.cpp:acommon::unescape(acommon::MutableString&)
Unexecuted instantiation: multi_ws.cpp:acommon::unescape(acommon::MutableString&)
Unexecuted instantiation: writable.cpp:acommon::unescape(acommon::MutableString&)
Unexecuted instantiation: phonet.cpp:acommon::unescape(acommon::MutableString&)
Unexecuted instantiation: typo_editdist.cpp:acommon::unescape(acommon::MutableString&)
37
0
  static inline void unescape(String & d) {
38
0
    d.ensure_null_end();
39
0
    char * e = unescape(d.data(), d.data());
40
0
    d.resize(e - d.data());
41
0
  }
Unexecuted instantiation: config.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: convert.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: new_filter.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: new_fmode.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: find_speller.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: getdata.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: info.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: language.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: affix.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: suggest.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: multi_ws.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: writable.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: phonet.cpp:acommon::unescape(acommon::String&)
Unexecuted instantiation: typo_editdist.cpp:acommon::unescape(acommon::String&)
42
43
  // if limit is not given than dest should have enough space for 
44
  // twice the number of characters of src
45
  bool escape(char * dest, const char * src, 
46
        size_t limit = INT_MAX, const char * others = 0);
47
48
  void to_lower(char *);
49
  void to_lower(String &, const char *);
50
51
  // extract the first whitespace delimited word from d.value and put
52
  // it in d.key.  d.value is expected not to have any leading
53
  // whitespace. The string is modified in place so that d.key will be
54
  // null terminated.  d.value is modified to point to any additional
55
  // data after key with any leading white space removed.  Returns
56
  // false when there are no more words to extract
57
  bool split(DataPair & d);
58
59
  // preps a string for split
60
  void init(ParmString str, DataPair & d, String & buf);
61
62
  bool getline(IStream & in, DataPair & d, String & buf);
63
64
  char * get_nb_line(IStream & in, String & buf);
65
  void remove_comments(String & buf);
66
67
}
68
#endif