OFList<OFString> in "C"

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
martinrame
Posts: 347
Joined: Mon, 2009-02-23, 19:57

OFList<OFString> in "C"

#1 Post by martinrame »

Hi, I'm creating a shared library, and I need to know how to create a "C" interface to OFList<OFString>.

Is there a way to convert, for example a "const char *" to OFList<OFString> ?

Thanks in advance.

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken »

Hi,

sorry, it is not clear to me what you like to do.
Convert a C string to a list?!

Best regards,
Michael

martinrame
Posts: 347
Joined: Mon, 2009-02-23, 19:57

#3 Post by martinrame »

Yes, for example, convert the c string "line one\nline two\nline three" to a list of OFString.

martinrame
Posts: 347
Joined: Mon, 2009-02-23, 19:57

#4 Post by martinrame »

For those insterested in the subject, this is the smallest algorithm I come up with:

Code: Select all

// overrideKeys is a const char * received as a param
// lOverrideKeys is an OFList<OFString>

std::string s1(overrideKeys);
std::istringstream iss(s1);
std::string s2;

while( std::getline( iss, s2, '\n' ) )
{
    OFString word(s2.c_str());
    lOverrideKeys.push_back(word);
}

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest