From boris at codesynthesis.com Tue Jul 1 04:17:59 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jul 1 04:22:46 2014 Subject: EXT :Re: [xsde-users] C1061: Blocks nested too deeply In-Reply-To: References: Message-ID: Hi Tony, Holzer, Tony (AS) writes: > Boris, > Thanks for the quick reply. > What is the easiest way to remove the C++ enum interface? You can customize the generated type using the --custom-type option: http://www.codesynthesis.com/projects/xsde/documentation/cxx/hybrid/guide/#4.9 For example: --custom-type MessageTypeEnum=v/xml_schema::string You will still need to provide custom parser and serializer implementations for this type using the options discussed below. It's just that these implementations won't have to be updated when the enum changes. The easiest way to come up with these implementation is to make XSD/e generate parser/serializer implementations for a type like this: And then copy the MessageTypeEnum_pimpl and MessageTypeEnum_simpl into your files. Boris From raviraja at qti.qualcomm.com Mon Jul 14 22:20:20 2014 From: raviraja at qti.qualcomm.com (Rangarajan, Ravi_Sowmian) Date: Mon Jul 14 22:20:30 2014 Subject: [xsde-users] Q: Overriding an optional field (BaseURL) Message-ID: <698646F0D0104244B95E527D289651D1353AD827@NASANEXD02B.na.qualcomm.com> Dear Code Synthesis Expert, I have attached a sample schema file that is used to parse certain XML files. Among that, I have been able to override availablityStartTime field in the parsed/cached copy, say it is pointed to by myMPD ptr. This doesn't change the original file parsed in the disk, rather only the parsed copy is altered. if (myMPD->availabilityStartTime().present()) { myMPD->availabilityStartTime().set(dateTimeDesired); } Similarly, I want to change another optional field called BaseURL, which can be present in 4 different places. Unlike availabilityStartTime field, the generated code doesn't show get or set or present functions for BaseURL field. And, the way it is accessed right now is MPD_2011::MPDtype::BaseURL_sequence &BaseURLseq = myMPD->BaseURL(); MPD_2011::MPDtype::BaseURL_iterator baseUrlIter = BaseURLseq.begin(); if (baseUrlIter != BaseURLseq.end()) { std::string baseUrlRead = *baseUrlter; } I want to override BaseURL field in the parsed copy with customBaseUrl which is an std::string, so that whoever is using this parsed copy can use the same value, customBaseUrl. Q: What is the best way to get a handle on BaseURL and assign customBaseURL string to the first BaseURL in the sequence (even if there are multiple BaseURL items). Can you pls. give me some sample steps that I can try? If I do *baseUrlIter = customBaseUrl, it doesn't like it. If I construct a const ::xml_schema::uri uriOverride (customBaseUrl) and then do the assignment *baseUrlIter = uriOverride, it still doesn't like it either. Thank you in advance Ravi -------------- next part -------------- A non-text attachment was scrubbed... Name: MPD2.xsd Type: text/xml Size: 17105 bytes Desc: MPD2.xsd Url : http://codesynthesis.com/pipermail/xsde-users/attachments/20140715/49280482/MPD2.bin From boris at codesynthesis.com Tue Jul 15 02:46:09 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jul 15 02:51:14 2014 Subject: [xsde-users] Q: Overriding an optional field (BaseURL) In-Reply-To: <698646F0D0104244B95E527D289651D1353AD827@NASANEXD02B.na.qualcomm.com> References: <698646F0D0104244B95E527D289651D1353AD827@NASANEXD02B.na.qualcomm.com> Message-ID: Hi Ravi, Rangarajan, Ravi_Sowmian writes: > If I do *baseUrlIter = customBaseUrl, it doesn't like it. This should work. Specifically: MPD_2011::MPDtype::BaseURL_sequence &BaseURLseq = myMPD->BaseURL(); MPD_2011::MPDtype::BaseURL_iterator baseUrlIter = BaseURLseq.begin(); if (baseUrlIter != BaseURLseq.end()) { *baseUrlIter = customBaseUrl; } If this still doesn't work, can you be more specific than "it doesn't like it" (i.e., compiler error, runtime behaviour is wrong, etc)? Boris From raviraja at qti.qualcomm.com Tue Jul 15 14:47:03 2014 From: raviraja at qti.qualcomm.com (Rangarajan, Ravi_Sowmian) Date: Tue Jul 15 14:47:12 2014 Subject: [xsde-users] Q: Overriding an optional field (BaseURL) In-Reply-To: References: <698646F0D0104244B95E527D289651D1353AD827@NASANEXD02B.na.qualcomm.com> Message-ID: <698646F0D0104244B95E527D289651D1353AFC47@NASANEXD02B.na.qualcomm.com> Hi Boris, Thanks so much for your response. I have included the errors I get for option 1, which you think should work. I have also tried few other options and errors for those included below. It will be great to hear from you on what is missing and get it resolved. Thanks Ravi 1) *baseUrlIter = customBaseUrl Mymodule.cpp:1417: error: no match for operator= in baseUrlIter.xsd::cxx::tree::iterator_adapter::operator* [with I = __gnu_cxx::__normal_iterator > >, T = mpd_2011::BaseURLType]() = customBaseUrl ../../../../../lib/eps/epc/bmsc/xsd/MPD2.h:3646: note: candidates are: mpd_2011::BaseURLType& mpd_2011::BaseURLType::operator=(const mpd_2011::BaseURLType&) In file included from ../../../../../thirdParty/codesynthesis/libxsd/xsd/cxx/tree/list.hxx:16, from ../../../../../thirdParty/codesynthesis/libxsd/xsd/cxx/tree/types.hxx:26, from ../../../../../lib/eps/epc/bmsc/xsd/xml.h:62, from Mymodule.h:39, from Mymodule.cpp:43 The other alternatives I have thought about (not successful yet in getting either to work) are: a) (*baseUrlIter).serviceLocation.set(customBaseUrl); (*baseUrlIter).byteRange.set("") c) construct an object of type BaseUrlType say newBaseUrl and then assign to (*baseUrlIter) = newBaseUrl; But am getting errors below for option a and I haven't been successful constructing a BaseURLType object that can be assigned to (*baseUrlIter). Mymodule.cpp:1150: error: burlIter.xsd::cxx::tree::iterator_adapter::operator* [with I = __gnu_cxx::__normal_iterator > >, T = mpd_2011::BaseURLType]()->mpd_2011::BaseURLType::serviceLocation does not have class type -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Monday, July 14, 2014 11:46 PM To: Rangarajan, Ravi_Sowmian Cc: xsde-users@codesynthesis.com Subject: Re: [xsde-users] Q: Overriding an optional field (BaseURL) Hi Ravi, Rangarajan, Ravi_Sowmian writes: > If I do *baseUrlIter = customBaseUrl, it doesn't like it. This should work. Specifically: MPD_2011::MPDtype::BaseURL_sequence &BaseURLseq = myMPD->BaseURL(); MPD_2011::MPDtype::BaseURL_iterator baseUrlIter = BaseURLseq.begin(); if (baseUrlIter != BaseURLseq.end()) { *baseUrlIter = customBaseUrl; } If this still doesn't work, can you be more specific than "it doesn't like it" (i.e., compiler error, runtime behaviour is wrong, etc)? Boris