Skip to content

Commit 8d8d1dd

Browse files
committed
Restructured code of method convertString().
Restructured code of the convertString() method by splitting it into two methods: one for strings without and one for strings with code extension techniques according to ISO 2022. This should increase the readability of the code.
1 parent 739177d commit 8d8d1dd

File tree

2 files changed

+335
-273
lines changed

2 files changed

+335
-273
lines changed

dcmdata/include/dcmtk/dcmdata/dcspchrs.h

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2011-2017, OFFIS e.V.
3+
* Copyright (C) 2011-2025, OFFIS e.V.
44
* All rights reserved. See COPYRIGHT file for details.
55
*
66
* This software and supporting documentation were developed by
@@ -36,7 +36,7 @@ class DcmItem;
3636

3737
/** A class for managing and converting between different DICOM character sets.
3838
* The conversion relies on the OFCharacterEncoding class, which again relies
39-
* on an underlying character encoding library (e.g. libiconv or ICU).
39+
* on an underlying character encoding library (e.g. oficonv or libiconv).
4040
* @note Please note that a current limitation is that only a single value is
4141
* allowed for the destination character set (i.e. no code extensions). Of
4242
* course, for the source character set, also multiple values are supported.
@@ -254,6 +254,37 @@ class DCMTK_DCMDATA_EXPORT DcmSpecificCharacterSet
254254
*/
255255
OFCondition selectCharacterSetWithCodeExtensions(const unsigned long sourceVM);
256256

257+
/** convert the given string from the selected source character set (without
258+
* code extensions) to the selected destination character set
259+
* @param fromString input string to be converted
260+
* @param fromLength length of the input string (in bytes)
261+
* @param toString reference to variable where to store the converted
262+
* string
263+
* @param delimiters string of characters regarded as delimiters
264+
* @return status, EC_Normal if successful, an error code otherwise
265+
*/
266+
OFCondition convertStringWithoutCodeExtensions(const char *fromString,
267+
const size_t fromLength,
268+
OFString &toString,
269+
const OFString &delimiters);
270+
271+
/** convert the given string from the selected source character set(s) to
272+
* the selected destination character set. This method supports code
273+
* extension techniques according to ISO 2022 for the input string.
274+
* @param fromString input string to be converted
275+
* @param fromLength length of the input string (in bytes)
276+
* @param toString reference to variable where to store the
277+
* converted string
278+
* @param delimiters string of characters regarded as delimiters
279+
* @param hasEscapeChar flag indicating wether the input string contains
280+
* one or more escape characters (ESC)
281+
* @return status, EC_Normal if successful, an error code otherwise
282+
*/
283+
OFCondition convertStringWithCodeExtensions(const char *fromString,
284+
const size_t fromLength,
285+
OFString &toString,
286+
const OFString &delimiters,
287+
const OFBool hasEscapeChar);
257288

258289
/** check whether the given string contains at least one escape character
259290
* (ESC), because it is used for code extension techniques like ISO 2022

0 commit comments

Comments
 (0)