[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] newline in C++ variables
From: |
Greg Chicares |
Subject: |
Re: [lmi] newline in C++ variables |
Date: |
Sat, 12 Sep 2009 12:11:28 +0000 |
User-agent: |
Thunderbird 2.0.0.21 (Windows/20090302) |
On 2009-09-10 17:52Z, Wendy Boutin wrote:
> On 2009-09-10 13:15, Vaclav Slavik wrote:
>> On Thu, 2009-09-10 at 12:16 -0400, Wendy Boutin wrote:
>>> The xml file that's fed to 'fop' (this message
>>> http://lists.nongnu.org/archive/html/lmi/2008-12/msg00006.html
>>> shows how to get that xml file) contains only one
>>> paragraph, so I'm thinking the breakdown in the
>>> pipeline is: C++ --> xml
>>
>> Certainly. What exactly are you doing with the string? In other words,
>> how can I reproduce this behavior? I can't find anything similar in the
>> public sources.
>
> I thought this change:
>
> Index: ihs_proddata.cpp
> ===================================================================
> RCS file: /sources/lmi/lmi/ihs_proddata.cpp,v
> retrieving revision 1.21
> diff -u -2 -r1.21 ihs_proddata.cpp
> --- ihs_proddata.cpp 18 Feb 2009 22:12:11 -0000 1.21
> +++ ihs_proddata.cpp 10 Sep 2009 17:40:27 -0000
> @@ -344,5 +344,8 @@
> foo.GuarSpecAmtLoadFilename = "sample";
> foo.PolicyForm = "UL32768-NY";
> - foo.PolicyMktgName = "UL Supreme";
> +// foo.PolicyMktgName = "UL Supreme";
> + foo.PolicyMktgName = "This is paragraph one."
> + "\n"
> + "This is paragraph two.";
> foo.PolicyLegalName = "Flexible Premium Adjustable Life Insurance
> Policy";
> foo.InsCoShortName = "Superior Life";
>
> would simulate what I'm trying to do with the proprietary
> sources, but it caused this strange error instead:
>
> Value '(800) 555-1212' invalid for type '12mcenum_state'.
> [file /opt/lmi/src/lmi/mc_enum.tpp, line 203]
Here's how the variable you changed, 'PolicyMktgName', is
read and written in 'ihs_proddata.cpp':
Read():
std::getline(is, PolicyMktgName, '\n');
Write():
os << PolicyMktgName << '\n';
That's how all data members are handled.
They're newline-delimited records--so this part of the code:
foo.PolicyMktgName = "UL Supreme";
foo.PolicyLegalName = "Flexible Premium Adjustable Life Insurance Policy";
foo.InsCoShortName = "Superior Life";
foo.InsCoName = "Superior Life Insurance Company";
foo.InsCoAddr = "Superior, WI 12345";
foo.InsCoStreet = "246 Main Street";
foo.InsCoPhone = "(800) 555-1212";
foo.InsCoDomicile = "WI";
produces this newline-delimited part of 'sample.pol':
[begin snippet]
UL Supreme
Flexible Premium Adjustable Life Insurance Policy
Superior Life
Superior Life Insurance Company
Superior, WI 12345
246 Main Street
(800) 555-1212
WI
[end snippet]
We might wish it were xml instead:
<InsCoPhone>(800) 555-1212</InsCoPhone>
<InsCoDomicile>WI</InsCoDomicile>
but it's not. Instead...
The thirty-first line is 'InsCoPhone': "(800) 555-1212".
The thirty-second line is 'InsCoDomicile': "WI".
Embedding a newline in an earlier member makes the file one
line too long and pushes following members down, so that:
The thirty-second line is 'InsCoDomicile': "(800) 555-1212".
It's a telephone number, but it's read as a USPS state code;
yet there is no US state named "(800) 555-1212", hence:
> Value '(800) 555-1212' invalid for type '12mcenum_state'.
Perhaps it could be made to work by changing the file format
to xml, but that's not an option for a September 30 release.
However...
On 2009-09-10 16:16Z, Wendy Boutin wrote:
> Instead of '\n', I tried writing ' ', which seems
> to display exactly ' ' at the end of the first
> paragraph. A carriage return ('\r') didn't work either.
...exactly what happens when you use a carriage return
instead of a newline character?
- [lmi] newline in C++ variables, Wendy Boutin, 2009/09/10
- Re: [lmi] newline in C++ variables, Vaclav Slavik, 2009/09/10
- Re: [lmi] newline in C++ variables, Wendy Boutin, 2009/09/10
- Re: [lmi] newline in C++ variables,
Greg Chicares <=
- Re: [lmi] newline in C++ variables, Wendy Boutin, 2009/09/12
- Re: [lmi] newline in C++ variables, Greg Chicares, 2009/09/12
- Re: [lmi] newline in C++ variables, Wendy Boutin, 2009/09/12
- Re: [lmi] newline in C++ variables, Greg Chicares, 2009/09/15
- Re: [lmi] newline in C++ variables, Vaclav Slavik, 2009/09/15