1 /*
2  *
3  *  Copyright (C) 1994-2002, OFFIS
4  *
5  *  This software and supporting documentation were developed by
6  *
7  *    Kuratorium OFFIS e.V.
8  *    Healthcare Information and Communication Systems
9  *    Escherweg 2
10  *    D-26121 Oldenburg, Germany
11  *
12  *  THIS SOFTWARE IS MADE AVAILABLE,  AS IS,  AND OFFIS MAKES NO  WARRANTY
13  *  REGARDING  THE  SOFTWARE,  ITS  PERFORMANCE,  ITS  MERCHANTABILITY  OR
14  *  FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES  OR
15  *  ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
16  *  PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
17  *
18  *  Module:  dcmdata
19  *
20  *  Author:  Gerd Ehlers
21  *
22  *  Purpose: Implementation of class DcmShortText
23  *
24  */
25 
26 
27 #include "dcvrst.h"
28 
29 
30 // ********************************
31 
32 
DcmShortText(const DcmTag & tag,const Uint32 len)33 DcmShortText::DcmShortText(const DcmTag &tag,
34                            const Uint32 len)
35   : DcmCharString(tag, len)
36 {
37     maxLength = 1024;
38 }
39 
40 
DcmShortText(const DcmShortText & old)41 DcmShortText::DcmShortText(const DcmShortText &old)
42   : DcmCharString(old)
43 {
44 }
45 
46 
~DcmShortText()47 DcmShortText::~DcmShortText()
48 {
49 }
50 
51 
operator =(const DcmShortText & obj)52 DcmShortText &DcmShortText::operator=(const DcmShortText &obj)
53 {
54     DcmCharString::operator=(obj);
55     return *this;
56 }
57 
58 
59 // ********************************
60 
61 
ident() const62 DcmEVR DcmShortText::ident() const
63 {
64     return EVR_ST;
65 }
66 
67 
getVM()68 unsigned long DcmShortText::getVM()
69 {
70     /* value multiplicity is 1 for non-empty string, 0 otherwise */
71     return (getRealLength() > 0) ? 1 : 0;
72 }
73 
74 
75 // ********************************
76 
77 
getOFString(OFString & stringVal,const unsigned long,OFBool normalize)78 OFCondition DcmShortText::getOFString(OFString &stringVal,
79                                       const unsigned long /*pos*/,
80                                       OFBool normalize)
81 {
82     /* treat backslash as a normal character */
83     return getOFStringArray(stringVal, normalize);
84 }
85 
86 
getOFStringArray(OFString & stringVal,OFBool normalize)87 OFCondition DcmShortText::getOFStringArray(OFString &stringVal,
88                                            OFBool normalize)
89 {
90     /* get string value without handling the "\" as a delimiter */
91     OFCondition l_error = getStringValue(stringVal);
92     if (l_error.good() && normalize)
93         normalizeString(stringVal, !MULTIPART, !DELETE_LEADING, DELETE_TRAILING);
94     return l_error;
95 }
96