1 /* 2 * 3 * Copyright (C) 2015-2017, 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: Interface of class DcmUnlimitedCharacters 19 * 20 */ 21 22 23 #ifndef DCVRUC_H 24 #define DCVRUC_H 25 26 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 27 28 #include "dcmtk/dcmdata/dctypes.h" 29 #include "dcmtk/dcmdata/dcchrstr.h" 30 31 32 /** a class representing the DICOM value representation 'Unlimited Characters' (UC) 33 */ 34 class DCMTK_DCMDATA_EXPORT DcmUnlimitedCharacters 35 : public DcmCharString 36 { 37 38 public: 39 40 /** constructor 41 * @param tag attribute tag 42 * @param len length of the attribute value 43 */ 44 DcmUnlimitedCharacters(const DcmTag &tag, 45 const Uint32 len = 0); 46 47 /** copy constructor 48 * @param old element to be copied 49 */ 50 DcmUnlimitedCharacters(const DcmUnlimitedCharacters &old); 51 52 /** destructor 53 */ 54 virtual ~DcmUnlimitedCharacters(); 55 56 /** copy assignment operator 57 * @param obj element to be copied 58 * @return reference to this object 59 */ 60 DcmUnlimitedCharacters &operator=(const DcmUnlimitedCharacters &obj); 61 62 /** clone method 63 * @return deep copy of this object 64 */ clone()65 virtual DcmObject *clone() const 66 { 67 return new DcmUnlimitedCharacters(*this); 68 } 69 70 /** Virtual object copying. This method can be used for DcmObject 71 * and derived classes to get a deep copy of an object. Internally 72 * the assignment operator is called if the given DcmObject parameter 73 * is of the same type as "this" object instance. If not, an error 74 * is returned. This function permits copying an object by value 75 * in a virtual way which therefore is different to just calling the 76 * assignment operator of DcmElement which could result in slicing 77 * the object. 78 * @param rhs - [in] The instance to copy from. Has to be of the same 79 * class type as "this" object 80 * @return EC_Normal if copying was successful, error otherwise 81 */ 82 virtual OFCondition copyFrom(const DcmObject& rhs); 83 84 /** get element type identifier 85 * @return type identifier of this class (EVR_UC) 86 */ 87 virtual DcmEVR ident() const; 88 89 /** check whether stored value conforms to the VR and to the specified VM. 90 * Currently, the VR checker only supports ASCII (ISO_IR 6) and Latin-1 (ISO_IR 100). 91 * All other specific character sets disable the check of the value representation. 92 * @param vm value multiplicity (according to the data dictionary) to be checked for. 93 * (See DcmElement::checkVM() for a list of valid values.) 94 * @param oldFormat parameter not used for this VR (only for DA, TM) 95 * @return status of the check, EC_Normal if value is correct, an error code otherwise 96 */ 97 virtual OFCondition checkValue(const OFString &vm = "", 98 const OFBool oldFormat = OFFalse); 99 100 /** get a copy of a particular string component 101 * @param stringVal variable in which the result value is stored 102 * @param pos index of the value in case of multi-valued elements (0..vm-1) 103 * @param normalize delete leading and trailing spaces if OFTrue 104 * @return status, EC_Normal if successful, an error code otherwise 105 */ 106 virtual OFCondition getOFString(OFString &stringVal, 107 const unsigned long pos, 108 OFBool normalize = OFTrue); 109 110 /* --- static helper functions --- */ 111 112 /** check whether given string value conforms to the VR "UC" (Unlimited Characters) 113 * and to the specified VM. 114 * @param value string value to be checked 115 * @param vm value multiplicity (according to the data dictionary) to be checked for. 116 * (See DcmElement::checkVM() for a list of valid values.) 117 * @param charset character set (according to the value of the SpecificCharacterSet 118 * element) to be used for checking the string value. The default is ASCII (7-bit). 119 * Currently, the VR checker only supports ASCII (ISO_IR 6) and Latin-1 (ISO_IR 100). 120 * All other values disable the check of the value representation, e.g. "UNKNOWN". 121 * @return status of the check, EC_Normal if value is correct, an error code otherwise 122 */ 123 static OFCondition checkStringValue(const OFString &value, 124 const OFString &vm = "1-n", 125 const OFString &charset = ""); 126 }; 127 128 129 #endif // DCVRUC_H 130