Coverage Report

Created: 2026-06-30 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/dcmtk/dcmdata/libsrc/dcvruc.cc
Line
Count
Source
1
/*
2
 *
3
 *  Copyright (C) 2015-2022, OFFIS e.V.
4
 *  All rights reserved.  See COPYRIGHT file for details.
5
 *
6
 *  This software and supporting documentation were developed by
7
 *
8
 *    OFFIS e.V.
9
 *    R&D Division Health
10
 *    Escherweg 2
11
 *    D-26121 Oldenburg, Germany
12
 *
13
 *
14
 *  Module:  dcmdata
15
 *
16
 *  Author:  Joerg Riesmeier
17
 *
18
 *  Purpose: Implementation of class DcmUnlimitedCharacters
19
 *
20
 */
21
22
23
#include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
24
25
#include "dcmtk/dcmdata/dcvruc.h"
26
27
28
// ********************************
29
30
31
DcmUnlimitedCharacters::DcmUnlimitedCharacters(const DcmTag &tag,
32
                                               const Uint32 len)
33
37
  : DcmCharString(tag, len)
34
37
{
35
37
    setMaxLength(DCM_UndefinedLength);
36
37
    setNonSignificantChars(" \\");
37
37
}
38
39
40
DcmUnlimitedCharacters::DcmUnlimitedCharacters(const DcmUnlimitedCharacters &old)
41
0
  : DcmCharString(old)
42
0
{
43
0
}
44
45
46
DcmUnlimitedCharacters::~DcmUnlimitedCharacters()
47
37
{
48
37
}
49
50
51
DcmUnlimitedCharacters &DcmUnlimitedCharacters::operator=(const DcmUnlimitedCharacters &obj)
52
0
{
53
0
    DcmCharString::operator=(obj);
54
0
    return *this;
55
0
}
56
57
58
OFCondition DcmUnlimitedCharacters::copyFrom(const DcmObject& rhs)
59
0
{
60
0
  if (this != &rhs)
61
0
  {
62
0
    if (rhs.ident() != ident()) return EC_IllegalCall;
63
0
    *this = OFstatic_cast(const DcmUnlimitedCharacters &, rhs);
64
0
  }
65
0
  return EC_Normal;
66
0
}
67
68
69
// ********************************
70
71
72
DcmEVR DcmUnlimitedCharacters::ident() const
73
3
{
74
3
    return EVR_UC;
75
3
}
76
77
78
OFCondition DcmUnlimitedCharacters::checkValue(const OFString &vm,
79
                                               const OFBool /*oldFormat*/)
80
0
{
81
0
    OFString strVal;
82
    /* get "raw value" without any modifications (if possible) */
83
0
    OFCondition l_error = getStringValue(strVal);
84
0
    if (l_error.good())
85
0
    {
86
0
        OFString charset;
87
        /* try to determine the value of the SpecificCharacterSet element */
88
0
        if (getSpecificCharacterSet(charset) == EC_CorruptedData)
89
0
            charset = "UNKNOWN";
90
0
        l_error = DcmUnlimitedCharacters::checkStringValue(strVal, vm, charset);
91
0
    }
92
0
    return l_error;
93
0
}
94
95
96
// ********************************
97
98
99
OFCondition DcmUnlimitedCharacters::getOFString(OFString &stringVal,
100
                                                const unsigned long pos,
101
                                                OFBool normalize)
102
0
{
103
0
    OFCondition l_error = DcmCharString::getOFString(stringVal, pos, normalize);
104
0
    if (l_error.good() && normalize)
105
0
        normalizeString(stringVal, !MULTIPART, !DELETE_LEADING, DELETE_TRAILING);
106
0
    return l_error;
107
0
}
108
109
110
// ********************************
111
112
113
OFCondition DcmUnlimitedCharacters::checkStringValue(const OFString &value,
114
                                                     const OFString &vm,
115
                                                     const OFString &charset)
116
0
{
117
0
    return DcmByteString::checkStringValue(value, vm, "uc", 20, 0 /* maxLen: no check */, charset);
118
0
}