Coverage Report

Created: 2023-12-08 06:59

/src/aspell/common/string_map.cpp
Line
Count
Source (jump to first uncovered line)
1
#include <string.h>
2
#include <assert.h>
3
4
#include "parm_string.hpp"
5
#include "string_map.hpp"
6
#include "string_pair.hpp"
7
#include "string_pair_enumeration.hpp"
8
9
#include "hash-t.hpp"
10
11
// This file is part of The New Aspell
12
// Copyright (C) 2001 by Kevin Atkinson under the GNU LGPL license
13
// version 2.0 or 2.1.  You should have received a copy of the LGPL
14
// license along with this library if you did not you can find
15
// it at http://www.gnu.org/.
16
17
namespace acommon {
18
19
  // needed for darwin
20
  template HashTable<StringMap::Parms>::iterator 
21
           HashTable<StringMap::Parms>::find_i(char const* const&, bool&);
22
  template std::pair<HashTable<StringMap::Parms>::iterator,bool>
23
           HashTable<StringMap::Parms>::insert(const StringPair &);
24
  template void HashTable<StringMap::Parms>::init(unsigned int);
25
  template void HashTable<StringMap::Parms>::del(void);
26
  template HashTable<StringMap::Parms>::size_type
27
           HashTable<StringMap::Parms>::erase(char const* const&);
28
  template void BlockSList<StringPair>::clear(void);
29
30
  void StringMap::copy(const StringMap & other)
31
11.9k
  {
32
11.9k
    lookup_ = other.lookup_;
33
11.9k
    for (Iter_ i = lookup_.begin(); 
34
662k
         !(i == lookup_.end());  // i != lookup_.end() causes problems
35
                                 // with gcc-2.95
36
650k
         ++i)
37
650k
    {
38
650k
      i->first = buffer_.dup(i->first);
39
650k
      i->second = buffer_.dup(i->second);
40
650k
    }
41
11.9k
  }
42
  
43
44
  class StringMapEnumeration : public StringPairEnumeration {
45
    StringMap::CIter_ i;
46
    StringMap::CIter_ end;
47
  public:
48
    StringMapEnumeration(StringMap::CIter_ i0, StringMap::CIter_ e0)
49
0
      : i(i0), end(e0) {}
50
    StringPairEnumeration * clone() const;
51
    void assign(const StringPairEnumeration *);
52
    bool at_end() const;
53
    StringPair next();
54
  };
55
56
0
  StringPairEnumeration * StringMapEnumeration::clone() const {
57
0
    return new StringMapEnumeration(*this);
58
0
  }
59
60
  void 
61
  StringMapEnumeration::assign
62
  (const StringPairEnumeration * other)
63
0
  {
64
0
    *this = *(const StringMapEnumeration *)(other);
65
0
  }
66
67
0
  bool StringMapEnumeration::at_end() const {
68
0
    return i == end;
69
0
  }
70
71
0
  StringPair StringMapEnumeration::next() {
72
0
    StringPair temp;
73
0
    if (i == end)
74
0
      return temp;
75
0
    temp = *i;
76
0
    ++i;
77
0
    return temp;
78
0
  }
79
80
0
  StringPairEnumeration * StringMap::elements() const {
81
0
    return new StringMapEnumeration(lookup_.begin(), lookup_.end());
82
0
  }
83
84
  StringMap * new_string_map() 
85
0
  {
86
0
    return new StringMap();
87
0
  }
88
}
89