From 28f737a15d9ce5d9e8b06ab768ef858c07ae510e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 5 Sep 2023 15:20:13 +0300 Subject: Make c++11 value default for xsd --std option Also add support for c++14, c++17, c++20, and c++23 values and drop passing --std option in tests and examples. --- xsd/doc/cxx/parser/guide/index.xhtml.in | 19 +++++++++---------- xsd/doc/cxx/tree/guide/index.xhtml.in | 14 ++++++-------- xsd/doc/pregenerated/xsd.1 | 22 ++++++++++++++++------ xsd/doc/pregenerated/xsd.xhtml | 22 ++++++++++++++-------- xsd/doc/xsd-epilogue.1 | 17 ++++++++++++----- xsd/doc/xsd-epilogue.xhtml | 14 +++++++++----- 6 files changed, 66 insertions(+), 42 deletions(-) (limited to 'xsd/doc') diff --git a/xsd/doc/cxx/parser/guide/index.xhtml.in b/xsd/doc/cxx/parser/guide/index.xhtml.in index 96d06e2..119f421 100644 --- a/xsd/doc/cxx/parser/guide/index.xhtml.in +++ b/xsd/doc/cxx/parser/guide/index.xhtml.in @@ -553,7 +553,7 @@

-$ xsd cxx-parser --std c++11 --xml-parser expat hello.xsd
+$ xsd cxx-parser --xml-parser expat hello.xsd
   

The --xml-parser option indicates that we want to @@ -1494,7 +1494,7 @@ gender ::gender ::gender; option to let the XSD compiler know about our type map:

-$ xsd cxx-parser --std c++11 --type-map people.map people.xsd
+$ xsd cxx-parser --type-map people.map people.xsd
   

If we now look at the generated people-pskel.hxx, @@ -1673,10 +1673,10 @@ namespace http://www.w3.org/2001/XMLSchema QName xml_schema::qname; - base64Binary std::[auto|unique]_ptr<xml_schema::buffer> - std::[auto|unique]_ptr<xml_schema::buffer>; - hexBinary std::[auto|unique]_ptr<xml_schema::buffer> - std::[auto|unique]_ptr<xml_schema::buffer>; + base64Binary std::[unique|auto]_ptr<xml_schema::buffer> + std::[unique|auto]_ptr<xml_schema::buffer>; + hexBinary std::[unique|auto]_ptr<xml_schema::buffer> + std::[unique|auto]_ptr<xml_schema::buffer>; date xml_schema::date; dateTime xml_schema::date_time; @@ -1742,8 +1742,7 @@ people ::people; recompile our schema and move on to implementing the parsers:

-$ xsd cxx-parser --std c++11 --xml-parser expat --type-map people.map \
-      people.xsd
+$ xsd cxx-parser --xml-parser expat --type-map people.map people.xsd
   

Here is the implementation of our three parsers in full. One @@ -2608,14 +2607,14 @@ private: base64Binary base64_binary_pimpl - std::[auto|unique]_ptr< xml_schema::buffer>
+ std::[unique|auto]_ptr< xml_schema::buffer>
Section 6.3, "base64Binary and hexBinary Parsers" hexBinary hex_binary_pimpl - std::[auto|unique]_ptr< xml_schema::buffer>
+ std::[unique|auto]_ptr< xml_schema::buffer>
Section 6.3, "base64Binary and hexBinary Parsers" diff --git a/xsd/doc/cxx/tree/guide/index.xhtml.in b/xsd/doc/cxx/tree/guide/index.xhtml.in index b704e50..2f7f1e2 100644 --- a/xsd/doc/cxx/tree/guide/index.xhtml.in +++ b/xsd/doc/cxx/tree/guide/index.xhtml.in @@ -536,7 +536,7 @@

-$ xsd cxx-tree --std c++11 hello.xsd
+$ xsd cxx-tree hello.xsd
   

The XSD compiler produces two C++ files: hello.hxx and @@ -633,7 +633,7 @@ hello (std::istream&); select C++98:

-$ xsd cxx-tree hello.xsd
+$ xsd cxx-tree --std c++98 hello.xsd
   

Then the parsing function signatures will become:

@@ -726,7 +726,7 @@ Hello, world! it with the --generate-serialization options:

-$ xsd cxx-tree --std c++11 --generate-serialization hello.xsd
+$ xsd cxx-tree --generate-serialization hello.xsd
   

If we now examine the generated hello.hxx file, @@ -911,7 +911,7 @@ main (int argc, char* argv[]) change the type naming scheme:

-$ xsd cxx-tree --std c++11 --type-naming ucc hello.xsd
+$ xsd cxx-tree --type-naming ucc hello.xsd
   

The ucc argument to the --type-naming @@ -978,8 +978,7 @@ hello (std::istream&); --type-regex option:

-$ xsd cxx-tree --std c++11 --type-naming ucc \
-      --type-regex '/ (.+)_t/\u$1/' hello.xsd
+$ xsd cxx-tree --type-naming ucc --type-regex '/ (.+)_t/\u$1/' hello.xsd
   

This results in the following changes to the generated code:

@@ -1114,8 +1113,7 @@ hello (std::istream&); our schema with the --generate-doxygen option:

-$ xsd cxx-tree --std c++11 --generate-serialization --generate-doxygen \
-      hello.xsd
+$ xsd cxx-tree --generate-serialization --generate-doxygen hello.xsd
   

Now the generated hello.hxx file contains comments diff --git a/xsd/doc/pregenerated/xsd.1 b/xsd/doc/pregenerated/xsd.1 index 7d2727f..0cf4f6f 100644 --- a/xsd/doc/pregenerated/xsd.1 +++ b/xsd/doc/pregenerated/xsd.1 @@ -119,12 +119,15 @@ if any, should appear after the corresponding . .IP "\fB--std\fR \fIversion\fR" Specify the C++ standard that the generated code should conform to\. Valid -values are \fBc++98\fR (default) and \fBc++11\fR\. +values are \fBc++98\fR, \fBc++11\fR (default), \fBc++14\fR, \fBc++17\fR, +\fBc++20\fR, and \fBc++23\fR\. The C++ standard affects various aspects of the generated code that are discussed in more detail in various mapping-specific documentation\. Overall, when C++11 is selected, the generated code relies on the move semantics and uses \fBstd::unique_ptr\fR instead of deprecated \fBstd::auto_ptr\fR\. +Currently, there is no difference between the C++11 and the later standards +modes\. When the C++11 mode is selected, you normally don't need to perform any extra steps other than enable C++11 in your C++ compiler, if required\. The XSD @@ -1292,7 +1295,6 @@ namespace http://www.example.com/xmlns/my .br .RE - The compiler has a number of predefined mapping rules that can be presented as the following map files. The string-based XML Schema built-in types are mapped to either @@ -1303,6 +1305,14 @@ depending on the character type selected with the .B --char-type option .RB ( char +by default). The binary XML Schema types are mapped to either +.B std::unique_ptr +or +.B std::auto_ptr +depending on the C++ standard selected with the +.B --std +option +.RB ( c++11 by default). .RS @@ -1382,13 +1392,13 @@ namespace http://www.w3.org/2001/XMLSchema QName xml_schema::qname; .br - base64Binary std::auto_ptr + base64Binary std::[unique|auto]_ptr .br - std::auto_ptr; + std::[unique|auto]_ptr; .br - hexBinary std::auto_ptr + hexBinary std::[unique|auto]_ptr .br - std::auto_ptr; + std::[unique|auto]_ptr; .br date xml_schema::date; diff --git a/xsd/doc/pregenerated/xsd.xhtml b/xsd/doc/pregenerated/xsd.xhtml index d7d1ee3..ae90b41 100644 --- a/xsd/doc/pregenerated/xsd.xhtml +++ b/xsd/doc/pregenerated/xsd.xhtml @@ -124,14 +124,16 @@

--std version
Specify the C++ standard that the generated code should conform to. - Valid values are c++98 (default) and - c++11. + Valid values are c++98, c++11 + (default), c++14, c++17, + c++20, and c++23.

The C++ standard affects various aspects of the generated code that are discussed in more detail in various mapping-specific documentation. Overall, when C++11 is selected, the generated code relies on the move semantics and uses std::unique_ptr instead of - deprecated std::auto_ptr.

+ deprecated std::auto_ptr. Currently, there is no + difference between the C++11 and the later standards modes.

When the C++11 mode is selected, you normally don't need to perform any extra steps other than enable C++11 in your C++ compiler, if required. The @@ -1465,7 +1467,11 @@ namespace http://www.example.com/xmlns/my built-in types are mapped to either std::string or std::wstring depending on the character type selected with the --char-type option - (char by default).

+ (char by default). The binary XML Schema types are + mapped to either std::unique_ptr<xml_schema::buffer> + or std::auto_ptr<xml_schema::buffer> depending on the C++ + standard selected with the --std option + (c++11 by default).

 namespace http://www.w3.org/2001/XMLSchema
@@ -1512,10 +1518,10 @@ namespace http://www.w3.org/2001/XMLSchema
 
   QName xml_schema::qname;
 
-  base64Binary std::auto_ptr<xml_schema::buffer>
-               std::auto_ptr<xml_schema::buffer>;
-  hexBinary std::auto_ptr<xml_schema::buffer>
-            std::auto_ptr<xml_schema::buffer>;
+  base64Binary std::[unique|auto]_ptr<xml_schema::buffer>
+               std::[unique|auto]_ptr<xml_schema::buffer>;
+  hexBinary std::[unique|auto]_ptr<xml_schema::buffer>
+            std::[unique|auto]_ptr<xml_schema::buffer>;
 
   date xml_schema::date;
   dateTime xml_schema::date_time;
diff --git a/xsd/doc/xsd-epilogue.1 b/xsd/doc/xsd-epilogue.1
index a37da89..9ab1952 100644
--- a/xsd/doc/xsd-epilogue.1
+++ b/xsd/doc/xsd-epilogue.1
@@ -381,7 +381,6 @@ namespace http://www.example.com/xmlns/my
 .br
 .RE
 
-
 The compiler has a number of predefined mapping rules that can be
 presented as the following map files. The string-based XML Schema
 built-in types are mapped to either
@@ -392,6 +391,14 @@ depending on the character type selected with the
 .B --char-type
 option
 .RB ( char
+by default). The binary XML Schema types are mapped to either
+.B std::unique_ptr
+or
+.B std::auto_ptr
+depending on the C++ standard selected with the
+.B --std
+option
+.RB ( c++11
 by default).
 
 .RS
@@ -471,13 +478,13 @@ namespace http://www.w3.org/2001/XMLSchema
   QName xml_schema::qname;
 .br
 
-  base64Binary std::auto_ptr
+  base64Binary std::[unique|auto]_ptr
 .br
-               std::auto_ptr;
+               std::[unique|auto]_ptr;
 .br
-  hexBinary std::auto_ptr
+  hexBinary std::[unique|auto]_ptr
 .br
-            std::auto_ptr;
+            std::[unique|auto]_ptr;
 .br
 
   date xml_schema::date;
diff --git a/xsd/doc/xsd-epilogue.xhtml b/xsd/doc/xsd-epilogue.xhtml
index 632b2d9..178cf8b 100644
--- a/xsd/doc/xsd-epilogue.xhtml
+++ b/xsd/doc/xsd-epilogue.xhtml
@@ -290,7 +290,11 @@ namespace http://www.example.com/xmlns/my
      built-in types are mapped to either std::string
      or std::wstring depending on the character type
      selected with the --char-type option
-     (char by default).

+ (char by default). The binary XML Schema types are + mapped to either std::unique_ptr<xml_schema::buffer> + or std::auto_ptr<xml_schema::buffer> depending on the C++ + standard selected with the --std option + (c++11 by default).

 namespace http://www.w3.org/2001/XMLSchema
@@ -337,10 +341,10 @@ namespace http://www.w3.org/2001/XMLSchema
 
   QName xml_schema::qname;
 
-  base64Binary std::auto_ptr<xml_schema::buffer>
-               std::auto_ptr<xml_schema::buffer>;
-  hexBinary std::auto_ptr<xml_schema::buffer>
-            std::auto_ptr<xml_schema::buffer>;
+  base64Binary std::[unique|auto]_ptr<xml_schema::buffer>
+               std::[unique|auto]_ptr<xml_schema::buffer>;
+  hexBinary std::[unique|auto]_ptr<xml_schema::buffer>
+            std::[unique|auto]_ptr<xml_schema::buffer>;
 
   date xml_schema::date;
   dateTime xml_schema::date_time;
-- 
cgit v1.1