aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/flatbuffers
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/flatbuffers
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/flatbuffers')
-rw-r--r--contrib/libs/flatbuffers/CONTRIBUTING.md84
-rw-r--r--contrib/libs/flatbuffers/LICENSE.txt404
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/base.h284
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/code_generators.h206
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/flatbuffers.h808
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/flatc.h28
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/flexbuffers.h290
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/grpc.h80
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/hash.h14
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/idl.h730
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/minireflect.h114
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/reflection.h10
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/reflection_generated.h402
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/registry.h4
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/stl_emulation.h142
-rw-r--r--contrib/libs/flatbuffers/include/flatbuffers/util.h598
-rw-r--r--contrib/libs/flatbuffers/ya.make32
17 files changed, 2115 insertions, 2115 deletions
diff --git a/contrib/libs/flatbuffers/CONTRIBUTING.md b/contrib/libs/flatbuffers/CONTRIBUTING.md
index 17428add54..6dbcea9a96 100644
--- a/contrib/libs/flatbuffers/CONTRIBUTING.md
+++ b/contrib/libs/flatbuffers/CONTRIBUTING.md
@@ -1,42 +1,42 @@
-Contributing {#contributing}
-============
-
-Want to contribute? Great! First, read this page (including the small print at
-the end).
-
-# Before you contribute
-Before we can use your code, you must sign the
-[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
-(CLA), which you can do online. The CLA is necessary mainly because you own the
-copyright to your changes, even after your contribution becomes part of our
-codebase, so we need your permission to use and distribute your code. We also
-need to be sure of various other things—for instance that you'll tell us if you
-know that your code infringes on other people's patents. You don't have to sign
-the CLA until after you've submitted your code for review and a member has
-approved it, but you must do it before we can put your code into our codebase.
-Before you start working on a larger contribution, you should get in touch with
-us first through the issue tracker with your idea so that we can help out and
-possibly guide you. Coordinating up front makes it much easier to avoid
-frustration later on.
-
-# Code reviews
-All submissions, including submissions by project members, require review. We
-use Github pull requests for this purpose.
-
-Some tips for good pull requests:
-* Use our code
- [style guide](https://google.github.io/styleguide/cppguide.html).
- When in doubt, try to stay true to the existing code of the project.
-* Write a descriptive commit message. What problem are you solving and what
- are the consequences? Where and what did you test? Some good tips:
- [here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message)
- and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches).
-* If your PR consists of multiple commits which are successive improvements /
- fixes to your first commit, consider squashing them into a single commit
- (`git rebase -i`) such that your PR is a single commit on top of the current
- HEAD. This make reviewing the code so much easier, and our history more
- readable.
-
-# The small print
-Contributions made by corporations are covered by a different agreement than
-the one above, the Software Grant and Corporate Contributor License Agreement.
+Contributing {#contributing}
+============
+
+Want to contribute? Great! First, read this page (including the small print at
+the end).
+
+# Before you contribute
+Before we can use your code, you must sign the
+[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
+(CLA), which you can do online. The CLA is necessary mainly because you own the
+copyright to your changes, even after your contribution becomes part of our
+codebase, so we need your permission to use and distribute your code. We also
+need to be sure of various other things—for instance that you'll tell us if you
+know that your code infringes on other people's patents. You don't have to sign
+the CLA until after you've submitted your code for review and a member has
+approved it, but you must do it before we can put your code into our codebase.
+Before you start working on a larger contribution, you should get in touch with
+us first through the issue tracker with your idea so that we can help out and
+possibly guide you. Coordinating up front makes it much easier to avoid
+frustration later on.
+
+# Code reviews
+All submissions, including submissions by project members, require review. We
+use Github pull requests for this purpose.
+
+Some tips for good pull requests:
+* Use our code
+ [style guide](https://google.github.io/styleguide/cppguide.html).
+ When in doubt, try to stay true to the existing code of the project.
+* Write a descriptive commit message. What problem are you solving and what
+ are the consequences? Where and what did you test? Some good tips:
+ [here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message)
+ and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches).
+* If your PR consists of multiple commits which are successive improvements /
+ fixes to your first commit, consider squashing them into a single commit
+ (`git rebase -i`) such that your PR is a single commit on top of the current
+ HEAD. This make reviewing the code so much easier, and our history more
+ readable.
+
+# The small print
+Contributions made by corporations are covered by a different agreement than
+the one above, the Software Grant and Corporate Contributor License Agreement.
diff --git a/contrib/libs/flatbuffers/LICENSE.txt b/contrib/libs/flatbuffers/LICENSE.txt
index d645695673..c0fd617439 100644
--- a/contrib/libs/flatbuffers/LICENSE.txt
+++ b/contrib/libs/flatbuffers/LICENSE.txt
@@ -1,202 +1,202 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/base.h b/contrib/libs/flatbuffers/include/flatbuffers/base.h
index e2defddb80..9927d4e800 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/base.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/base.h
@@ -2,26 +2,26 @@
#define FLATBUFFERS_BASE_H_
// clang-format off
-
-// If activate should be declared and included first.
+
+// If activate should be declared and included first.
#if defined(FLATBUFFERS_MEMORY_LEAK_TRACKING) && \
defined(_MSC_VER) && defined(_DEBUG)
- // The _CRTDBG_MAP_ALLOC inside <crtdbg.h> will replace
- // calloc/free (etc) to its debug version using #define directives.
+ // The _CRTDBG_MAP_ALLOC inside <crtdbg.h> will replace
+ // calloc/free (etc) to its debug version using #define directives.
#define _CRTDBG_MAP_ALLOC
- #include <stdlib.h>
- #include <crtdbg.h>
- // Replace operator new by trace-enabled version.
- #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
- #define new DEBUG_NEW
+ #include <stdlib.h>
+ #include <crtdbg.h>
+ // Replace operator new by trace-enabled version.
+ #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
+ #define new DEBUG_NEW
#endif
-#if !defined(FLATBUFFERS_ASSERT)
+#if !defined(FLATBUFFERS_ASSERT)
#include <assert.h>
#define FLATBUFFERS_ASSERT assert
-#elif defined(FLATBUFFERS_ASSERT_INCLUDE)
-// Include file with forward declaration
-#include FLATBUFFERS_ASSERT_INCLUDE
+#elif defined(FLATBUFFERS_ASSERT_INCLUDE)
+// Include file with forward declaration
+#include FLATBUFFERS_ASSERT_INCLUDE
#endif
#ifndef ARDUINO
@@ -33,7 +33,7 @@
#include <cstring>
#if defined(ARDUINO) && !defined(ARDUINOSTL_M_H)
- #error #include <utility.h>
+ #error #include <utility.h>
#else
#include <utility>
#endif
@@ -58,37 +58,37 @@
#include <android/api-level.h>
#endif
-#if defined(__ICCARM__)
-#include <intrinsics.h>
-#endif
-
+#if defined(__ICCARM__)
+#include <intrinsics.h>
+#endif
+
// Note the __clang__ check is needed, because clang presents itself
// as an older GNUC compiler (4.2).
// Clang 3.3 and later implement all of the ISO C++ 2011 standard.
// Clang 3.4 and later implement all of the ISO C++ 2014 standard.
// http://clang.llvm.org/cxx_status.html
-// Note the MSVC value '__cplusplus' may be incorrect:
-// The '__cplusplus' predefined macro in the MSVC stuck at the value 199711L,
-// indicating (erroneously!) that the compiler conformed to the C++98 Standard.
-// This value should be correct starting from MSVC2017-15.7-Preview-3.
-// The '__cplusplus' will be valid only if MSVC2017-15.7-P3 and the `/Zc:__cplusplus` switch is set.
-// Workaround (for details see MSDN):
-// Use the _MSC_VER and _MSVC_LANG definition instead of the __cplusplus for compatibility.
-// The _MSVC_LANG macro reports the Standard version regardless of the '/Zc:__cplusplus' switch.
-
-#if defined(__GNUC__) && !defined(__clang__)
- #define FLATBUFFERS_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-#else
- #define FLATBUFFERS_GCC 0
-#endif
-
-#if defined(__clang__)
- #define FLATBUFFERS_CLANG (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
-#else
- #define FLATBUFFERS_CLANG 0
-#endif
-
+// Note the MSVC value '__cplusplus' may be incorrect:
+// The '__cplusplus' predefined macro in the MSVC stuck at the value 199711L,
+// indicating (erroneously!) that the compiler conformed to the C++98 Standard.
+// This value should be correct starting from MSVC2017-15.7-Preview-3.
+// The '__cplusplus' will be valid only if MSVC2017-15.7-P3 and the `/Zc:__cplusplus` switch is set.
+// Workaround (for details see MSDN):
+// Use the _MSC_VER and _MSVC_LANG definition instead of the __cplusplus for compatibility.
+// The _MSVC_LANG macro reports the Standard version regardless of the '/Zc:__cplusplus' switch.
+
+#if defined(__GNUC__) && !defined(__clang__)
+ #define FLATBUFFERS_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+#else
+ #define FLATBUFFERS_GCC 0
+#endif
+
+#if defined(__clang__)
+ #define FLATBUFFERS_CLANG (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
+#else
+ #define FLATBUFFERS_CLANG 0
+#endif
+
/// @cond FLATBUFFERS_INTERNAL
#if __cplusplus <= 199711L && \
(!defined(_MSC_VER) || _MSC_VER < 1600) && \
@@ -102,7 +102,7 @@
#if !defined(__clang__) && \
defined(__GNUC__) && \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 40600)
- // Backwards compatibility for g++ 4.4, and 4.5 which don't have the nullptr
+ // Backwards compatibility for g++ 4.4, and 4.5 which don't have the nullptr
// and constexpr keywords. Note the __clang__ check is needed, because clang
// presents itself as an older GNUC compiler.
#ifndef nullptr_t
@@ -124,9 +124,9 @@
#define FLATBUFFERS_LITTLEENDIAN 0
#endif // __s390x__
#if !defined(FLATBUFFERS_LITTLEENDIAN)
- #if defined(__GNUC__) || defined(__clang__) || defined(__ICCARM__)
- #if (defined(__BIG_ENDIAN__) || \
- (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
+ #if defined(__GNUC__) || defined(__clang__) || defined(__ICCARM__)
+ #if (defined(__BIG_ENDIAN__) || \
+ (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
#define FLATBUFFERS_LITTLEENDIAN 0
#else
#define FLATBUFFERS_LITTLEENDIAN 1
@@ -147,10 +147,10 @@
#define FLATBUFFERS_VERSION_REVISION 0
#define FLATBUFFERS_STRING_EXPAND(X) #X
#define FLATBUFFERS_STRING(X) FLATBUFFERS_STRING_EXPAND(X)
-namespace flatbuffers {
- // Returns version as string "MAJOR.MINOR.REVISION".
- const char* FLATBUFFERS_VERSION();
-}
+namespace flatbuffers {
+ // Returns version as string "MAJOR.MINOR.REVISION".
+ const char* FLATBUFFERS_VERSION();
+}
#if (!defined(_MSC_VER) || _MSC_VER > 1600) && \
(!defined(__GNUC__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 407)) || \
@@ -158,12 +158,12 @@ namespace flatbuffers {
#define FLATBUFFERS_FINAL_CLASS final
#define FLATBUFFERS_OVERRIDE override
#define FLATBUFFERS_EXPLICIT_CPP11 explicit
- #define FLATBUFFERS_VTABLE_UNDERLYING_TYPE : flatbuffers::voffset_t
+ #define FLATBUFFERS_VTABLE_UNDERLYING_TYPE : flatbuffers::voffset_t
#else
#define FLATBUFFERS_FINAL_CLASS
#define FLATBUFFERS_OVERRIDE
#define FLATBUFFERS_EXPLICIT_CPP11
- #define FLATBUFFERS_VTABLE_UNDERLYING_TYPE
+ #define FLATBUFFERS_VTABLE_UNDERLYING_TYPE
#endif
#if (!defined(_MSC_VER) || _MSC_VER >= 1900) && \
@@ -173,7 +173,7 @@ namespace flatbuffers {
#define FLATBUFFERS_CONSTEXPR_CPP11 constexpr
#define FLATBUFFERS_CONSTEXPR_DEFINED
#else
- #define FLATBUFFERS_CONSTEXPR const
+ #define FLATBUFFERS_CONSTEXPR const
#define FLATBUFFERS_CONSTEXPR_CPP11
#endif
@@ -223,7 +223,7 @@ namespace flatbuffers {
// to detect a header that provides an implementation
#if defined(__has_include)
// Check for std::string_view (in c++17)
- #if __has_include(<string_view>) && (__cplusplus >= 201606 || (defined(_HAS_CXX17) && _HAS_CXX17))
+ #if __has_include(<string_view>) && (__cplusplus >= 201606 || (defined(_HAS_CXX17) && _HAS_CXX17))
#include <string_view>
namespace flatbuffers {
typedef std::string_view string_view;
@@ -236,76 +236,76 @@ namespace flatbuffers {
typedef std::experimental::string_view string_view;
}
#define FLATBUFFERS_HAS_STRING_VIEW 1
- // Check for absl::string_view
- #elif __has_include("absl/strings/string_view.h")
- #error #include "absl/strings/string_view.h"
- namespace flatbuffers {
- typedef absl::string_view string_view;
- }
- #define FLATBUFFERS_HAS_STRING_VIEW 1
+ // Check for absl::string_view
+ #elif __has_include("absl/strings/string_view.h")
+ #error #include "absl/strings/string_view.h"
+ namespace flatbuffers {
+ typedef absl::string_view string_view;
+ }
+ #define FLATBUFFERS_HAS_STRING_VIEW 1
#endif
#endif // __has_include
#endif // !FLATBUFFERS_HAS_STRING_VIEW
-#ifndef FLATBUFFERS_HAS_NEW_STRTOD
- // Modern (C++11) strtod and strtof functions are available for use.
- // 1) nan/inf strings as argument of strtod;
- // 2) hex-float as argument of strtod/strtof.
- #if (defined(_MSC_VER) && _MSC_VER >= 1900) || \
- (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || \
- (defined(__clang__))
- #define FLATBUFFERS_HAS_NEW_STRTOD 1
- #endif
-#endif // !FLATBUFFERS_HAS_NEW_STRTOD
-
-#ifndef FLATBUFFERS_LOCALE_INDEPENDENT
- // Enable locale independent functions {strtof_l, strtod_l,strtoll_l, strtoull_l}.
- #if ((defined(_MSC_VER) && _MSC_VER >= 1800) || \
+#ifndef FLATBUFFERS_HAS_NEW_STRTOD
+ // Modern (C++11) strtod and strtof functions are available for use.
+ // 1) nan/inf strings as argument of strtod;
+ // 2) hex-float as argument of strtod/strtof.
+ #if (defined(_MSC_VER) && _MSC_VER >= 1900) || \
+ (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || \
+ (defined(__clang__))
+ #define FLATBUFFERS_HAS_NEW_STRTOD 1
+ #endif
+#endif // !FLATBUFFERS_HAS_NEW_STRTOD
+
+#ifndef FLATBUFFERS_LOCALE_INDEPENDENT
+ // Enable locale independent functions {strtof_l, strtod_l,strtoll_l, strtoull_l}.
+ #if ((defined(_MSC_VER) && _MSC_VER >= 1800) || \
(defined(_XOPEN_VERSION) && (_XOPEN_VERSION>=700)) && (!defined(__ANDROID_API__) || (defined(__ANDROID_API__) && (__ANDROID_API__>=21))))
- #define FLATBUFFERS_LOCALE_INDEPENDENT 1
- #else
- #define FLATBUFFERS_LOCALE_INDEPENDENT 0
- #endif
-#endif // !FLATBUFFERS_LOCALE_INDEPENDENT
-
-// Suppress Undefined Behavior Sanitizer (recoverable only). Usage:
-// - __supress_ubsan__("undefined")
-// - __supress_ubsan__("signed-integer-overflow")
-#if defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))
- #define __supress_ubsan__(type) __attribute__((no_sanitize(type)))
-#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)
- #define __supress_ubsan__(type) __attribute__((no_sanitize_undefined))
-#else
- #define __supress_ubsan__(type)
-#endif
-
-// This is constexpr function used for checking compile-time constants.
-// Avoid `#pragma warning(disable: 4127) // C4127: expression is constant`.
-namespace flatbuffers {
-template<typename T> FLATBUFFERS_CONSTEXPR inline bool IsConstTrue(T t) {
- return !!t;
-}
-}
-
-// Enable C++ attribute [[]] if std:c++17 or higher.
-#if ((__cplusplus >= 201703L) \
- || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
- // All attributes unknown to an implementation are ignored without causing an error.
- #define FLATBUFFERS_ATTRIBUTE(attr) [[attr]]
-
- #define FLATBUFFERS_FALLTHROUGH() [[fallthrough]]
-#else
- #define FLATBUFFERS_ATTRIBUTE(attr)
-
- #if FLATBUFFERS_CLANG >= 30800
- #define FLATBUFFERS_FALLTHROUGH() [[clang::fallthrough]]
- #elif FLATBUFFERS_GCC >= 70300
- #define FLATBUFFERS_FALLTHROUGH() [[gnu::fallthrough]]
- #else
- #define FLATBUFFERS_FALLTHROUGH()
- #endif
-#endif
-
+ #define FLATBUFFERS_LOCALE_INDEPENDENT 1
+ #else
+ #define FLATBUFFERS_LOCALE_INDEPENDENT 0
+ #endif
+#endif // !FLATBUFFERS_LOCALE_INDEPENDENT
+
+// Suppress Undefined Behavior Sanitizer (recoverable only). Usage:
+// - __supress_ubsan__("undefined")
+// - __supress_ubsan__("signed-integer-overflow")
+#if defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))
+ #define __supress_ubsan__(type) __attribute__((no_sanitize(type)))
+#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)
+ #define __supress_ubsan__(type) __attribute__((no_sanitize_undefined))
+#else
+ #define __supress_ubsan__(type)
+#endif
+
+// This is constexpr function used for checking compile-time constants.
+// Avoid `#pragma warning(disable: 4127) // C4127: expression is constant`.
+namespace flatbuffers {
+template<typename T> FLATBUFFERS_CONSTEXPR inline bool IsConstTrue(T t) {
+ return !!t;
+}
+}
+
+// Enable C++ attribute [[]] if std:c++17 or higher.
+#if ((__cplusplus >= 201703L) \
+ || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
+ // All attributes unknown to an implementation are ignored without causing an error.
+ #define FLATBUFFERS_ATTRIBUTE(attr) [[attr]]
+
+ #define FLATBUFFERS_FALLTHROUGH() [[fallthrough]]
+#else
+ #define FLATBUFFERS_ATTRIBUTE(attr)
+
+ #if FLATBUFFERS_CLANG >= 30800
+ #define FLATBUFFERS_FALLTHROUGH() [[clang::fallthrough]]
+ #elif FLATBUFFERS_GCC >= 70300
+ #define FLATBUFFERS_FALLTHROUGH() [[gnu::fallthrough]]
+ #else
+ #define FLATBUFFERS_FALLTHROUGH()
+ #endif
+#endif
+
/// @endcond
/// @file
@@ -327,7 +327,7 @@ typedef uint16_t voffset_t;
typedef uintmax_t largest_scalar_t;
// In 32bits, this evaluates to 2GB - 1
-#define FLATBUFFERS_MAX_BUFFER_SIZE ((1ULL << (sizeof(flatbuffers::soffset_t) * 8 - 1)) - 1)
+#define FLATBUFFERS_MAX_BUFFER_SIZE ((1ULL << (sizeof(flatbuffers::soffset_t) * 8 - 1)) - 1)
// We support aligning the contents of buffers up to this size.
#define FLATBUFFERS_MAX_ALIGNMENT 16
@@ -348,11 +348,11 @@ template<typename T> T EndianSwap(T t) {
#define FLATBUFFERS_BYTESWAP16 _byteswap_ushort
#define FLATBUFFERS_BYTESWAP32 _byteswap_ulong
#define FLATBUFFERS_BYTESWAP64 _byteswap_uint64
- #elif defined(__ICCARM__)
- #define FLATBUFFERS_BYTESWAP16 __REV16
- #define FLATBUFFERS_BYTESWAP32 __REV
- #define FLATBUFFERS_BYTESWAP64(x) \
- ((__REV(static_cast<uint32_t>(x >> 32U))) | (static_cast<uint64_t>(__REV(static_cast<uint32_t>(x)))) << 32U)
+ #elif defined(__ICCARM__)
+ #define FLATBUFFERS_BYTESWAP16 __REV16
+ #define FLATBUFFERS_BYTESWAP32 __REV
+ #define FLATBUFFERS_BYTESWAP64(x) \
+ ((__REV(static_cast<uint32_t>(x >> 32U))) | (static_cast<uint64_t>(__REV(static_cast<uint32_t>(x)))) << 32U)
#else
#if defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ < 408 && !defined(__clang__)
// __builtin_bswap16 was missing prior to GCC 4.8.
@@ -367,20 +367,20 @@ template<typename T> T EndianSwap(T t) {
if (sizeof(T) == 1) { // Compile-time if-then's.
return t;
} else if (sizeof(T) == 2) {
- union { T t; uint16_t i; } u = { t };
+ union { T t; uint16_t i; } u = { t };
u.i = FLATBUFFERS_BYTESWAP16(u.i);
return u.t;
} else if (sizeof(T) == 4) {
- union { T t; uint32_t i; } u = { t };
+ union { T t; uint32_t i; } u = { t };
u.i = FLATBUFFERS_BYTESWAP32(u.i);
return u.t;
} else if (sizeof(T) == 8) {
- union { T t; uint64_t i; } u = { t };
+ union { T t; uint64_t i; } u = { t };
u.i = FLATBUFFERS_BYTESWAP64(u.i);
return u.t;
} else {
FLATBUFFERS_ASSERT(0);
- return t;
+ return t;
}
}
@@ -388,7 +388,7 @@ template<typename T> T EndianSwap(T t) {
#pragma warning(pop)
#endif
-
+
template<typename T> T EndianScalar(T t) {
#if FLATBUFFERS_LITTLEENDIAN
return t;
@@ -397,11 +397,11 @@ template<typename T> T EndianScalar(T t) {
#endif
}
-template<typename T>
-// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details.
-__supress_ubsan__("alignment")
-T ReadScalar(const void *p) {
- return EndianScalar(*reinterpret_cast<const T *>(p));
+template<typename T>
+// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details.
+__supress_ubsan__("alignment")
+T ReadScalar(const void *p) {
+ return EndianScalar(*reinterpret_cast<const T *>(p));
}
// See https://github.com/google/flatbuffers/issues/5950
@@ -411,18 +411,18 @@ T ReadScalar(const void *p) {
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
-template<typename T>
-// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details.
-__supress_ubsan__("alignment")
-void WriteScalar(void *p, T t) {
+template<typename T>
+// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details.
+__supress_ubsan__("alignment")
+void WriteScalar(void *p, T t) {
*reinterpret_cast<T *>(p) = EndianScalar(t);
}
-template<typename T> struct Offset;
-template<typename T> __supress_ubsan__("alignment") void WriteScalar(void *p, Offset<T> t) {
- *reinterpret_cast<uoffset_t *>(p) = EndianScalar(t.o);
-}
-
+template<typename T> struct Offset;
+template<typename T> __supress_ubsan__("alignment") void WriteScalar(void *p, Offset<T> t) {
+ *reinterpret_cast<uoffset_t *>(p) = EndianScalar(t.o);
+}
+
#if (FLATBUFFERS_GCC >= 100000) && (FLATBUFFERS_GCC < 110000)
#pragma GCC diagnostic pop
#endif
@@ -430,7 +430,7 @@ template<typename T> __supress_ubsan__("alignment") void WriteScalar(void *p, Of
// Computes how many bytes you'd have to pad to be able to write an
// "scalar_size" scalar if the buffer had grown to "buf_size" (downwards in
// memory).
-__supress_ubsan__("unsigned-integer-overflow")
+__supress_ubsan__("unsigned-integer-overflow")
inline size_t PaddingBytes(size_t buf_size, size_t scalar_size) {
return ((~buf_size) + 1) & (scalar_size - 1);
}
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/code_generators.h b/contrib/libs/flatbuffers/include/flatbuffers/code_generators.h
index 09b773a468..858780306e 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/code_generators.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/code_generators.h
@@ -19,15 +19,15 @@
#include <map>
#include <sstream>
-
-#include "idl.h"
+
+#include "idl.h"
namespace flatbuffers {
// Utility class to assist in generating code through use of text templates.
//
// Example code:
-// CodeWriter code("\t");
+// CodeWriter code("\t");
// code.SetValue("NAME", "Foo");
// code += "void {{NAME}}() { printf("%s", "{{NAME}}"); }";
// code.SetValue("NAME", "Bar");
@@ -39,8 +39,8 @@ namespace flatbuffers {
// void Bar() { printf("%s", "Bar"); }
class CodeWriter {
public:
- CodeWriter(std::string pad = std::string())
- : pad_(pad), cur_ident_lvl_(0), ignore_ident_(false) {}
+ CodeWriter(std::string pad = std::string())
+ : pad_(pad), cur_ident_lvl_(0), ignore_ident_(false) {}
// Clears the current "written" code.
void Clear() {
@@ -55,11 +55,11 @@ class CodeWriter {
value_map_[key] = value;
}
- std::string GetValue(const std::string &key) const {
- const auto it = value_map_.find(key);
- return it == value_map_.end() ? "" : it->second;
- }
-
+ std::string GetValue(const std::string &key) const {
+ const auto it = value_map_.find(key);
+ return it == value_map_.end() ? "" : it->second;
+ }
+
// Appends the given text to the generated code as well as a newline
// character. Any text within {{ and }} delimiters is replaced by values
// previously stored in the CodeWriter by calling SetValue above. The newline
@@ -69,24 +69,24 @@ class CodeWriter {
// Returns the current contents of the CodeWriter as a std::string.
std::string ToString() const { return stream_.str(); }
- // Increase ident level for writing code
- void IncrementIdentLevel() { cur_ident_lvl_++; }
- // Decrease ident level for writing code
- void DecrementIdentLevel() {
- if (cur_ident_lvl_) cur_ident_lvl_--;
- }
-
+ // Increase ident level for writing code
+ void IncrementIdentLevel() { cur_ident_lvl_++; }
+ // Decrease ident level for writing code
+ void DecrementIdentLevel() {
+ if (cur_ident_lvl_) cur_ident_lvl_--;
+ }
+
void SetPadding(const std::string &padding) { pad_ = padding; }
private:
std::map<std::string, std::string> value_map_;
std::stringstream stream_;
- std::string pad_;
- int cur_ident_lvl_;
- bool ignore_ident_;
-
- // Add ident padding (tab or space) based on ident level
- void AppendIdent(std::stringstream &stream);
+ std::string pad_;
+ int cur_ident_lvl_;
+ bool ignore_ident_;
+
+ // Add ident padding (tab or space) based on ident level
+ void AppendIdent(std::stringstream &stream);
};
class BaseGenerator {
@@ -99,20 +99,20 @@ class BaseGenerator {
static std::string ToDasherizedCase(const std::string pascal_case);
- std::string GeneratedFileName(const std::string &path,
- const std::string &file_name,
- const IDLOptions &options) const;
-
+ std::string GeneratedFileName(const std::string &path,
+ const std::string &file_name,
+ const IDLOptions &options) const;
+
protected:
BaseGenerator(const Parser &parser, const std::string &path,
- const std::string &file_name, std::string qualifying_start,
- std::string qualifying_separator, std::string default_extension)
+ const std::string &file_name, std::string qualifying_start,
+ std::string qualifying_separator, std::string default_extension)
: parser_(parser),
path_(path),
file_name_(file_name),
qualifying_start_(qualifying_start),
- qualifying_separator_(qualifying_separator),
- default_extension_(default_extension) {}
+ qualifying_separator_(qualifying_separator),
+ default_extension_(default_extension) {}
virtual ~BaseGenerator() {}
// No copy/assign.
@@ -134,9 +134,9 @@ class BaseGenerator {
// which works for js and php
virtual const Namespace *CurrentNameSpace() const { return nullptr; }
- // Ensure that a type is prefixed with its namespace even within
- // its own namespace to avoid conflict between generated method
- // names and similarly named classes or structs
+ // Ensure that a type is prefixed with its namespace even within
+ // its own namespace to avoid conflict between generated method
+ // names and similarly named classes or structs
std::string WrapInNameSpace(const Namespace *ns,
const std::string &name) const;
@@ -149,7 +149,7 @@ class BaseGenerator {
const std::string &file_name_;
const std::string qualifying_start_;
const std::string qualifying_separator_;
- const std::string default_extension_;
+ const std::string default_extension_;
};
struct CommentConfig {
@@ -162,74 +162,74 @@ extern void GenComment(const std::vector<std::string> &dc,
std::string *code_ptr, const CommentConfig *config,
const char *prefix = "");
-class FloatConstantGenerator {
- public:
- virtual ~FloatConstantGenerator() {}
- std::string GenFloatConstant(const FieldDef &field) const;
-
- private:
- virtual std::string Value(double v, const std::string &src) const = 0;
- virtual std::string Inf(double v) const = 0;
- virtual std::string NaN(double v) const = 0;
-
- virtual std::string Value(float v, const std::string &src) const = 0;
- virtual std::string Inf(float v) const = 0;
- virtual std::string NaN(float v) const = 0;
-
- template<typename T>
- std::string GenFloatConstantImpl(const FieldDef &field) const;
-};
-
-class SimpleFloatConstantGenerator : public FloatConstantGenerator {
- public:
- SimpleFloatConstantGenerator(const char *nan_number,
- const char *pos_inf_number,
- const char *neg_inf_number);
-
- private:
- std::string Value(double v,
- const std::string &src) const FLATBUFFERS_OVERRIDE;
- std::string Inf(double v) const FLATBUFFERS_OVERRIDE;
- std::string NaN(double v) const FLATBUFFERS_OVERRIDE;
-
- std::string Value(float v, const std::string &src) const FLATBUFFERS_OVERRIDE;
- std::string Inf(float v) const FLATBUFFERS_OVERRIDE;
- std::string NaN(float v) const FLATBUFFERS_OVERRIDE;
-
- const std::string nan_number_;
- const std::string pos_inf_number_;
- const std::string neg_inf_number_;
-};
-
-// C++, C#, Java like generator.
-class TypedFloatConstantGenerator : public FloatConstantGenerator {
- public:
- TypedFloatConstantGenerator(const char *double_prefix,
- const char *single_prefix, const char *nan_number,
- const char *pos_inf_number,
- const char *neg_inf_number = "");
-
- private:
- std::string Value(double v,
- const std::string &src) const FLATBUFFERS_OVERRIDE;
- std::string Inf(double v) const FLATBUFFERS_OVERRIDE;
-
- std::string NaN(double v) const FLATBUFFERS_OVERRIDE;
-
- std::string Value(float v, const std::string &src) const FLATBUFFERS_OVERRIDE;
- std::string Inf(float v) const FLATBUFFERS_OVERRIDE;
- std::string NaN(float v) const FLATBUFFERS_OVERRIDE;
-
- std::string MakeNaN(const std::string &prefix) const;
- std::string MakeInf(bool neg, const std::string &prefix) const;
-
- const std::string double_prefix_;
- const std::string single_prefix_;
- const std::string nan_number_;
- const std::string pos_inf_number_;
- const std::string neg_inf_number_;
-};
-
+class FloatConstantGenerator {
+ public:
+ virtual ~FloatConstantGenerator() {}
+ std::string GenFloatConstant(const FieldDef &field) const;
+
+ private:
+ virtual std::string Value(double v, const std::string &src) const = 0;
+ virtual std::string Inf(double v) const = 0;
+ virtual std::string NaN(double v) const = 0;
+
+ virtual std::string Value(float v, const std::string &src) const = 0;
+ virtual std::string Inf(float v) const = 0;
+ virtual std::string NaN(float v) const = 0;
+
+ template<typename T>
+ std::string GenFloatConstantImpl(const FieldDef &field) const;
+};
+
+class SimpleFloatConstantGenerator : public FloatConstantGenerator {
+ public:
+ SimpleFloatConstantGenerator(const char *nan_number,
+ const char *pos_inf_number,
+ const char *neg_inf_number);
+
+ private:
+ std::string Value(double v,
+ const std::string &src) const FLATBUFFERS_OVERRIDE;
+ std::string Inf(double v) const FLATBUFFERS_OVERRIDE;
+ std::string NaN(double v) const FLATBUFFERS_OVERRIDE;
+
+ std::string Value(float v, const std::string &src) const FLATBUFFERS_OVERRIDE;
+ std::string Inf(float v) const FLATBUFFERS_OVERRIDE;
+ std::string NaN(float v) const FLATBUFFERS_OVERRIDE;
+
+ const std::string nan_number_;
+ const std::string pos_inf_number_;
+ const std::string neg_inf_number_;
+};
+
+// C++, C#, Java like generator.
+class TypedFloatConstantGenerator : public FloatConstantGenerator {
+ public:
+ TypedFloatConstantGenerator(const char *double_prefix,
+ const char *single_prefix, const char *nan_number,
+ const char *pos_inf_number,
+ const char *neg_inf_number = "");
+
+ private:
+ std::string Value(double v,
+ const std::string &src) const FLATBUFFERS_OVERRIDE;
+ std::string Inf(double v) const FLATBUFFERS_OVERRIDE;
+
+ std::string NaN(double v) const FLATBUFFERS_OVERRIDE;
+
+ std::string Value(float v, const std::string &src) const FLATBUFFERS_OVERRIDE;
+ std::string Inf(float v) const FLATBUFFERS_OVERRIDE;
+ std::string NaN(float v) const FLATBUFFERS_OVERRIDE;
+
+ std::string MakeNaN(const std::string &prefix) const;
+ std::string MakeInf(bool neg, const std::string &prefix) const;
+
+ const std::string double_prefix_;
+ const std::string single_prefix_;
+ const std::string nan_number_;
+ const std::string pos_inf_number_;
+ const std::string neg_inf_number_;
+};
+
} // namespace flatbuffers
#endif // FLATBUFFERS_CODE_GENERATORS_H_
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/flatbuffers.h b/contrib/libs/flatbuffers/include/flatbuffers/flatbuffers.h
index 20935307a6..b32df1d9f1 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/flatbuffers.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/flatbuffers.h
@@ -24,44 +24,44 @@
# include <functional>
#endif
-#if defined(FLATBUFFERS_NAN_DEFAULTS)
-# include <cmath>
-#endif
-
+#if defined(FLATBUFFERS_NAN_DEFAULTS)
+# include <cmath>
+#endif
+
namespace flatbuffers {
-// Generic 'operator==' with conditional specialisations.
-// T e - new value of a scalar field.
-// T def - default of scalar (is known at compile-time).
-template<typename T> inline bool IsTheSameAs(T e, T def) { return e == def; }
-
-#if defined(FLATBUFFERS_NAN_DEFAULTS) && \
- defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0)
-// Like `operator==(e, def)` with weak NaN if T=(float|double).
-template<typename T> inline bool IsFloatTheSameAs(T e, T def) {
- return (e == def) || ((def != def) && (e != e));
-}
-template<> inline bool IsTheSameAs<float>(float e, float def) {
- return IsFloatTheSameAs(e, def);
-}
-template<> inline bool IsTheSameAs<double>(double e, double def) {
- return IsFloatTheSameAs(e, def);
-}
-#endif
-
-// Check 'v' is out of closed range [low; high].
-// Workaround for GCC warning [-Werror=type-limits]:
-// comparison is always true due to limited range of data type.
-template<typename T>
-inline bool IsOutRange(const T &v, const T &low, const T &high) {
- return (v < low) || (high < v);
-}
-
-// Check 'v' is in closed range [low; high].
-template<typename T>
-inline bool IsInRange(const T &v, const T &low, const T &high) {
- return !IsOutRange(v, low, high);
-}
-
+// Generic 'operator==' with conditional specialisations.
+// T e - new value of a scalar field.
+// T def - default of scalar (is known at compile-time).
+template<typename T> inline bool IsTheSameAs(T e, T def) { return e == def; }
+
+#if defined(FLATBUFFERS_NAN_DEFAULTS) && \
+ defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0)
+// Like `operator==(e, def)` with weak NaN if T=(float|double).
+template<typename T> inline bool IsFloatTheSameAs(T e, T def) {
+ return (e == def) || ((def != def) && (e != e));
+}
+template<> inline bool IsTheSameAs<float>(float e, float def) {
+ return IsFloatTheSameAs(e, def);
+}
+template<> inline bool IsTheSameAs<double>(double e, double def) {
+ return IsFloatTheSameAs(e, def);
+}
+#endif
+
+// Check 'v' is out of closed range [low; high].
+// Workaround for GCC warning [-Werror=type-limits]:
+// comparison is always true due to limited range of data type.
+template<typename T>
+inline bool IsOutRange(const T &v, const T &low, const T &high) {
+ return (v < low) || (high < v);
+}
+
+// Check 'v' is in closed range [low; high].
+template<typename T>
+inline bool IsInRange(const T &v, const T &low, const T &high) {
+ return !IsOutRange(v, low, high);
+}
+
// Wrapper for uoffset_t to allow safe template specialization.
// Value is allowed to be 0 to indicate a null object (see e.g. AddOffset).
template<typename T> struct Offset {
@@ -140,21 +140,21 @@ template<typename T, typename IT> struct VectorIterator {
VectorIterator(const uint8_t *data, uoffset_t i)
: data_(data + IndirectHelper<T>::element_stride * i) {}
VectorIterator(const VectorIterator &other) : data_(other.data_) {}
- VectorIterator() : data_(nullptr) {}
+ VectorIterator() : data_(nullptr) {}
VectorIterator &operator=(const VectorIterator &other) {
data_ = other.data_;
return *this;
}
- // clang-format off
- #if !defined(FLATBUFFERS_CPP98_STL)
+ // clang-format off
+ #if !defined(FLATBUFFERS_CPP98_STL)
VectorIterator &operator=(VectorIterator &&other) {
data_ = other.data_;
return *this;
}
- #endif // !defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
+ #endif // !defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
bool operator==(const VectorIterator &other) const {
return data_ == other.data_;
@@ -212,7 +212,7 @@ template<typename T, typename IT> struct VectorIterator {
return temp;
}
- VectorIterator operator-(const uoffset_t &offset) const {
+ VectorIterator operator-(const uoffset_t &offset) const {
return VectorIterator(data_ - offset * IndirectHelper<T>::element_stride,
0);
}
@@ -226,26 +226,26 @@ template<typename T, typename IT> struct VectorIterator {
const uint8_t *data_;
};
-template<typename Iterator>
-struct VectorReverseIterator : public std::reverse_iterator<Iterator> {
- explicit VectorReverseIterator(Iterator iter)
- : std::reverse_iterator<Iterator>(iter) {}
-
+template<typename Iterator>
+struct VectorReverseIterator : public std::reverse_iterator<Iterator> {
+ explicit VectorReverseIterator(Iterator iter)
+ : std::reverse_iterator<Iterator>(iter) {}
+
// Note: return type is incompatible with the standard
// `reference operator*()`.
- typename Iterator::value_type operator*() const {
+ typename Iterator::value_type operator*() const {
auto tmp = std::reverse_iterator<Iterator>::current;
return *--tmp;
- }
-
+ }
+
// Note: return type is incompatible with the standard
// `pointer operator->()`.
- typename Iterator::value_type operator->() const {
+ typename Iterator::value_type operator->() const {
auto tmp = std::reverse_iterator<Iterator>::current;
return *--tmp;
- }
-};
-
+ }
+};
+
struct String;
// This is used as a helper type for accessing vectors.
@@ -256,13 +256,13 @@ template<typename T> class Vector {
iterator;
typedef VectorIterator<T, typename IndirectHelper<T>::return_type>
const_iterator;
- typedef VectorReverseIterator<iterator> reverse_iterator;
- typedef VectorReverseIterator<const_iterator> const_reverse_iterator;
+ typedef VectorReverseIterator<iterator> reverse_iterator;
+ typedef VectorReverseIterator<const_iterator> const_reverse_iterator;
uoffset_t size() const { return EndianScalar(length_); }
// Deprecated: use size(). Here for backwards compatibility.
- FLATBUFFERS_ATTRIBUTE(deprecated("use size() instead"))
+ FLATBUFFERS_ATTRIBUTE(deprecated("use size() instead"))
uoffset_t Length() const { return size(); }
typedef typename IndirectHelper<T>::return_type return_type;
@@ -306,23 +306,23 @@ template<typename T> class Vector {
const_iterator end() const { return const_iterator(Data(), size()); }
reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const {
+ const_reverse_iterator rbegin() const {
return const_reverse_iterator(end());
- }
-
+ }
+
reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const {
+ const_reverse_iterator rend() const {
return const_reverse_iterator(begin());
- }
-
- const_iterator cbegin() const { return begin(); }
-
- const_iterator cend() const { return end(); }
-
- const_reverse_iterator crbegin() const { return rbegin(); }
-
- const_reverse_iterator crend() const { return rend(); }
-
+ }
+
+ const_iterator cbegin() const { return begin(); }
+
+ const_iterator cend() const { return end(); }
+
+ const_reverse_iterator crbegin() const { return rbegin(); }
+
+ const_reverse_iterator crend() const { return rend(); }
+
// Change elements if you have a non-const pointer to this object.
// Scalars only. See reflection.h, and the documentation.
void Mutate(uoffset_t i, const T &val) {
@@ -381,7 +381,7 @@ template<typename T> class Vector {
// This class is a pointer. Copying will therefore create an invalid object.
// Private and unimplemented copy constructor.
Vector(const Vector &);
- Vector &operator=(const Vector &);
+ Vector &operator=(const Vector &);
template<typename K> static int KeyCompare(const void *ap, const void *bp) {
const K *key = reinterpret_cast<const K *>(ap);
@@ -412,7 +412,7 @@ class VectorOfAny {
private:
VectorOfAny(const VectorOfAny &);
- VectorOfAny &operator=(const VectorOfAny &);
+ VectorOfAny &operator=(const VectorOfAny &);
};
#ifndef FLATBUFFERS_CPP98_STL
@@ -432,80 +432,80 @@ const Vector<Offset<T>> *VectorCast(const Vector<Offset<U>> *ptr) {
// Convenient helper function to get the length of any vector, regardless
// of whether it is null or not (the field is not set).
template<typename T> static inline size_t VectorLength(const Vector<T> *v) {
- return v ? v->size() : 0;
+ return v ? v->size() : 0;
}
-// This is used as a helper type for accessing arrays.
-template<typename T, uint16_t length> class Array {
- typedef
- typename flatbuffers::integral_constant<bool,
- flatbuffers::is_scalar<T>::value>
- scalar_tag;
- typedef
- typename flatbuffers::conditional<scalar_tag::value, T, const T *>::type
- IndirectHelperType;
-
- public:
+// This is used as a helper type for accessing arrays.
+template<typename T, uint16_t length> class Array {
+ typedef
+ typename flatbuffers::integral_constant<bool,
+ flatbuffers::is_scalar<T>::value>
+ scalar_tag;
+ typedef
+ typename flatbuffers::conditional<scalar_tag::value, T, const T *>::type
+ IndirectHelperType;
+
+ public:
typedef uint16_t size_type;
- typedef typename IndirectHelper<IndirectHelperType>::return_type return_type;
- typedef VectorIterator<T, return_type> const_iterator;
- typedef VectorReverseIterator<const_iterator> const_reverse_iterator;
-
- FLATBUFFERS_CONSTEXPR uint16_t size() const { return length; }
-
- return_type Get(uoffset_t i) const {
- FLATBUFFERS_ASSERT(i < size());
- return IndirectHelper<IndirectHelperType>::Read(Data(), i);
- }
-
- return_type operator[](uoffset_t i) const { return Get(i); }
-
- // If this is a Vector of enums, T will be its storage type, not the enum
- // type. This function makes it convenient to retrieve value with enum
- // type E.
- template<typename E> E GetEnum(uoffset_t i) const {
- return static_cast<E>(Get(i));
- }
-
- const_iterator begin() const { return const_iterator(Data(), 0); }
- const_iterator end() const { return const_iterator(Data(), size()); }
-
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
+ typedef typename IndirectHelper<IndirectHelperType>::return_type return_type;
+ typedef VectorIterator<T, return_type> const_iterator;
+ typedef VectorReverseIterator<const_iterator> const_reverse_iterator;
+
+ FLATBUFFERS_CONSTEXPR uint16_t size() const { return length; }
+
+ return_type Get(uoffset_t i) const {
+ FLATBUFFERS_ASSERT(i < size());
+ return IndirectHelper<IndirectHelperType>::Read(Data(), i);
+ }
+
+ return_type operator[](uoffset_t i) const { return Get(i); }
+
+ // If this is a Vector of enums, T will be its storage type, not the enum
+ // type. This function makes it convenient to retrieve value with enum
+ // type E.
+ template<typename E> E GetEnum(uoffset_t i) const {
+ return static_cast<E>(Get(i));
+ }
+
+ const_iterator begin() const { return const_iterator(Data(), 0); }
+ const_iterator end() const { return const_iterator(Data(), size()); }
+
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
const_reverse_iterator rend() const {
return const_reverse_iterator(begin());
}
-
- const_iterator cbegin() const { return begin(); }
- const_iterator cend() const { return end(); }
-
- const_reverse_iterator crbegin() const { return rbegin(); }
- const_reverse_iterator crend() const { return rend(); }
-
- // Get a mutable pointer to elements inside this array.
- // This method used to mutate arrays of structs followed by a @p Mutate
- // operation. For primitive types use @p Mutate directly.
- // @warning Assignments and reads to/from the dereferenced pointer are not
- // automatically converted to the correct endianness.
- typename flatbuffers::conditional<scalar_tag::value, void, T *>::type
- GetMutablePointer(uoffset_t i) const {
- FLATBUFFERS_ASSERT(i < size());
- return const_cast<T *>(&data()[i]);
- }
-
- // Change elements if you have a non-const pointer to this object.
- void Mutate(uoffset_t i, const T &val) { MutateImpl(scalar_tag(), i, val); }
-
- // The raw data in little endian format. Use with care.
- const uint8_t *Data() const { return data_; }
-
- uint8_t *Data() { return data_; }
-
- // Similarly, but typed, much like std::vector::data
- const T *data() const { return reinterpret_cast<const T *>(Data()); }
- T *data() { return reinterpret_cast<T *>(Data()); }
-
+
+ const_iterator cbegin() const { return begin(); }
+ const_iterator cend() const { return end(); }
+
+ const_reverse_iterator crbegin() const { return rbegin(); }
+ const_reverse_iterator crend() const { return rend(); }
+
+ // Get a mutable pointer to elements inside this array.
+ // This method used to mutate arrays of structs followed by a @p Mutate
+ // operation. For primitive types use @p Mutate directly.
+ // @warning Assignments and reads to/from the dereferenced pointer are not
+ // automatically converted to the correct endianness.
+ typename flatbuffers::conditional<scalar_tag::value, void, T *>::type
+ GetMutablePointer(uoffset_t i) const {
+ FLATBUFFERS_ASSERT(i < size());
+ return const_cast<T *>(&data()[i]);
+ }
+
+ // Change elements if you have a non-const pointer to this object.
+ void Mutate(uoffset_t i, const T &val) { MutateImpl(scalar_tag(), i, val); }
+
+ // The raw data in little endian format. Use with care.
+ const uint8_t *Data() const { return data_; }
+
+ uint8_t *Data() { return data_; }
+
+ // Similarly, but typed, much like std::vector::data
+ const T *data() const { return reinterpret_cast<const T *>(Data()); }
+ T *data() { return reinterpret_cast<T *>(Data()); }
+
// Copy data from a span with endian conversion.
// If this Array and the span overlap, the behavior is undefined.
void CopyFromSpan(flatbuffers::span<const T, length> src) {
@@ -522,18 +522,18 @@ template<typename T, uint16_t length> class Array {
src);
}
- protected:
- void MutateImpl(flatbuffers::integral_constant<bool, true>, uoffset_t i,
- const T &val) {
- FLATBUFFERS_ASSERT(i < size());
- WriteScalar(data() + i, val);
- }
-
- void MutateImpl(flatbuffers::integral_constant<bool, false>, uoffset_t i,
- const T &val) {
- *(GetMutablePointer(i)) = val;
- }
-
+ protected:
+ void MutateImpl(flatbuffers::integral_constant<bool, true>, uoffset_t i,
+ const T &val) {
+ FLATBUFFERS_ASSERT(i < size());
+ WriteScalar(data() + i, val);
+ }
+
+ void MutateImpl(flatbuffers::integral_constant<bool, false>, uoffset_t i,
+ const T &val) {
+ *(GetMutablePointer(i)) = val;
+ }
+
void CopyFromSpanImpl(flatbuffers::integral_constant<bool, true>,
flatbuffers::span<const T, length> src) {
// Use std::memcpy() instead of std::copy() to avoid preformance degradation
@@ -548,51 +548,51 @@ template<typename T, uint16_t length> class Array {
for (size_type k = 0; k < length; k++) { Mutate(k, src[k]); }
}
- // This class is only used to access pre-existing data. Don't ever
- // try to construct these manually.
- // 'constexpr' allows us to use 'size()' at compile time.
- // @note Must not use 'FLATBUFFERS_CONSTEXPR' here, as const is not allowed on
- // a constructor.
-#if defined(__cpp_constexpr)
- constexpr Array();
-#else
- Array();
-#endif
-
- uint8_t data_[length * sizeof(T)];
-
- private:
- // This class is a pointer. Copying will therefore create an invalid object.
- // Private and unimplemented copy constructor.
- Array(const Array &);
- Array &operator=(const Array &);
-};
-
-// Specialization for Array[struct] with access using Offset<void> pointer.
-// This specialization used by idl_gen_text.cpp.
-template<typename T, uint16_t length> class Array<Offset<T>, length> {
- static_assert(flatbuffers::is_same<T, void>::value, "unexpected type T");
-
- public:
- typedef const void *return_type;
-
- const uint8_t *Data() const { return data_; }
-
- // Make idl_gen_text.cpp::PrintContainer happy.
- return_type operator[](uoffset_t) const {
- FLATBUFFERS_ASSERT(false);
- return nullptr;
- }
-
- private:
- // This class is only used to access pre-existing data.
- Array();
- Array(const Array &);
- Array &operator=(const Array &);
-
- uint8_t data_[1];
-};
-
+ // This class is only used to access pre-existing data. Don't ever
+ // try to construct these manually.
+ // 'constexpr' allows us to use 'size()' at compile time.
+ // @note Must not use 'FLATBUFFERS_CONSTEXPR' here, as const is not allowed on
+ // a constructor.
+#if defined(__cpp_constexpr)
+ constexpr Array();
+#else
+ Array();
+#endif
+
+ uint8_t data_[length * sizeof(T)];
+
+ private:
+ // This class is a pointer. Copying will therefore create an invalid object.
+ // Private and unimplemented copy constructor.
+ Array(const Array &);
+ Array &operator=(const Array &);
+};
+
+// Specialization for Array[struct] with access using Offset<void> pointer.
+// This specialization used by idl_gen_text.cpp.
+template<typename T, uint16_t length> class Array<Offset<T>, length> {
+ static_assert(flatbuffers::is_same<T, void>::value, "unexpected type T");
+
+ public:
+ typedef const void *return_type;
+
+ const uint8_t *Data() const { return data_; }
+
+ // Make idl_gen_text.cpp::PrintContainer happy.
+ return_type operator[](uoffset_t) const {
+ FLATBUFFERS_ASSERT(false);
+ return nullptr;
+ }
+
+ private:
+ // This class is only used to access pre-existing data.
+ Array();
+ Array(const Array &);
+ Array &operator=(const Array &);
+
+ uint8_t data_[1];
+};
+
// Cast a raw T[length] to a raw flatbuffers::Array<T, length>
// without endian conversion. Use with care.
template<typename T, uint16_t length>
@@ -617,40 +617,40 @@ const Array<E, length> &CastToArrayOfEnum(const T (&arr)[length]) {
return *reinterpret_cast<const Array<E, length> *>(arr);
}
-// Lexicographically compare two strings (possibly containing nulls), and
-// return true if the first is less than the second.
-static inline bool StringLessThan(const char *a_data, uoffset_t a_size,
- const char *b_data, uoffset_t b_size) {
- const auto cmp = memcmp(a_data, b_data, (std::min)(a_size, b_size));
- return cmp == 0 ? a_size < b_size : cmp < 0;
-}
-
+// Lexicographically compare two strings (possibly containing nulls), and
+// return true if the first is less than the second.
+static inline bool StringLessThan(const char *a_data, uoffset_t a_size,
+ const char *b_data, uoffset_t b_size) {
+ const auto cmp = memcmp(a_data, b_data, (std::min)(a_size, b_size));
+ return cmp == 0 ? a_size < b_size : cmp < 0;
+}
+
struct String : public Vector<char> {
const char *c_str() const { return reinterpret_cast<const char *>(Data()); }
- std::string str() const { return std::string(c_str(), size()); }
+ std::string str() const { return std::string(c_str(), size()); }
// clang-format off
#ifdef FLATBUFFERS_HAS_STRING_VIEW
flatbuffers::string_view string_view() const {
- return flatbuffers::string_view(c_str(), size());
+ return flatbuffers::string_view(c_str(), size());
}
#endif // FLATBUFFERS_HAS_STRING_VIEW
// clang-format on
bool operator<(const String &o) const {
- return StringLessThan(this->data(), this->size(), o.data(), o.size());
+ return StringLessThan(this->data(), this->size(), o.data(), o.size());
}
};
// Convenience function to get std::string from a String returning an empty
// string on null pointer.
-static inline std::string GetString(const String *str) {
+static inline std::string GetString(const String *str) {
return str ? str->str() : "";
}
// Convenience function to get char* from a String returning an empty string on
// null pointer.
-static inline const char *GetCstring(const String *str) {
+static inline const char *GetCstring(const String *str) {
return str ? str->c_str() : "";
}
@@ -695,9 +695,9 @@ class Allocator {
// to `new_p` of `new_size`. Only memory of size `in_use_front` and
// `in_use_back` will be copied from the front and back of the old memory
// allocation.
- void memcpy_downward(uint8_t *old_p, size_t old_size, uint8_t *new_p,
- size_t new_size, size_t in_use_back,
- size_t in_use_front) {
+ void memcpy_downward(uint8_t *old_p, size_t old_size, uint8_t *new_p,
+ size_t new_size, size_t in_use_back,
+ size_t in_use_front) {
memcpy(new_p + new_size - in_use_back, old_p + old_size - in_use_back,
in_use_back);
memcpy(new_p, old_p, in_use_front);
@@ -711,9 +711,9 @@ class DefaultAllocator : public Allocator {
return new uint8_t[size];
}
- void deallocate(uint8_t *p, size_t) FLATBUFFERS_OVERRIDE { delete[] p; }
-
- static void dealloc(void *p, size_t) { delete[] static_cast<uint8_t *>(p); }
+ void deallocate(uint8_t *p, size_t) FLATBUFFERS_OVERRIDE { delete[] p; }
+
+ static void dealloc(void *p, size_t) { delete[] static_cast<uint8_t *>(p); }
};
// These functions allow for a null allocator to mean use the default allocator,
@@ -726,19 +726,19 @@ inline uint8_t *Allocate(Allocator *allocator, size_t size) {
}
inline void Deallocate(Allocator *allocator, uint8_t *p, size_t size) {
- if (allocator)
- allocator->deallocate(p, size);
- else
- DefaultAllocator().deallocate(p, size);
+ if (allocator)
+ allocator->deallocate(p, size);
+ else
+ DefaultAllocator().deallocate(p, size);
}
inline uint8_t *ReallocateDownward(Allocator *allocator, uint8_t *old_p,
size_t old_size, size_t new_size,
size_t in_use_back, size_t in_use_front) {
- return allocator ? allocator->reallocate_downward(old_p, old_size, new_size,
- in_use_back, in_use_front)
- : DefaultAllocator().reallocate_downward(
- old_p, old_size, new_size, in_use_back, in_use_front);
+ return allocator ? allocator->reallocate_downward(old_p, old_size, new_size,
+ in_use_back, in_use_front)
+ : DefaultAllocator().reallocate_downward(
+ old_p, old_size, new_size, in_use_back, in_use_front);
}
// DetachedBuffer is a finished flatbuffer memory region, detached from its
@@ -763,9 +763,9 @@ class DetachedBuffer {
cur_(cur),
size_(sz) {}
- // clang-format off
- #if !defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
+ // clang-format off
+ #if !defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
DetachedBuffer(DetachedBuffer &&other)
: allocator_(other.allocator_),
own_allocator_(other.own_allocator_),
@@ -775,16 +775,16 @@ class DetachedBuffer {
size_(other.size_) {
other.reset();
}
- // clang-format off
- #endif // !defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
+ // clang-format off
+ #endif // !defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
- // clang-format off
- #if !defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
+ // clang-format off
+ #if !defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
DetachedBuffer &operator=(DetachedBuffer &&other) {
- if (this == &other) return *this;
-
+ if (this == &other) return *this;
+
destroy();
allocator_ = other.allocator_;
@@ -798,9 +798,9 @@ class DetachedBuffer {
return *this;
}
- // clang-format off
- #endif // !defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
+ // clang-format off
+ #endif // !defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
~DetachedBuffer() { destroy(); }
@@ -830,16 +830,16 @@ class DetachedBuffer {
#endif
// clang-format on
- // clang-format off
- #if !defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
+ // clang-format off
+ #if !defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
// These may change access mode, leave these at end of public section
FLATBUFFERS_DELETE_FUNC(DetachedBuffer(const DetachedBuffer &other));
FLATBUFFERS_DELETE_FUNC(
DetachedBuffer &operator=(const DetachedBuffer &other));
- // clang-format off
- #endif // !defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
+ // clang-format off
+ #endif // !defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
protected:
Allocator *allocator_;
@@ -873,8 +873,8 @@ class DetachedBuffer {
// Essentially, this supports 2 std::vectors in a single buffer.
class vector_downward {
public:
- explicit vector_downward(size_t initial_size, Allocator *allocator,
- bool own_allocator, size_t buffer_minalign)
+ explicit vector_downward(size_t initial_size, Allocator *allocator,
+ bool own_allocator, size_t buffer_minalign)
: allocator_(allocator),
own_allocator_(own_allocator),
initial_size_(initial_size),
@@ -884,21 +884,21 @@ class vector_downward {
cur_(nullptr),
scratch_(nullptr) {}
- // clang-format off
- #if !defined(FLATBUFFERS_CPP98_STL)
+ // clang-format off
+ #if !defined(FLATBUFFERS_CPP98_STL)
vector_downward(vector_downward &&other)
- #else
- vector_downward(vector_downward &other)
- #endif // defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
- : allocator_(other.allocator_),
- own_allocator_(other.own_allocator_),
- initial_size_(other.initial_size_),
- buffer_minalign_(other.buffer_minalign_),
- reserved_(other.reserved_),
- buf_(other.buf_),
- cur_(other.cur_),
- scratch_(other.scratch_) {
+ #else
+ vector_downward(vector_downward &other)
+ #endif // defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
+ : allocator_(other.allocator_),
+ own_allocator_(other.own_allocator_),
+ initial_size_(other.initial_size_),
+ buffer_minalign_(other.buffer_minalign_),
+ reserved_(other.reserved_),
+ buf_(other.buf_),
+ cur_(other.cur_),
+ scratch_(other.scratch_) {
// No change in other.allocator_
// No change in other.initial_size_
// No change in other.buffer_minalign_
@@ -909,18 +909,18 @@ class vector_downward {
other.scratch_ = nullptr;
}
- // clang-format off
- #if !defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
+ // clang-format off
+ #if !defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
vector_downward &operator=(vector_downward &&other) {
// Move construct a temporary and swap idiom
vector_downward temp(std::move(other));
swap(temp);
return *this;
}
- // clang-format off
- #endif // defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
+ // clang-format off
+ #endif // defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
~vector_downward() {
clear_buffer();
@@ -942,7 +942,7 @@ class vector_downward {
clear_scratch();
}
- void clear_scratch() { scratch_ = buf_; }
+ void clear_scratch() { scratch_ = buf_; }
void clear_allocator() {
if (own_allocator_ && allocator_) { delete allocator_; }
@@ -1028,7 +1028,7 @@ class vector_downward {
uint8_t *data_at(size_t offset) const { return buf_ + reserved_ - offset; }
void push(const uint8_t *bytes, size_t num) {
- if (num > 0) { memcpy(make_space(num), bytes, num); }
+ if (num > 0) { memcpy(make_space(num), bytes, num); }
}
// Specialized version of push() that avoids memcpy call for small data.
@@ -1051,7 +1051,7 @@ class vector_downward {
}
// Version for when we know the size is larger.
- // Precondition: zero_pad_bytes > 0
+ // Precondition: zero_pad_bytes > 0
void fill_big(size_t zero_pad_bytes) {
memset(make_space(zero_pad_bytes), 0, zero_pad_bytes);
}
@@ -1095,8 +1095,8 @@ class vector_downward {
auto old_reserved = reserved_;
auto old_size = size();
auto old_scratch_size = scratch_size();
- reserved_ +=
- (std::max)(len, old_reserved ? old_reserved / 2 : initial_size_);
+ reserved_ +=
+ (std::max)(len, old_reserved ? old_reserved / 2 : initial_size_);
reserved_ = (reserved_ + buffer_minalign_ - 1) & ~(buffer_minalign_ - 1);
if (buf_) {
buf_ = ReallocateDownward(allocator_, buf_, old_reserved, reserved_,
@@ -1118,16 +1118,16 @@ inline voffset_t FieldIndexToOffset(voffset_t field_id) {
template<typename T, typename Alloc>
const T *data(const std::vector<T, Alloc> &v) {
- // Eventually the returned pointer gets passed down to memcpy, so
- // we need it to be non-null to avoid undefined behavior.
- static uint8_t t;
- return v.empty() ? reinterpret_cast<const T *>(&t) : &v.front();
+ // Eventually the returned pointer gets passed down to memcpy, so
+ // we need it to be non-null to avoid undefined behavior.
+ static uint8_t t;
+ return v.empty() ? reinterpret_cast<const T *>(&t) : &v.front();
}
template<typename T, typename Alloc> T *data(std::vector<T, Alloc> &v) {
- // Eventually the returned pointer gets passed down to memcpy, so
- // we need it to be non-null to avoid undefined behavior.
- static uint8_t t;
- return v.empty() ? reinterpret_cast<T *>(&t) : &v.front();
+ // Eventually the returned pointer gets passed down to memcpy, so
+ // we need it to be non-null to avoid undefined behavior.
+ static uint8_t t;
+ return v.empty() ? reinterpret_cast<T *>(&t) : &v.front();
}
/// @endcond
@@ -1154,10 +1154,10 @@ class FlatBufferBuilder {
/// minimum alignment upon reallocation. Only needed if you intend to store
/// types with custom alignment AND you wish to read the buffer in-place
/// directly after creation.
- explicit FlatBufferBuilder(
- size_t initial_size = 1024, Allocator *allocator = nullptr,
- bool own_allocator = false,
- size_t buffer_minalign = AlignOf<largest_scalar_t>())
+ explicit FlatBufferBuilder(
+ size_t initial_size = 1024, Allocator *allocator = nullptr,
+ bool own_allocator = false,
+ size_t buffer_minalign = AlignOf<largest_scalar_t>())
: buf_(initial_size, allocator, own_allocator, buffer_minalign),
num_field_loc(0),
max_voffset_(0),
@@ -1170,13 +1170,13 @@ class FlatBufferBuilder {
EndianCheck();
}
- // clang-format off
+ // clang-format off
/// @brief Move constructor for FlatBufferBuilder.
- #if !defined(FLATBUFFERS_CPP98_STL)
+ #if !defined(FLATBUFFERS_CPP98_STL)
FlatBufferBuilder(FlatBufferBuilder &&other)
- #else
- FlatBufferBuilder(FlatBufferBuilder &other)
- #endif // #if !defined(FLATBUFFERS_CPP98_STL)
+ #else
+ FlatBufferBuilder(FlatBufferBuilder &other)
+ #endif // #if !defined(FLATBUFFERS_CPP98_STL)
: buf_(1024, nullptr, false, AlignOf<largest_scalar_t>()),
num_field_loc(0),
max_voffset_(0),
@@ -1191,11 +1191,11 @@ class FlatBufferBuilder {
// Lack of delegating constructors in vs2010 makes it more verbose than needed.
Swap(other);
}
- // clang-format on
+ // clang-format on
- // clang-format off
- #if !defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
+ // clang-format off
+ #if !defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
/// @brief Move assignment operator for FlatBufferBuilder.
FlatBufferBuilder &operator=(FlatBufferBuilder &&other) {
// Move construct a temporary and swap idiom
@@ -1203,9 +1203,9 @@ class FlatBufferBuilder {
Swap(temp);
return *this;
}
- // clang-format off
- #endif // defined(FLATBUFFERS_CPP98_STL)
- // clang-format on
+ // clang-format off
+ #endif // defined(FLATBUFFERS_CPP98_STL)
+ // clang-format on
void Swap(FlatBufferBuilder &other) {
using std::swap;
@@ -1268,7 +1268,7 @@ class FlatBufferBuilder {
/// @warning Do NOT attempt to use this FlatBufferBuilder afterwards!
/// @return A `FlatBuffer` that owns the buffer and its allocator and
/// behaves similar to a `unique_ptr` with a deleter.
- FLATBUFFERS_ATTRIBUTE(deprecated("use Release() instead"))
+ FLATBUFFERS_ATTRIBUTE(deprecated("use Release() instead"))
DetachedBuffer ReleaseBufferPointer() {
Finished();
return buf_.release();
@@ -1282,14 +1282,14 @@ class FlatBufferBuilder {
}
/// @brief Get the released pointer to the serialized buffer.
- /// @param size The size of the memory block containing
+ /// @param size The size of the memory block containing
/// the serialized `FlatBuffer`.
- /// @param offset The offset from the released pointer where the finished
+ /// @param offset The offset from the released pointer where the finished
/// `FlatBuffer` starts.
/// @return A raw pointer to the start of the memory block containing
/// the serialized `FlatBuffer`.
- /// @remark If the allocator is owned, it gets deleted when the destructor is
- /// called..
+ /// @remark If the allocator is owned, it gets deleted when the destructor is
+ /// called..
uint8_t *ReleaseRaw(size_t &size, size_t &offset) {
Finished();
return buf_.release_raw(size, offset);
@@ -1318,13 +1318,13 @@ class FlatBufferBuilder {
/// @brief In order to save space, fields that are set to their default value
/// don't get serialized into the buffer.
- /// @param[in] fd When set to `true`, always serializes default values that
- /// are set. Optional fields which are not set explicitly, will still not be
- /// serialized.
+ /// @param[in] fd When set to `true`, always serializes default values that
+ /// are set. Optional fields which are not set explicitly, will still not be
+ /// serialized.
void ForceDefaults(bool fd) { force_defaults_ = fd; }
/// @brief By default vtables are deduped in order to save space.
- /// @param[in] dedup When set to `true`, dedup vtables.
+ /// @param[in] dedup When set to `true`, dedup vtables.
void DedupVtables(bool dedup) { dedup_vtables_ = dedup; }
/// @cond FLATBUFFERS_INTERNAL
@@ -1379,7 +1379,7 @@ class FlatBufferBuilder {
// Like PushElement, but additionally tracks the field this represents.
template<typename T> void AddElement(voffset_t field, T e, T def) {
// We don't serialize values equal to the default.
- if (IsTheSameAs(e, def) && !force_defaults_) return;
+ if (IsTheSameAs(e, def) && !force_defaults_) return;
auto off = PushElement(e);
TrackField(field, off);
}
@@ -1483,8 +1483,8 @@ class FlatBufferBuilder {
it += sizeof(uoffset_t)) {
auto vt_offset_ptr = reinterpret_cast<uoffset_t *>(it);
auto vt2 = reinterpret_cast<voffset_t *>(buf_.data_at(*vt_offset_ptr));
- auto vt2_size = ReadScalar<voffset_t>(vt2);
- if (vt1_size != vt2_size || 0 != memcmp(vt2, vt1, vt1_size)) continue;
+ auto vt2_size = ReadScalar<voffset_t>(vt2);
+ if (vt1_size != vt2_size || 0 != memcmp(vt2, vt1, vt1_size)) continue;
vt_use = *vt_offset_ptr;
buf_.pop(GetSize() - vtableoffsetloc);
break;
@@ -1505,7 +1505,7 @@ class FlatBufferBuilder {
return vtableoffsetloc;
}
- FLATBUFFERS_ATTRIBUTE(deprecated("call the version above instead"))
+ FLATBUFFERS_ATTRIBUTE(deprecated("call the version above instead"))
uoffset_t EndTable(uoffset_t start, voffset_t /*numfields*/) {
return EndTable(start);
}
@@ -1588,7 +1588,7 @@ class FlatBufferBuilder {
/// @param[in] str A const pointer to a `String` struct to add to the buffer.
/// @return Returns the offset in the buffer where the string starts
Offset<String> CreateString(const String *str) {
- return str ? CreateString(str->c_str(), str->size()) : 0;
+ return str ? CreateString(str->c_str(), str->size()) : 0;
}
/// @brief Store a string in the buffer, which can contain any binary data.
@@ -1596,7 +1596,7 @@ class FlatBufferBuilder {
/// of T::c_str() and T::length() to store in the buffer.
/// @return Returns the offset in the buffer where the string starts.
template<typename T> Offset<String> CreateString(const T &str) {
- return CreateString(str.data(), str.length());
+ return CreateString(str.data(), str.length());
}
/// @brief Store a string in the buffer, which can contain any binary data.
@@ -1659,7 +1659,7 @@ class FlatBufferBuilder {
/// @param[in] str A const pointer to a `String` struct to add to the buffer.
/// @return Returns the offset in the buffer where the string starts
Offset<String> CreateSharedString(const String *str) {
- return CreateSharedString(str->c_str(), str->size());
+ return CreateSharedString(str->c_str(), str->size());
}
/// @cond FLATBUFFERS_INTERNAL
@@ -1850,7 +1850,7 @@ class FlatBufferBuilder {
#ifndef FLATBUFFERS_CPP98_STL
/// @brief Serialize an array of structs into a FlatBuffer `vector`.
/// @tparam T The data type of the struct array elements.
- /// @param[in] filler A function that takes the current iteration 0..vector_size-1
+ /// @param[in] filler A function that takes the current iteration 0..vector_size-1
/// and a pointer to the struct that must be filled.
/// @return Returns a typed `Offset` into the serialized data indicating
/// where the vector is stored.
@@ -1890,7 +1890,7 @@ class FlatBufferBuilder {
/// @brief Serialize a `std::vector` of structs into a FlatBuffer `vector`.
/// @tparam T The data type of the `std::vector` struct elements.
- /// @param[in] v A const reference to the `std::vector` of structs to
+ /// @param[in] v A const reference to the `std::vector` of structs to
/// serialize into the buffer as a `vector`.
/// @return Returns a typed `Offset` into the serialized data indicating
/// where the vector is stored.
@@ -1904,7 +1904,7 @@ class FlatBufferBuilder {
/// `vector`.
/// @tparam T The data type of the `std::vector` struct elements.
/// @tparam S The data type of the `std::vector` native struct elements.
- /// @param[in] v A const reference to the `std::vector` of structs to
+ /// @param[in] v A const reference to the `std::vector` of structs to
/// serialize into the buffer as a `vector`.
/// @param[in] pack_func Pointer to a function to convert the native struct
/// to the FlatBuffer struct.
@@ -1944,7 +1944,7 @@ class FlatBufferBuilder {
/// @brief Serialize a `std::vector` of structs into a FlatBuffer `vector`
/// in sorted order.
/// @tparam T The data type of the `std::vector` struct elements.
- /// @param[in] v A const reference to the `std::vector` of structs to
+ /// @param[in] v A const reference to the `std::vector` of structs to
/// serialize into the buffer as a `vector`.
/// @return Returns a typed `Offset` into the serialized data indicating
/// where the vector is stored.
@@ -1957,7 +1957,7 @@ class FlatBufferBuilder {
/// `vector` in sorted order.
/// @tparam T The data type of the `std::vector` struct elements.
/// @tparam S The data type of the `std::vector` native struct elements.
- /// @param[in] v A const reference to the `std::vector` of structs to
+ /// @param[in] v A const reference to the `std::vector` of structs to
/// serialize into the buffer as a `vector`.
/// @return Returns a typed `Offset` into the serialized data indicating
/// where the vector is stored.
@@ -1996,14 +1996,14 @@ class FlatBufferBuilder {
extern T Pack(const S &);
typedef T (*Pack_t)(const S &);
std::vector<T> vv(len);
- std::transform(v, v + len, vv.begin(), static_cast<Pack_t &>(Pack));
+ std::transform(v, v + len, vv.begin(), static_cast<Pack_t &>(Pack));
return CreateVectorOfSortedStructs<T>(vv, len);
}
/// @cond FLATBUFFERS_INTERNAL
template<typename T> struct TableKeyComparator {
TableKeyComparator(vector_downward &buf) : buf_(buf) {}
- TableKeyComparator(const TableKeyComparator &other) : buf_(other.buf_) {}
+ TableKeyComparator(const TableKeyComparator &other) : buf_(other.buf_) {}
bool operator()(const Offset<T> &a, const Offset<T> &b) const {
auto table_a = reinterpret_cast<T *>(buf_.data_at(a.o));
auto table_b = reinterpret_cast<T *>(buf_.data_at(b.o));
@@ -2079,24 +2079,24 @@ class FlatBufferBuilder {
}
template<typename T>
- Offset<Vector<const T *>> CreateUninitializedVectorOfStructs(size_t len,
- T **buf) {
+ Offset<Vector<const T *>> CreateUninitializedVectorOfStructs(size_t len,
+ T **buf) {
return CreateUninitializedVector(len, sizeof(T),
reinterpret_cast<uint8_t **>(buf));
}
- // @brief Create a vector of scalar type T given as input a vector of scalar
- // type U, useful with e.g. pre "enum class" enums, or any existing scalar
- // data of the wrong type.
- template<typename T, typename U>
- Offset<Vector<T>> CreateVectorScalarCast(const U *v, size_t len) {
- AssertScalarT<T>();
- AssertScalarT<U>();
- StartVector(len, sizeof(T));
- for (auto i = len; i > 0;) { PushElement(static_cast<T>(v[--i])); }
- return Offset<Vector<T>>(EndVector(len));
- }
-
+ // @brief Create a vector of scalar type T given as input a vector of scalar
+ // type U, useful with e.g. pre "enum class" enums, or any existing scalar
+ // data of the wrong type.
+ template<typename T, typename U>
+ Offset<Vector<T>> CreateVectorScalarCast(const U *v, size_t len) {
+ AssertScalarT<T>();
+ AssertScalarT<U>();
+ StartVector(len, sizeof(T));
+ for (auto i = len; i > 0;) { PushElement(static_cast<T>(v[--i])); }
+ return Offset<Vector<T>>(EndVector(len));
+ }
+
/// @brief Write a struct by itself, typically to be part of a union.
template<typename T> Offset<const T *> CreateStruct(const T &structobj) {
NotNested();
@@ -2129,10 +2129,10 @@ class FlatBufferBuilder {
Finish(root.o, file_identifier, true);
}
- void SwapBufAllocator(FlatBufferBuilder &other) {
- buf_.swap_allocator(other.buf_);
- }
-
+ void SwapBufAllocator(FlatBufferBuilder &other) {
+ buf_.swap_allocator(other.buf_);
+ }
+
protected:
// You shouldn't really be copying instances of this class.
FlatBufferBuilder(const FlatBufferBuilder &);
@@ -2186,8 +2186,8 @@ class FlatBufferBuilder {
bool operator()(const Offset<String> &a, const Offset<String> &b) const {
auto stra = reinterpret_cast<const String *>(buf_->data_at(a.o));
auto strb = reinterpret_cast<const String *>(buf_->data_at(b.o));
- return StringLessThan(stra->data(), stra->size(), strb->data(),
- strb->size());
+ return StringLessThan(stra->data(), stra->size(), strb->data(),
+ strb->size());
}
const vector_downward *buf_;
};
@@ -2251,15 +2251,15 @@ const T *GetTemporaryPointer(FlatBufferBuilder &fbb, Offset<T> offset) {
/// This function is UNDEFINED for FlatBuffers whose schema does not include
/// a file_identifier (likely points at padding or the start of a the root
/// vtable).
-inline const char *GetBufferIdentifier(const void *buf,
- bool size_prefixed = false) {
+inline const char *GetBufferIdentifier(const void *buf,
+ bool size_prefixed = false) {
return reinterpret_cast<const char *>(buf) +
((size_prefixed) ? 2 * sizeof(uoffset_t) : sizeof(uoffset_t));
}
// Helper to see if the identifier in a buffer has the expected value.
-inline bool BufferHasIdentifier(const void *buf, const char *identifier,
- bool size_prefixed = false) {
+inline bool BufferHasIdentifier(const void *buf, const char *identifier,
+ bool size_prefixed = false) {
return strncmp(GetBufferIdentifier(buf, size_prefixed), identifier,
FlatBufferBuilder::kFileIdentifierLength) == 0;
}
@@ -2268,16 +2268,16 @@ inline bool BufferHasIdentifier(const void *buf, const char *identifier,
class Verifier FLATBUFFERS_FINAL_CLASS {
public:
Verifier(const uint8_t *buf, size_t buf_len, uoffset_t _max_depth = 64,
- uoffset_t _max_tables = 1000000, bool _check_alignment = true)
+ uoffset_t _max_tables = 1000000, bool _check_alignment = true)
: buf_(buf),
size_(buf_len),
depth_(0),
max_depth_(_max_depth),
num_tables_(0),
- max_tables_(_max_tables),
- upper_bound_(0),
- check_alignment_(_check_alignment) {
- FLATBUFFERS_ASSERT(size_ < FLATBUFFERS_MAX_BUFFER_SIZE);
+ max_tables_(_max_tables),
+ upper_bound_(0),
+ check_alignment_(_check_alignment) {
+ FLATBUFFERS_ASSERT(size_ < FLATBUFFERS_MAX_BUFFER_SIZE);
}
// Central location where any verification failures register.
@@ -2307,7 +2307,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
}
template<typename T> bool VerifyAlignment(size_t elem) const {
- return Check((elem & (sizeof(T) - 1)) == 0 || !check_alignment_);
+ return Check((elem & (sizeof(T) - 1)) == 0 || !check_alignment_);
}
// Verify a range indicated by sizeof(T).
@@ -2315,18 +2315,18 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
return VerifyAlignment<T>(elem) && Verify(elem, sizeof(T));
}
- bool VerifyFromPointer(const uint8_t *p, size_t len) {
- auto o = static_cast<size_t>(p - buf_);
- return Verify(o, len);
- }
-
+ bool VerifyFromPointer(const uint8_t *p, size_t len) {
+ auto o = static_cast<size_t>(p - buf_);
+ return Verify(o, len);
+ }
+
// Verify relative to a known-good base pointer.
bool Verify(const uint8_t *base, voffset_t elem_off, size_t elem_len) const {
return Verify(static_cast<size_t>(base - buf_) + elem_off, elem_len);
}
- template<typename T>
- bool Verify(const uint8_t *base, voffset_t elem_off) const {
+ template<typename T>
+ bool Verify(const uint8_t *base, voffset_t elem_off) const {
return Verify(static_cast<size_t>(base - buf_) + elem_off, sizeof(T));
}
@@ -2349,15 +2349,15 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
// Verify a pointer (may be NULL) to string.
bool VerifyString(const String *str) const {
size_t end;
- return !str || (VerifyVectorOrString(reinterpret_cast<const uint8_t *>(str),
- 1, &end) &&
- Verify(end, 1) && // Must have terminator
- Check(buf_[end] == '\0')); // Terminating byte must be 0.
+ return !str || (VerifyVectorOrString(reinterpret_cast<const uint8_t *>(str),
+ 1, &end) &&
+ Verify(end, 1) && // Must have terminator
+ Check(buf_[end] == '\0')); // Terminating byte must be 0.
}
// Common code between vectors and strings.
bool VerifyVectorOrString(const uint8_t *vec, size_t elem_size,
- size_t *end = nullptr) const {
+ size_t *end = nullptr) const {
auto veco = static_cast<size_t>(vec - buf_);
// Check we can read the size field.
if (!Verify<uoffset_t>(veco)) return false;
@@ -2392,12 +2392,12 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
return true;
}
- __supress_ubsan__("unsigned-integer-overflow") bool VerifyTableStart(
- const uint8_t *table) {
+ __supress_ubsan__("unsigned-integer-overflow") bool VerifyTableStart(
+ const uint8_t *table) {
// Check the vtable offset.
auto tableo = static_cast<size_t>(table - buf_);
if (!Verify<soffset_t>(tableo)) return false;
- // This offset may be signed, but doing the subtraction unsigned always
+ // This offset may be signed, but doing the subtraction unsigned always
// gives the result we want.
auto vtableo = tableo - static_cast<size_t>(ReadScalar<soffset_t>(table));
// Check the vtable size field, then check vtable fits in its entirety.
@@ -2441,7 +2441,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
if (!Verify<uoffset_t>(start)) return 0;
auto o = ReadScalar<uoffset_t>(buf_ + start);
// May not point to itself.
- if (!Check(o != 0)) return 0;
+ if (!Check(o != 0)) return 0;
// Can't wrap around / buffers are max 2GB.
if (!Check(static_cast<soffset_t>(o) >= 0)) return 0;
// Must be inside the buffer to create a pointer from it (pointer outside
@@ -2472,19 +2472,19 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
// Returns the message size in bytes
size_t GetComputedSize() const {
- // clang-format off
- #ifdef FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE
- uintptr_t size = upper_bound_;
- // Align the size to uoffset_t
- size = (size - 1 + sizeof(uoffset_t)) & ~(sizeof(uoffset_t) - 1);
- return (size > size_) ? 0 : size;
- #else
- // Must turn on FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE for this to work.
- (void)upper_bound_;
- FLATBUFFERS_ASSERT(false);
- return 0;
- #endif
- // clang-format on
+ // clang-format off
+ #ifdef FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE
+ uintptr_t size = upper_bound_;
+ // Align the size to uoffset_t
+ size = (size - 1 + sizeof(uoffset_t)) & ~(sizeof(uoffset_t) - 1);
+ return (size > size_) ? 0 : size;
+ #else
+ // Must turn on FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE for this to work.
+ (void)upper_bound_;
+ FLATBUFFERS_ASSERT(false);
+ return 0;
+ #endif
+ // clang-format on
}
private:
@@ -2494,8 +2494,8 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
uoffset_t max_depth_;
uoffset_t num_tables_;
uoffset_t max_tables_;
- mutable size_t upper_bound_;
- bool check_alignment_;
+ mutable size_t upper_bound_;
+ bool check_alignment_;
};
// Convenient way to bundle a buffer and its length, to pass it around
@@ -2541,12 +2541,12 @@ class Struct FLATBUFFERS_FINAL_CLASS {
uint8_t *GetAddressOf(uoffset_t o) { return &data_[o]; }
private:
- // private constructor & copy constructor: you obtain instances of this
- // class by pointing to existing data only
- Struct();
- Struct(const Struct &);
- Struct &operator=(const Struct &);
-
+ // private constructor & copy constructor: you obtain instances of this
+ // class by pointing to existing data only
+ Struct();
+ Struct(const Struct &);
+ Struct &operator=(const Struct &);
+
uint8_t data_[1];
};
@@ -2601,7 +2601,7 @@ class Table {
template<typename T> bool SetField(voffset_t field, T val, T def) {
auto field_offset = GetOptionalFieldOffset(field);
- if (!field_offset) return IsTheSameAs(val, def);
+ if (!field_offset) return IsTheSameAs(val, def);
WriteScalar(data_ + field_offset, val);
return true;
}
@@ -2673,7 +2673,7 @@ class Table {
// class by pointing to existing data only
Table();
Table(const Table &other);
- Table &operator=(const Table &);
+ Table &operator=(const Table &);
uint8_t data_[1];
};
@@ -2689,8 +2689,8 @@ inline flatbuffers::Optional<bool> Table::GetOptional<uint8_t, bool>(
: Optional<bool>();
}
-template<typename T>
-void FlatBufferBuilder::Required(Offset<T> table, voffset_t field) {
+template<typename T>
+void FlatBufferBuilder::Required(Offset<T> table, voffset_t field) {
auto table_ptr = reinterpret_cast<const Table *>(buf_.data_at(table.o));
bool ok = table_ptr->GetOptionalFieldOffset(field) != 0;
// If this fails, the caller will show what field needs to be set.
@@ -2737,9 +2737,9 @@ inline const uint8_t *GetBufferStartFromRootPointer(const void *root) {
}
/// @brief This return the prefixed size of a FlatBuffer.
-inline uoffset_t GetPrefixedSize(const uint8_t *buf) {
- return ReadScalar<uoffset_t>(buf);
-}
+inline uoffset_t GetPrefixedSize(const uint8_t *buf) {
+ return ReadScalar<uoffset_t>(buf);
+}
// Base class for native objects (FlatBuffer data de-serialized into native
// C++ data structures).
@@ -2773,11 +2773,11 @@ typedef uint64_t hash_value_t;
// Note: this function will return false for fields equal to the default
// value, since they're not stored in the buffer (unless force_defaults was
// used).
-template<typename T>
-bool IsFieldPresent(const T *table, typename T::FlatBuffersVTableOffset field) {
+template<typename T>
+bool IsFieldPresent(const T *table, typename T::FlatBuffersVTableOffset field) {
// Cast, since Table is a private baseclass of any table types.
- return reinterpret_cast<const Table *>(table)->CheckField(
- static_cast<voffset_t>(field));
+ return reinterpret_cast<const Table *>(table)->CheckField(
+ static_cast<voffset_t>(field));
}
// Utility function for reverse lookups on the EnumNames*() functions
@@ -2802,12 +2802,12 @@ inline int LookupEnum(const char **names, const char *name) {
// clang-format off
#if defined(_MSC_VER)
#define FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(alignment) \
- __pragma(pack(1)) \
+ __pragma(pack(1)) \
struct __declspec(align(alignment))
#define FLATBUFFERS_STRUCT_END(name, size) \
- __pragma(pack()) \
+ __pragma(pack()) \
static_assert(sizeof(name) == size, "compiler breaks packing rules")
-#elif defined(__GNUC__) || defined(__clang__) || defined(__ICCARM__)
+#elif defined(__GNUC__) || defined(__clang__) || defined(__ICCARM__)
#define FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(alignment) \
_Pragma("pack(1)") \
struct __attribute__((aligned(alignment)))
@@ -2888,11 +2888,11 @@ typedef const TypeTable *(*TypeFunction)();
struct TypeTable {
SequenceType st;
size_t num_elems; // of type_codes, values, names (but not type_refs).
- const TypeCode *type_codes; // num_elems count
+ const TypeCode *type_codes; // num_elems count
const TypeFunction *type_refs; // less than num_elems entries (see TypeCode).
const int16_t *array_sizes; // less than num_elems entries (see TypeCode).
- const int64_t *values; // Only set for non-consecutive enum/union or structs.
- const char *const *names; // Only set if compiled with --reflect-names.
+ const int64_t *values; // Only set for non-consecutive enum/union or structs.
+ const char *const *names; // Only set if compiled with --reflect-names.
};
// String which identifies the current version of FlatBuffers.
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/flatc.h b/contrib/libs/flatbuffers/include/flatbuffers/flatc.h
index 1466b3651d..998c9baed4 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/flatc.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/flatc.h
@@ -14,22 +14,22 @@
* limitations under the License.
*/
-#ifndef FLATBUFFERS_FLATC_H_
-#define FLATBUFFERS_FLATC_H_
-
+#ifndef FLATBUFFERS_FLATC_H_
+#define FLATBUFFERS_FLATC_H_
+
#include <functional>
#include <limits>
#include <string>
-
-#include "flatbuffers.h"
-#include "idl.h"
-#include "util.h"
+
+#include "flatbuffers.h"
+#include "idl.h"
+#include "util.h"
namespace flatbuffers {
-extern void LogCompilerWarn(const std::string &warn);
-extern void LogCompilerError(const std::string &err);
-
+extern void LogCompilerWarn(const std::string &warn);
+extern void LogCompilerError(const std::string &err);
+
class FlatCompiler {
public:
// Output generator for the various programming languages and formats we
@@ -84,9 +84,9 @@ class FlatCompiler {
const std::string &contents,
std::vector<const char *> &include_directories) const;
- void LoadBinarySchema(Parser &parser, const std::string &filename,
- const std::string &contents);
-
+ void LoadBinarySchema(Parser &parser, const std::string &filename,
+ const std::string &contents);
+
void Warn(const std::string &warn, bool show_exe_name = true) const;
void Error(const std::string &err, bool usage = true,
@@ -97,4 +97,4 @@ class FlatCompiler {
} // namespace flatbuffers
-#endif // FLATBUFFERS_FLATC_H_
+#endif // FLATBUFFERS_FLATC_H_
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/flexbuffers.h b/contrib/libs/flatbuffers/include/flatbuffers/flexbuffers.h
index d855b67731..27f0d91d13 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/flexbuffers.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/flexbuffers.h
@@ -19,9 +19,9 @@
#include <map>
// Used to select STL variant.
-#include "base.h"
+#include "base.h"
// We use the basic binary writing functions from the regular FlatBuffers.
-#include "util.h"
+#include "util.h"
#ifdef _MSC_VER
# include <intrin.h>
@@ -65,9 +65,9 @@ enum Type {
FBT_VECTOR_UINT = 12,
FBT_VECTOR_FLOAT = 13,
FBT_VECTOR_KEY = 14,
- // DEPRECATED, use FBT_VECTOR or FBT_VECTOR_KEY instead.
- // Read test.cpp/FlexBuffersDeprecatedTest() for details on why.
- FBT_VECTOR_STRING_DEPRECATED = 15,
+ // DEPRECATED, use FBT_VECTOR or FBT_VECTOR_KEY instead.
+ // Read test.cpp/FlexBuffersDeprecatedTest() for details on why.
+ FBT_VECTOR_STRING_DEPRECATED = 15,
FBT_VECTOR_INT2 = 16, // Typed tuple (no type table, no size field).
FBT_VECTOR_UINT2 = 17,
FBT_VECTOR_FLOAT2 = 18,
@@ -90,7 +90,7 @@ inline bool IsTypedVectorElementType(Type t) {
}
inline bool IsTypedVector(Type t) {
- return (t >= FBT_VECTOR_INT && t <= FBT_VECTOR_STRING_DEPRECATED) ||
+ return (t >= FBT_VECTOR_INT && t <= FBT_VECTOR_STRING_DEPRECATED) ||
t == FBT_VECTOR_BOOL;
}
@@ -214,40 +214,40 @@ class Object {
uint8_t byte_width_;
};
-// Object that has a size, obtained either from size prefix, or elsewhere.
+// Object that has a size, obtained either from size prefix, or elsewhere.
class Sized : public Object {
public:
- // Size prefix.
- Sized(const uint8_t *data, uint8_t byte_width)
- : Object(data, byte_width), size_(read_size()) {}
- // Manual size.
- Sized(const uint8_t *data, uint8_t byte_width, size_t sz)
- : Object(data, byte_width), size_(sz) {}
- size_t size() const { return size_; }
- // Access size stored in `byte_width_` bytes before data_ pointer.
- size_t read_size() const {
+ // Size prefix.
+ Sized(const uint8_t *data, uint8_t byte_width)
+ : Object(data, byte_width), size_(read_size()) {}
+ // Manual size.
+ Sized(const uint8_t *data, uint8_t byte_width, size_t sz)
+ : Object(data, byte_width), size_(sz) {}
+ size_t size() const { return size_; }
+ // Access size stored in `byte_width_` bytes before data_ pointer.
+ size_t read_size() const {
return static_cast<size_t>(ReadUInt64(data_ - byte_width_, byte_width_));
}
-
- protected:
- size_t size_;
+
+ protected:
+ size_t size_;
};
class String : public Sized {
public:
- // Size prefix.
+ // Size prefix.
String(const uint8_t *data, uint8_t byte_width) : Sized(data, byte_width) {}
- // Manual size.
- String(const uint8_t *data, uint8_t byte_width, size_t sz)
- : Sized(data, byte_width, sz) {}
+ // Manual size.
+ String(const uint8_t *data, uint8_t byte_width, size_t sz)
+ : Sized(data, byte_width, sz) {}
size_t length() const { return size(); }
const char *c_str() const { return reinterpret_cast<const char *>(data_); }
- std::string str() const { return std::string(c_str(), size()); }
+ std::string str() const { return std::string(c_str(), size()); }
static String EmptyString() {
- static const char *empty_string = "";
- return String(reinterpret_cast<const uint8_t *>(empty_string), 1, 0);
+ static const char *empty_string = "";
+ return String(reinterpret_cast<const uint8_t *>(empty_string), 1, 0);
}
bool IsTheEmptyString() const { return data_ == EmptyString().data_; }
};
@@ -295,8 +295,8 @@ class TypedVector : public Sized {
Type ElementType() { return type_; }
- friend Reference;
-
+ friend Reference;
+
private:
Type type_;
@@ -355,24 +355,24 @@ class Map : public Vector {
bool IsTheEmptyMap() const { return data_ == EmptyMap().data_; }
};
-template<typename T>
-void AppendToString(std::string &s, T &&v, bool keys_quoted) {
- s += "[ ";
- for (size_t i = 0; i < v.size(); i++) {
- if (i) s += ", ";
- v[i].ToString(true, keys_quoted, s);
- }
- s += " ]";
-}
-
+template<typename T>
+void AppendToString(std::string &s, T &&v, bool keys_quoted) {
+ s += "[ ";
+ for (size_t i = 0; i < v.size(); i++) {
+ if (i) s += ", ";
+ v[i].ToString(true, keys_quoted, s);
+ }
+ s += " ]";
+}
+
class Reference {
public:
- Reference()
- : data_(nullptr),
- parent_width_(0),
- byte_width_(BIT_WIDTH_8),
- type_(FBT_NULL) {}
-
+ Reference()
+ : data_(nullptr),
+ parent_width_(0),
+ byte_width_(BIT_WIDTH_8),
+ type_(FBT_NULL) {}
+
Reference(const uint8_t *data, uint8_t parent_width, uint8_t byte_width,
Type type)
: data_(data),
@@ -402,19 +402,19 @@ class Reference {
bool IsString() const { return type_ == FBT_STRING; }
bool IsKey() const { return type_ == FBT_KEY; }
bool IsVector() const { return type_ == FBT_VECTOR || type_ == FBT_MAP; }
- bool IsUntypedVector() const { return type_ == FBT_VECTOR; }
+ bool IsUntypedVector() const { return type_ == FBT_VECTOR; }
bool IsTypedVector() const { return flexbuffers::IsTypedVector(type_); }
- bool IsFixedTypedVector() const {
- return flexbuffers::IsFixedTypedVector(type_);
- }
- bool IsAnyVector() const {
- return (IsTypedVector() || IsFixedTypedVector() || IsVector());
- }
+ bool IsFixedTypedVector() const {
+ return flexbuffers::IsFixedTypedVector(type_);
+ }
+ bool IsAnyVector() const {
+ return (IsTypedVector() || IsFixedTypedVector() || IsVector());
+ }
bool IsMap() const { return type_ == FBT_MAP; }
bool IsBlob() const { return type_ == FBT_BLOB; }
bool AsBool() const {
return (type_ == FBT_BOOL ? ReadUInt64(data_, parent_width_)
- : AsUInt64()) != 0;
+ : AsUInt64()) != 0;
}
// Reads any type as a int64_t. Never fails, does most sensible conversion.
@@ -492,11 +492,11 @@ class Reference {
case FBT_INDIRECT_UINT:
return static_cast<double>(ReadUInt64(Indirect(), byte_width_));
case FBT_NULL: return 0.0;
- case FBT_STRING: {
- double d;
- flatbuffers::StringToNumber(AsString().c_str(), &d);
- return d;
- }
+ case FBT_STRING: {
+ double d;
+ flatbuffers::StringToNumber(AsString().c_str(), &d);
+ return d;
+ }
case FBT_VECTOR: return static_cast<double>(AsVector().size());
case FBT_BOOL:
return static_cast<double>(ReadUInt64(data_, parent_width_));
@@ -509,29 +509,29 @@ class Reference {
float AsFloat() const { return static_cast<float>(AsDouble()); }
const char *AsKey() const {
- if (type_ == FBT_KEY || type_ == FBT_STRING) {
+ if (type_ == FBT_KEY || type_ == FBT_STRING) {
return reinterpret_cast<const char *>(Indirect());
} else {
return "";
}
}
- // This function returns the empty string if you try to read something that
- // is not a string or key.
+ // This function returns the empty string if you try to read something that
+ // is not a string or key.
String AsString() const {
if (type_ == FBT_STRING) {
return String(Indirect(), byte_width_);
- } else if (type_ == FBT_KEY) {
- auto key = Indirect();
- return String(key, byte_width_,
- strlen(reinterpret_cast<const char *>(key)));
+ } else if (type_ == FBT_KEY) {
+ auto key = Indirect();
+ return String(key, byte_width_,
+ strlen(reinterpret_cast<const char *>(key)));
} else {
return String::EmptyString();
}
}
// Unlike AsString(), this will convert any type to a std::string.
- std::string ToString() const {
+ std::string ToString() const {
std::string s;
ToString(false, false, s);
return s;
@@ -579,15 +579,15 @@ class Reference {
}
s += " }";
} else if (IsVector()) {
- AppendToString<Vector>(s, AsVector(), keys_quoted);
- } else if (IsTypedVector()) {
- AppendToString<TypedVector>(s, AsTypedVector(), keys_quoted);
- } else if (IsFixedTypedVector()) {
- AppendToString<FixedTypedVector>(s, AsFixedTypedVector(), keys_quoted);
- } else if (IsBlob()) {
- auto blob = AsBlob();
- flatbuffers::EscapeString(reinterpret_cast<const char *>(blob.data()),
- blob.size(), &s, true, false);
+ AppendToString<Vector>(s, AsVector(), keys_quoted);
+ } else if (IsTypedVector()) {
+ AppendToString<TypedVector>(s, AsTypedVector(), keys_quoted);
+ } else if (IsFixedTypedVector()) {
+ AppendToString<FixedTypedVector>(s, AsFixedTypedVector(), keys_quoted);
+ } else if (IsBlob()) {
+ auto blob = AsBlob();
+ flatbuffers::EscapeString(reinterpret_cast<const char *>(blob.data()),
+ blob.size(), &s, true, false);
} else {
s += "(?)";
}
@@ -615,18 +615,18 @@ class Reference {
TypedVector AsTypedVector() const {
if (IsTypedVector()) {
- auto tv =
- TypedVector(Indirect(), byte_width_, ToTypedVectorElementType(type_));
- if (tv.type_ == FBT_STRING) {
- // These can't be accessed as strings, since we don't know the bit-width
- // of the size field, see the declaration of
- // FBT_VECTOR_STRING_DEPRECATED above for details.
- // We change the type here to be keys, which are a subtype of strings,
- // and will ignore the size field. This will truncate strings with
- // embedded nulls.
- tv.type_ = FBT_KEY;
- }
- return tv;
+ auto tv =
+ TypedVector(Indirect(), byte_width_, ToTypedVectorElementType(type_));
+ if (tv.type_ == FBT_STRING) {
+ // These can't be accessed as strings, since we don't know the bit-width
+ // of the size field, see the declaration of
+ // FBT_VECTOR_STRING_DEPRECATED above for details.
+ // We change the type here to be keys, which are a subtype of strings,
+ // and will ignore the size field. This will truncate strings with
+ // embedded nulls.
+ tv.type_ = FBT_KEY;
+ }
+ return tv;
} else {
return TypedVector::EmptyTypedVector();
}
@@ -650,7 +650,7 @@ class Reference {
}
}
- template<typename T> T As() const;
+ template<typename T> T As() const;
// Experimental: Mutation functions.
// These allow scalars in an already created buffer to be updated in-place.
@@ -763,41 +763,41 @@ class Reference {
};
// Template specialization for As().
-template<> inline bool Reference::As<bool>() const { return AsBool(); }
-
-template<> inline int8_t Reference::As<int8_t>() const { return AsInt8(); }
-template<> inline int16_t Reference::As<int16_t>() const { return AsInt16(); }
-template<> inline int32_t Reference::As<int32_t>() const { return AsInt32(); }
-template<> inline int64_t Reference::As<int64_t>() const { return AsInt64(); }
-
-template<> inline uint8_t Reference::As<uint8_t>() const { return AsUInt8(); }
-template<> inline uint16_t Reference::As<uint16_t>() const {
- return AsUInt16();
-}
-template<> inline uint32_t Reference::As<uint32_t>() const {
- return AsUInt32();
-}
-template<> inline uint64_t Reference::As<uint64_t>() const {
- return AsUInt64();
-}
-
-template<> inline double Reference::As<double>() const { return AsDouble(); }
-template<> inline float Reference::As<float>() const { return AsFloat(); }
-
-template<> inline String Reference::As<String>() const { return AsString(); }
-template<> inline std::string Reference::As<std::string>() const {
+template<> inline bool Reference::As<bool>() const { return AsBool(); }
+
+template<> inline int8_t Reference::As<int8_t>() const { return AsInt8(); }
+template<> inline int16_t Reference::As<int16_t>() const { return AsInt16(); }
+template<> inline int32_t Reference::As<int32_t>() const { return AsInt32(); }
+template<> inline int64_t Reference::As<int64_t>() const { return AsInt64(); }
+
+template<> inline uint8_t Reference::As<uint8_t>() const { return AsUInt8(); }
+template<> inline uint16_t Reference::As<uint16_t>() const {
+ return AsUInt16();
+}
+template<> inline uint32_t Reference::As<uint32_t>() const {
+ return AsUInt32();
+}
+template<> inline uint64_t Reference::As<uint64_t>() const {
+ return AsUInt64();
+}
+
+template<> inline double Reference::As<double>() const { return AsDouble(); }
+template<> inline float Reference::As<float>() const { return AsFloat(); }
+
+template<> inline String Reference::As<String>() const { return AsString(); }
+template<> inline std::string Reference::As<std::string>() const {
return AsString().str();
}
-template<> inline Blob Reference::As<Blob>() const { return AsBlob(); }
-template<> inline Vector Reference::As<Vector>() const { return AsVector(); }
-template<> inline TypedVector Reference::As<TypedVector>() const {
+template<> inline Blob Reference::As<Blob>() const { return AsBlob(); }
+template<> inline Vector Reference::As<Vector>() const { return AsVector(); }
+template<> inline TypedVector Reference::As<TypedVector>() const {
return AsTypedVector();
}
-template<> inline FixedTypedVector Reference::As<FixedTypedVector>() const {
+template<> inline FixedTypedVector Reference::As<FixedTypedVector>() const {
return AsFixedTypedVector();
}
-template<> inline Map Reference::As<Map>() const { return AsMap(); }
+template<> inline Map Reference::As<Map>() const { return AsMap(); }
inline uint8_t PackedType(BitWidth bit_width, Type type) {
return static_cast<uint8_t>(bit_width | (type << 2));
@@ -1106,7 +1106,7 @@ class Builder FLATBUFFERS_FINAL_CLASS {
for (auto key = start; key < stack_.size(); key += 2) {
FLATBUFFERS_ASSERT(stack_[key].type_ == FBT_KEY);
}
- // Now sort values, so later we can do a binary search lookup.
+ // Now sort values, so later we can do a binary search lookup.
// We want to sort 2 array elements at a time.
struct TwoValue {
Value key;
@@ -1262,24 +1262,24 @@ class Builder FLATBUFFERS_FINAL_CLASS {
EndMap(start);
}
- // If you wish to share a value explicitly (a value not shared automatically
- // through one of the BUILDER_FLAG_SHARE_* flags) you can do so with these
- // functions. Or if you wish to turn those flags off for performance reasons
- // and still do some explicit sharing. For example:
- // builder.IndirectDouble(M_PI);
- // auto id = builder.LastValue(); // Remember where we stored it.
- // .. more code goes here ..
- // builder.ReuseValue(id); // Refers to same double by offset.
+ // If you wish to share a value explicitly (a value not shared automatically
+ // through one of the BUILDER_FLAG_SHARE_* flags) you can do so with these
+ // functions. Or if you wish to turn those flags off for performance reasons
+ // and still do some explicit sharing. For example:
+ // builder.IndirectDouble(M_PI);
+ // auto id = builder.LastValue(); // Remember where we stored it.
+ // .. more code goes here ..
+ // builder.ReuseValue(id); // Refers to same double by offset.
// LastValue works regardless of whether the value has a key or not.
- // Works on any data type.
- struct Value;
- Value LastValue() { return stack_.back(); }
- void ReuseValue(Value v) { stack_.push_back(v); }
- void ReuseValue(const char *key, Value v) {
- Key(key);
- ReuseValue(v);
- }
-
+ // Works on any data type.
+ struct Value;
+ Value LastValue() { return stack_.back(); }
+ void ReuseValue(Value v) { stack_.push_back(v); }
+ void ReuseValue(const char *key, Value v) {
+ Key(key);
+ ReuseValue(v);
+ }
+
// Overloaded Add that tries to call the correct function above.
void Add(int8_t i) { Int(i); }
void Add(int16_t i) { Int(i); }
@@ -1405,8 +1405,8 @@ class Builder FLATBUFFERS_FINAL_CLASS {
: FBT_INT);
}
- public:
- // This was really intended to be private, except for LastValue/ReuseValue.
+ public:
+ // This was really intended to be private, except for LastValue/ReuseValue.
struct Value {
union {
int64_t i_;
@@ -1479,7 +1479,7 @@ class Builder FLATBUFFERS_FINAL_CLASS {
}
};
- private:
+ private:
void WriteAny(const Value &val, uint8_t byte_width) {
switch (val.type_) {
case FBT_NULL:
@@ -1512,7 +1512,7 @@ class Builder FLATBUFFERS_FINAL_CLASS {
// TODO: instead of asserting, could write vector with larger elements
// instead, though that would be wasteful.
FLATBUFFERS_ASSERT(WidthU(len) <= bit_width);
- Align(bit_width);
+ Align(bit_width);
if (!fixed) Write<uint64_t>(len, byte_width);
auto vloc = buf_.size();
for (size_t i = 0; i < len; i++) Write(elems[i], byte_width);
@@ -1524,9 +1524,9 @@ class Builder FLATBUFFERS_FINAL_CLASS {
Value CreateVector(size_t start, size_t vec_len, size_t step, bool typed,
bool fixed, const Value *keys = nullptr) {
- FLATBUFFERS_ASSERT(
- !fixed ||
- typed); // typed=false, fixed=true combination is not supported.
+ FLATBUFFERS_ASSERT(
+ !fixed ||
+ typed); // typed=false, fixed=true combination is not supported.
// Figure out smallest bit width we can store this vector with.
auto bit_width = (std::max)(force_min_bit_width_, WidthU(vec_len));
auto prefix_elems = 1;
@@ -1608,8 +1608,8 @@ class Builder FLATBUFFERS_FINAL_CLASS {
typedef std::pair<size_t, size_t> StringOffset;
struct StringOffsetCompare {
- explicit StringOffsetCompare(const std::vector<uint8_t> &buf)
- : buf_(&buf) {}
+ explicit StringOffsetCompare(const std::vector<uint8_t> &buf)
+ : buf_(&buf) {}
bool operator()(const StringOffset &a, const StringOffset &b) const {
auto stra = reinterpret_cast<const char *>(
flatbuffers::vector_data(*buf_) + a.first);
@@ -1629,8 +1629,8 @@ class Builder FLATBUFFERS_FINAL_CLASS {
} // namespace flexbuffers
-#if defined(_MSC_VER)
-# pragma warning(pop)
-#endif
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif
#endif // FLATBUFFERS_FLEXBUFFERS_H_
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/grpc.h b/contrib/libs/flatbuffers/include/flatbuffers/grpc.h
index da7830e7dc..49ac06e686 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/grpc.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/grpc.h
@@ -19,7 +19,7 @@
// Helper functionality to glue FlatBuffers and GRPC.
-#include "flatbuffers.h"
+#include "flatbuffers.h"
#include "grpc/byte_buffer_reader.h"
#include "grpcpp/support/byte_buffer.h"
@@ -88,7 +88,7 @@ class SliceAllocator : public Allocator {
SliceAllocator(const SliceAllocator &other) = delete;
SliceAllocator &operator=(const SliceAllocator &other) = delete;
- SliceAllocator(SliceAllocator &&other) : slice_(grpc_empty_slice()) {
+ SliceAllocator(SliceAllocator &&other) : slice_(grpc_empty_slice()) {
// default-construct and swap idiom
swap(other);
}
@@ -169,37 +169,37 @@ class MessageBuilder : private detail::SliceAllocatorMember,
MessageBuilder &operator=(const MessageBuilder &other) = delete;
MessageBuilder(MessageBuilder &&other)
- : FlatBufferBuilder(1024, &slice_allocator_, false) {
+ : FlatBufferBuilder(1024, &slice_allocator_, false) {
// Default construct and swap idiom.
Swap(other);
}
- /// Create a MessageBuilder from a FlatBufferBuilder.
- explicit MessageBuilder(FlatBufferBuilder &&src,
- void (*dealloc)(void *,
- size_t) = &DefaultAllocator::dealloc)
- : FlatBufferBuilder(1024, &slice_allocator_, false) {
- src.Swap(*this);
- src.SwapBufAllocator(*this);
- if (buf_.capacity()) {
- uint8_t *buf = buf_.scratch_data(); // pointer to memory
- size_t capacity = buf_.capacity(); // size of memory
- slice_allocator_.slice_ = grpc_slice_new_with_len(buf, capacity, dealloc);
- } else {
- slice_allocator_.slice_ = grpc_empty_slice();
- }
- }
-
- /// Move-assign a FlatBufferBuilder to a MessageBuilder.
- /// Only FlatBufferBuilder with default allocator (basically, nullptr) is
- /// supported.
- MessageBuilder &operator=(FlatBufferBuilder &&src) {
- // Move construct a temporary and swap
- MessageBuilder temp(std::move(src));
- Swap(temp);
- return *this;
- }
-
+ /// Create a MessageBuilder from a FlatBufferBuilder.
+ explicit MessageBuilder(FlatBufferBuilder &&src,
+ void (*dealloc)(void *,
+ size_t) = &DefaultAllocator::dealloc)
+ : FlatBufferBuilder(1024, &slice_allocator_, false) {
+ src.Swap(*this);
+ src.SwapBufAllocator(*this);
+ if (buf_.capacity()) {
+ uint8_t *buf = buf_.scratch_data(); // pointer to memory
+ size_t capacity = buf_.capacity(); // size of memory
+ slice_allocator_.slice_ = grpc_slice_new_with_len(buf, capacity, dealloc);
+ } else {
+ slice_allocator_.slice_ = grpc_empty_slice();
+ }
+ }
+
+ /// Move-assign a FlatBufferBuilder to a MessageBuilder.
+ /// Only FlatBufferBuilder with default allocator (basically, nullptr) is
+ /// supported.
+ MessageBuilder &operator=(FlatBufferBuilder &&src) {
+ // Move construct a temporary and swap
+ MessageBuilder temp(std::move(src));
+ Swap(temp);
+ return *this;
+ }
+
MessageBuilder &operator=(MessageBuilder &&other) {
// Move construct a temporary and swap
MessageBuilder temp(std::move(other));
@@ -210,11 +210,11 @@ class MessageBuilder : private detail::SliceAllocatorMember,
void Swap(MessageBuilder &other) {
slice_allocator_.swap(other.slice_allocator_);
FlatBufferBuilder::Swap(other);
- // After swapping the FlatBufferBuilder, we swap back the allocator, which
- // restores the original allocator back in place. This is necessary because
- // MessageBuilder's allocator is its own member (SliceAllocatorMember). The
- // allocator passed to FlatBufferBuilder::vector_downward must point to this
- // member.
+ // After swapping the FlatBufferBuilder, we swap back the allocator, which
+ // restores the original allocator back in place. This is necessary because
+ // MessageBuilder's allocator is its own member (SliceAllocatorMember). The
+ // allocator passed to FlatBufferBuilder::vector_downward must point to this
+ // member.
buf_.swap_allocator(other.buf_);
}
@@ -234,10 +234,10 @@ class MessageBuilder : private detail::SliceAllocatorMember,
// flatbuffers-encoded region and wraps it in a `Message<T>` to handle buffer
// ownership.
template<class T> Message<T> GetMessage() {
- auto buf_data = buf_.scratch_data(); // pointer to memory
- auto buf_size = buf_.capacity(); // size of memory
- auto msg_data = buf_.data(); // pointer to msg
- auto msg_size = buf_.size(); // size of msg
+ auto buf_data = buf_.scratch_data(); // pointer to memory
+ auto buf_size = buf_.capacity(); // size of memory
+ auto msg_data = buf_.data(); // pointer to msg
+ auto msg_size = buf_.size(); // size of msg
// Do some sanity checks on data/size
FLATBUFFERS_ASSERT(msg_data);
FLATBUFFERS_ASSERT(msg_size);
@@ -276,7 +276,7 @@ template<class T> class SerializationTraits<flatbuffers::grpc::Message<T>> {
grpc_byte_buffer **buffer, bool *own_buffer) {
// We are passed in a `Message<T>`, which is a wrapper around a
// `grpc_slice`. We extract it here using `BorrowSlice()`. The const cast
- // is necessary because the `grpc_raw_byte_buffer_create` func expects
+ // is necessary because the `grpc_raw_byte_buffer_create` func expects
// non-const slices in order to increment their refcounts.
grpc_slice *slice = const_cast<grpc_slice *>(&msg.BorrowSlice());
// Now use `grpc_raw_byte_buffer_create` to package the single slice into a
@@ -309,7 +309,7 @@ template<class T> class SerializationTraits<flatbuffers::grpc::Message<T>> {
grpc_byte_buffer_reader_init(&reader, buffer);
grpc_slice slice = grpc_byte_buffer_reader_readall(&reader);
grpc_byte_buffer_reader_destroy(&reader);
- // We wrap a `Message<T>` around the slice, but don't increment refcount
+ // We wrap a `Message<T>` around the slice, but don't increment refcount
*msg = flatbuffers::grpc::Message<T>(slice, false);
}
grpc_byte_buffer_destroy(buffer);
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/hash.h b/contrib/libs/flatbuffers/include/flatbuffers/hash.h
index 52cc628cdf..07d6ff744e 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/hash.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/hash.h
@@ -20,7 +20,7 @@
#include <cstdint>
#include <cstring>
-#include "flatbuffers.h"
+#include "flatbuffers.h"
namespace flatbuffers {
@@ -39,7 +39,7 @@ template<> struct FnvTraits<uint64_t> {
static const uint64_t kOffsetBasis = 0xcbf29ce484222645ULL;
};
-template<typename T> T HashFnv1(const char *input) {
+template<typename T> T HashFnv1(const char *input) {
T hash = FnvTraits<T>::kOffsetBasis;
for (const char *c = input; *c; ++c) {
hash *= FnvTraits<T>::kFnvPrime;
@@ -48,7 +48,7 @@ template<typename T> T HashFnv1(const char *input) {
return hash;
}
-template<typename T> T HashFnv1a(const char *input) {
+template<typename T> T HashFnv1a(const char *input) {
T hash = FnvTraits<T>::kOffsetBasis;
for (const char *c = input; *c; ++c) {
hash ^= static_cast<unsigned char>(*c);
@@ -57,17 +57,17 @@ template<typename T> T HashFnv1a(const char *input) {
return hash;
}
-template<> inline uint16_t HashFnv1<uint16_t>(const char *input) {
+template<> inline uint16_t HashFnv1<uint16_t>(const char *input) {
uint32_t hash = HashFnv1<uint32_t>(input);
return (hash >> 16) ^ (hash & 0xffff);
}
-template<> inline uint16_t HashFnv1a<uint16_t>(const char *input) {
+template<> inline uint16_t HashFnv1a<uint16_t>(const char *input) {
uint32_t hash = HashFnv1a<uint32_t>(input);
return (hash >> 16) ^ (hash & 0xffff);
}
-template<typename T> struct NamedHashFunction {
+template<typename T> struct NamedHashFunction {
const char *name;
typedef T (*HashFunction)(const char *);
@@ -75,7 +75,7 @@ template<typename T> struct NamedHashFunction {
};
const NamedHashFunction<uint16_t> kHashFunctions16[] = {
- { "fnv1_16", HashFnv1<uint16_t> },
+ { "fnv1_16", HashFnv1<uint16_t> },
{ "fnv1a_16", HashFnv1a<uint16_t> },
};
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/idl.h b/contrib/libs/flatbuffers/include/flatbuffers/idl.h
index a82ff8a694..cd6fb4e6b3 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/idl.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/idl.h
@@ -21,11 +21,11 @@
#include <memory>
#include <stack>
-#include "base.h"
-#include "flatbuffers.h"
-#include "flexbuffers.h"
-#include "hash.h"
-#include "reflection.h"
+#include "base.h"
+#include "flatbuffers.h"
+#include "flexbuffers.h"
+#include "hash.h"
+#include "reflection.h"
#if !defined(FLATBUFFERS_CPP98_STL)
# include <functional>
@@ -34,12 +34,12 @@
// This file defines the data types representing a parsed IDL (Interface
// Definition Language) / schema file.
-// Limits maximum depth of nested objects.
+// Limits maximum depth of nested objects.
// Prevents stack overflow while parse scheme, or json, or flexbuffer.
-#if !defined(FLATBUFFERS_MAX_PARSING_DEPTH)
-# define FLATBUFFERS_MAX_PARSING_DEPTH 64
-#endif
-
+#if !defined(FLATBUFFERS_MAX_PARSING_DEPTH)
+# define FLATBUFFERS_MAX_PARSING_DEPTH 64
+#endif
+
namespace flatbuffers {
// The order of these matters for Is*() functions below.
@@ -47,26 +47,26 @@ namespace flatbuffers {
// of type tokens.
// clang-format off
#define FLATBUFFERS_GEN_TYPES_SCALAR(TD) \
- TD(NONE, "", uint8_t, byte, byte, byte, uint8, u8, UByte, UInt8) \
- TD(UTYPE, "", uint8_t, byte, byte, byte, uint8, u8, UByte, UInt8) /* begin scalar/int */ \
- TD(BOOL, "bool", uint8_t, boolean,bool, bool, bool, bool, Boolean, Bool) \
- TD(CHAR, "byte", int8_t, byte, int8, sbyte, int8, i8, Byte, Int8) \
- TD(UCHAR, "ubyte", uint8_t, byte, byte, byte, uint8, u8, UByte, UInt8) \
- TD(SHORT, "short", int16_t, short, int16, short, int16, i16, Short, Int16) \
- TD(USHORT, "ushort", uint16_t, short, uint16, ushort, uint16, u16, UShort, UInt16) \
- TD(INT, "int", int32_t, int, int32, int, int32, i32, Int, Int32) \
- TD(UINT, "uint", uint32_t, int, uint32, uint, uint32, u32, UInt, UInt32) \
- TD(LONG, "long", int64_t, long, int64, long, int64, i64, Long, Int64) \
- TD(ULONG, "ulong", uint64_t, long, uint64, ulong, uint64, u64, ULong, UInt64) /* end int */ \
- TD(FLOAT, "float", float, float, float32, float, float32, f32, Float, Float32) /* begin float */ \
- TD(DOUBLE, "double", double, double, float64, double, float64, f64, Double, Double) /* end float/scalar */
+ TD(NONE, "", uint8_t, byte, byte, byte, uint8, u8, UByte, UInt8) \
+ TD(UTYPE, "", uint8_t, byte, byte, byte, uint8, u8, UByte, UInt8) /* begin scalar/int */ \
+ TD(BOOL, "bool", uint8_t, boolean,bool, bool, bool, bool, Boolean, Bool) \
+ TD(CHAR, "byte", int8_t, byte, int8, sbyte, int8, i8, Byte, Int8) \
+ TD(UCHAR, "ubyte", uint8_t, byte, byte, byte, uint8, u8, UByte, UInt8) \
+ TD(SHORT, "short", int16_t, short, int16, short, int16, i16, Short, Int16) \
+ TD(USHORT, "ushort", uint16_t, short, uint16, ushort, uint16, u16, UShort, UInt16) \
+ TD(INT, "int", int32_t, int, int32, int, int32, i32, Int, Int32) \
+ TD(UINT, "uint", uint32_t, int, uint32, uint, uint32, u32, UInt, UInt32) \
+ TD(LONG, "long", int64_t, long, int64, long, int64, i64, Long, Int64) \
+ TD(ULONG, "ulong", uint64_t, long, uint64, ulong, uint64, u64, ULong, UInt64) /* end int */ \
+ TD(FLOAT, "float", float, float, float32, float, float32, f32, Float, Float32) /* begin float */ \
+ TD(DOUBLE, "double", double, double, float64, double, float64, f64, Double, Double) /* end float/scalar */
#define FLATBUFFERS_GEN_TYPES_POINTER(TD) \
- TD(STRING, "string", Offset<void>, int, int, StringOffset, int, unused, Int, Offset<String>) \
- TD(VECTOR, "", Offset<void>, int, int, VectorOffset, int, unused, Int, Offset<UOffset>) \
- TD(STRUCT, "", Offset<void>, int, int, int, int, unused, Int, Offset<UOffset>) \
- TD(UNION, "", Offset<void>, int, int, int, int, unused, Int, Offset<UOffset>)
-#define FLATBUFFERS_GEN_TYPE_ARRAY(TD) \
- TD(ARRAY, "", int, int, int, int, int, unused, Int, Offset<UOffset>)
+ TD(STRING, "string", Offset<void>, int, int, StringOffset, int, unused, Int, Offset<String>) \
+ TD(VECTOR, "", Offset<void>, int, int, VectorOffset, int, unused, Int, Offset<UOffset>) \
+ TD(STRUCT, "", Offset<void>, int, int, int, int, unused, Int, Offset<UOffset>) \
+ TD(UNION, "", Offset<void>, int, int, int, int, unused, Int, Offset<UOffset>)
+#define FLATBUFFERS_GEN_TYPE_ARRAY(TD) \
+ TD(ARRAY, "", int, int, int, int, int, unused, Int, Offset<UOffset>)
// The fields are:
// - enum
// - FlatBuffers schema type.
@@ -76,28 +76,14 @@ namespace flatbuffers {
// - C# / .Net type.
// - Python type.
// - Rust type.
-// - Kotlin type.
+// - Kotlin type.
// using these macros, we can now write code dealing with types just once, e.g.
/*
switch (type) {
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE, \
- RTYPE, KTYPE) \
- case BASE_TYPE_ ## ENUM: \
- // do something specific to CTYPE here
- FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
- #undef FLATBUFFERS_TD
-}
-*/
-
-// If not all FLATBUFFERS_GEN_() arguments are necessary for implementation
-// of FLATBUFFERS_TD, you can use a variadic macro (with __VA_ARGS__ if needed).
-// In the above example, only CTYPE is used to generate the code, it can be rewritten:
-
-/*
-switch (type) {
- #define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \
+ RTYPE, KTYPE) \
case BASE_TYPE_ ## ENUM: \
// do something specific to CTYPE here
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
@@ -105,25 +91,39 @@ switch (type) {
}
*/
+// If not all FLATBUFFERS_GEN_() arguments are necessary for implementation
+// of FLATBUFFERS_TD, you can use a variadic macro (with __VA_ARGS__ if needed).
+// In the above example, only CTYPE is used to generate the code, it can be rewritten:
+
+/*
+switch (type) {
+ #define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \
+ case BASE_TYPE_ ## ENUM: \
+ // do something specific to CTYPE here
+ FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
+ #undef FLATBUFFERS_TD
+}
+*/
+
#define FLATBUFFERS_GEN_TYPES(TD) \
FLATBUFFERS_GEN_TYPES_SCALAR(TD) \
- FLATBUFFERS_GEN_TYPES_POINTER(TD) \
- FLATBUFFERS_GEN_TYPE_ARRAY(TD)
+ FLATBUFFERS_GEN_TYPES_POINTER(TD) \
+ FLATBUFFERS_GEN_TYPE_ARRAY(TD)
// Create an enum for all the types above.
#ifdef __GNUC__
__extension__ // Stop GCC complaining about trailing comma with -Wpendantic.
#endif
enum BaseType {
- #define FLATBUFFERS_TD(ENUM, ...) \
- BASE_TYPE_ ## ENUM,
+ #define FLATBUFFERS_TD(ENUM, ...) \
+ BASE_TYPE_ ## ENUM,
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
#undef FLATBUFFERS_TD
};
-#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \
- static_assert(sizeof(CTYPE) <= sizeof(largest_scalar_t), \
- "define largest_scalar_t as " #CTYPE);
+#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \
+ static_assert(sizeof(CTYPE) <= sizeof(largest_scalar_t), \
+ "define largest_scalar_t as " #CTYPE);
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
#undef FLATBUFFERS_TD
@@ -138,13 +138,13 @@ inline bool IsLong (BaseType t) { return t == BASE_TYPE_LONG ||
inline bool IsBool (BaseType t) { return t == BASE_TYPE_BOOL; }
inline bool IsOneByte(BaseType t) { return t >= BASE_TYPE_UTYPE &&
t <= BASE_TYPE_UCHAR; }
-
-inline bool IsUnsigned(BaseType t) {
- return (t == BASE_TYPE_UTYPE) || (t == BASE_TYPE_UCHAR) ||
- (t == BASE_TYPE_USHORT) || (t == BASE_TYPE_UINT) ||
- (t == BASE_TYPE_ULONG);
-}
-
+
+inline bool IsUnsigned(BaseType t) {
+ return (t == BASE_TYPE_UTYPE) || (t == BASE_TYPE_UCHAR) ||
+ (t == BASE_TYPE_USHORT) || (t == BASE_TYPE_UINT) ||
+ (t == BASE_TYPE_ULONG);
+}
+
// clang-format on
extern const char *const kTypeNames[];
@@ -160,32 +160,32 @@ class Parser;
// and additional information for vectors/structs_.
struct Type {
explicit Type(BaseType _base_type = BASE_TYPE_NONE, StructDef *_sd = nullptr,
- EnumDef *_ed = nullptr, uint16_t _fixed_length = 0)
+ EnumDef *_ed = nullptr, uint16_t _fixed_length = 0)
: base_type(_base_type),
element(BASE_TYPE_NONE),
struct_def(_sd),
- enum_def(_ed),
- fixed_length(_fixed_length) {}
+ enum_def(_ed),
+ fixed_length(_fixed_length) {}
bool operator==(const Type &o) {
return base_type == o.base_type && element == o.element &&
struct_def == o.struct_def && enum_def == o.enum_def;
}
- Type VectorType() const {
- return Type(element, struct_def, enum_def, fixed_length);
- }
+ Type VectorType() const {
+ return Type(element, struct_def, enum_def, fixed_length);
+ }
Offset<reflection::Type> Serialize(FlatBufferBuilder *builder) const;
- bool Deserialize(const Parser &parser, const reflection::Type *type);
-
+ bool Deserialize(const Parser &parser, const reflection::Type *type);
+
BaseType base_type;
BaseType element; // only set if t == BASE_TYPE_VECTOR
StructDef *struct_def; // only set if t or element == BASE_TYPE_STRUCT
EnumDef *enum_def; // set if t == BASE_TYPE_UNION / BASE_TYPE_UTYPE,
// or for an integral type derived from an enum.
- uint16_t fixed_length; // only set if t == BASE_TYPE_ARRAY
+ uint16_t fixed_length; // only set if t == BASE_TYPE_ARRAY
};
// Represents a parsed scalar value, it's type, and field offset.
@@ -250,15 +250,15 @@ struct Namespace {
size_t from_table; // Part of the namespace corresponds to a message/table.
};
-inline bool operator<(const Namespace &a, const Namespace &b) {
- size_t min_size = std::min(a.components.size(), b.components.size());
- for (size_t i = 0; i < min_size; ++i) {
- if (a.components[i] != b.components[i])
- return a.components[i] < b.components[i];
- }
- return a.components.size() < b.components.size();
-}
-
+inline bool operator<(const Namespace &a, const Namespace &b) {
+ size_t min_size = std::min(a.components.size(), b.components.size());
+ for (size_t i = 0; i < min_size; ++i) {
+ if (a.components[i] != b.components[i])
+ return a.components[i] < b.components[i];
+ }
+ return a.components.size() < b.components.size();
+}
+
// Base class for all definition types (fields, structs_, enums_).
struct Definition {
Definition()
@@ -272,9 +272,9 @@ struct Definition {
flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>>
SerializeAttributes(FlatBufferBuilder *builder, const Parser &parser) const;
- bool DeserializeAttributes(Parser &parser,
- const Vector<Offset<reflection::KeyValue>> *attrs);
-
+ bool DeserializeAttributes(Parser &parser,
+ const Vector<Offset<reflection::KeyValue>> *attrs);
+
std::string name;
std::string file;
std::vector<std::string> doc_comment;
@@ -292,7 +292,7 @@ struct FieldDef : public Definition {
FieldDef()
: deprecated(false),
key(false),
- shared(false),
+ shared(false),
native_inline(false),
flexbuffer(false),
presence(kDefault),
@@ -302,8 +302,8 @@ struct FieldDef : public Definition {
Offset<reflection::Field> Serialize(FlatBufferBuilder *builder, uint16_t id,
const Parser &parser) const;
- bool Deserialize(Parser &parser, const reflection::Field *field);
-
+ bool Deserialize(Parser &parser, const reflection::Field *field);
+
bool IsScalarOptional() const {
return IsScalar(value.type.base_type) && IsOptional();
}
@@ -321,8 +321,8 @@ struct FieldDef : public Definition {
bool deprecated; // Field is allowed to be present in old data, but can't be.
// written in new data nor accessed in new code.
bool key; // Field functions as a key for creating sorted vectors.
- bool shared; // Field will be using string pooling (i.e. CreateSharedString)
- // as default serialization behavior if field is a string.
+ bool shared; // Field will be using string pooling (i.e. CreateSharedString)
+ // as default serialization behavior if field is a string.
bool native_inline; // Field will be defined inline (instead of as a pointer)
// for native tables if field is a struct.
bool flexbuffer; // This field contains FlexBuffer data.
@@ -368,8 +368,8 @@ struct StructDef : public Definition {
Offset<reflection::Object> Serialize(FlatBufferBuilder *builder,
const Parser &parser) const;
- bool Deserialize(Parser &parser, const reflection::Object *object);
-
+ bool Deserialize(Parser &parser, const reflection::Object *object);
+
SymbolTable<FieldDef> fields;
bool fixed; // If it's struct, not a table.
@@ -382,140 +382,140 @@ struct StructDef : public Definition {
flatbuffers::unique_ptr<std::string> original_location;
};
-struct EnumDef;
-struct EnumValBuilder;
+struct EnumDef;
+struct EnumValBuilder;
-struct EnumVal {
- Offset<reflection::EnumVal> Serialize(FlatBufferBuilder *builder,
- const Parser &parser) const;
+struct EnumVal {
+ Offset<reflection::EnumVal> Serialize(FlatBufferBuilder *builder,
+ const Parser &parser) const;
- bool Deserialize(const Parser &parser, const reflection::EnumVal *val);
+ bool Deserialize(const Parser &parser, const reflection::EnumVal *val);
- uint64_t GetAsUInt64() const { return static_cast<uint64_t>(value); }
- int64_t GetAsInt64() const { return value; }
- bool IsZero() const { return 0 == value; }
- bool IsNonZero() const { return !IsZero(); }
+ uint64_t GetAsUInt64() const { return static_cast<uint64_t>(value); }
+ int64_t GetAsInt64() const { return value; }
+ bool IsZero() const { return 0 == value; }
+ bool IsNonZero() const { return !IsZero(); }
std::string name;
std::vector<std::string> doc_comment;
- Type union_type;
-
- private:
- friend EnumDef;
- friend EnumValBuilder;
- friend bool operator==(const EnumVal &lhs, const EnumVal &rhs);
-
- EnumVal(const std::string &_name, int64_t _val) : name(_name), value(_val) {}
- EnumVal() : value(0) {}
-
+ Type union_type;
+
+ private:
+ friend EnumDef;
+ friend EnumValBuilder;
+ friend bool operator==(const EnumVal &lhs, const EnumVal &rhs);
+
+ EnumVal(const std::string &_name, int64_t _val) : name(_name), value(_val) {}
+ EnumVal() : value(0) {}
+
int64_t value;
};
struct EnumDef : public Definition {
- EnumDef() : is_union(false), uses_multiple_type_instances(false) {}
-
- Offset<reflection::Enum> Serialize(FlatBufferBuilder *builder,
- const Parser &parser) const;
-
- bool Deserialize(Parser &parser, const reflection::Enum *values);
-
- template<typename T> void ChangeEnumValue(EnumVal *ev, T new_val);
- void SortByValue();
- void RemoveDuplicates();
-
- std::string AllFlags() const;
- const EnumVal *MinValue() const;
- const EnumVal *MaxValue() const;
- // Returns the number of integer steps from v1 to v2.
- uint64_t Distance(const EnumVal *v1, const EnumVal *v2) const;
- // Returns the number of integer steps from Min to Max.
- uint64_t Distance() const { return Distance(MinValue(), MaxValue()); }
-
- EnumVal *ReverseLookup(int64_t enum_idx,
- bool skip_union_default = false) const;
- EnumVal *FindByValue(const std::string &constant) const;
-
- std::string ToString(const EnumVal &ev) const {
- return IsUInt64() ? NumToString(ev.GetAsUInt64())
- : NumToString(ev.GetAsInt64());
+ EnumDef() : is_union(false), uses_multiple_type_instances(false) {}
+
+ Offset<reflection::Enum> Serialize(FlatBufferBuilder *builder,
+ const Parser &parser) const;
+
+ bool Deserialize(Parser &parser, const reflection::Enum *values);
+
+ template<typename T> void ChangeEnumValue(EnumVal *ev, T new_val);
+ void SortByValue();
+ void RemoveDuplicates();
+
+ std::string AllFlags() const;
+ const EnumVal *MinValue() const;
+ const EnumVal *MaxValue() const;
+ // Returns the number of integer steps from v1 to v2.
+ uint64_t Distance(const EnumVal *v1, const EnumVal *v2) const;
+ // Returns the number of integer steps from Min to Max.
+ uint64_t Distance() const { return Distance(MinValue(), MaxValue()); }
+
+ EnumVal *ReverseLookup(int64_t enum_idx,
+ bool skip_union_default = false) const;
+ EnumVal *FindByValue(const std::string &constant) const;
+
+ std::string ToString(const EnumVal &ev) const {
+ return IsUInt64() ? NumToString(ev.GetAsUInt64())
+ : NumToString(ev.GetAsInt64());
}
- size_t size() const { return vals.vec.size(); }
+ size_t size() const { return vals.vec.size(); }
const std::vector<EnumVal *> &Vals() const { return vals.vec; }
-
- const EnumVal *Lookup(const std::string &enum_name) const {
- return vals.Lookup(enum_name);
- }
-
+
+ const EnumVal *Lookup(const std::string &enum_name) const {
+ return vals.Lookup(enum_name);
+ }
+
bool is_union;
- // Type is a union which uses type aliases where at least one type is
- // available under two different names.
- bool uses_multiple_type_instances;
+ // Type is a union which uses type aliases where at least one type is
+ // available under two different names.
+ bool uses_multiple_type_instances;
Type underlying_type;
-
- private:
- bool IsUInt64() const {
- return (BASE_TYPE_ULONG == underlying_type.base_type);
- }
-
- friend EnumValBuilder;
- SymbolTable<EnumVal> vals;
+
+ private:
+ bool IsUInt64() const {
+ return (BASE_TYPE_ULONG == underlying_type.base_type);
+ }
+
+ friend EnumValBuilder;
+ SymbolTable<EnumVal> vals;
};
inline bool IsString(const Type &type) {
return type.base_type == BASE_TYPE_STRING;
}
-inline bool IsStruct(const Type &type) {
- return type.base_type == BASE_TYPE_STRUCT && type.struct_def->fixed;
-}
-
-inline bool IsUnion(const Type &type) {
- return type.enum_def != nullptr && type.enum_def->is_union;
-}
-
-inline bool IsVector(const Type &type) {
- return type.base_type == BASE_TYPE_VECTOR;
-}
-
-inline bool IsArray(const Type &type) {
- return type.base_type == BASE_TYPE_ARRAY;
-}
-
-inline bool IsSeries(const Type &type) {
- return IsVector(type) || IsArray(type);
-}
-
-inline bool IsEnum(const Type &type) {
- return type.enum_def != nullptr && IsInteger(type.base_type);
-}
-
-inline size_t InlineSize(const Type &type) {
- return IsStruct(type)
- ? type.struct_def->bytesize
- : (IsArray(type)
- ? InlineSize(type.VectorType()) * type.fixed_length
- : SizeOf(type.base_type));
-}
-
-inline size_t InlineAlignment(const Type &type) {
- if (IsStruct(type)) {
- return type.struct_def->minalign;
- } else if (IsArray(type)) {
- return IsStruct(type.VectorType()) ? type.struct_def->minalign
- : SizeOf(type.element);
- } else {
- return SizeOf(type.base_type);
- }
-}
-inline bool operator==(const EnumVal &lhs, const EnumVal &rhs) {
- return lhs.value == rhs.value;
-}
-inline bool operator!=(const EnumVal &lhs, const EnumVal &rhs) {
- return !(lhs == rhs);
-}
-
+inline bool IsStruct(const Type &type) {
+ return type.base_type == BASE_TYPE_STRUCT && type.struct_def->fixed;
+}
+
+inline bool IsUnion(const Type &type) {
+ return type.enum_def != nullptr && type.enum_def->is_union;
+}
+
+inline bool IsVector(const Type &type) {
+ return type.base_type == BASE_TYPE_VECTOR;
+}
+
+inline bool IsArray(const Type &type) {
+ return type.base_type == BASE_TYPE_ARRAY;
+}
+
+inline bool IsSeries(const Type &type) {
+ return IsVector(type) || IsArray(type);
+}
+
+inline bool IsEnum(const Type &type) {
+ return type.enum_def != nullptr && IsInteger(type.base_type);
+}
+
+inline size_t InlineSize(const Type &type) {
+ return IsStruct(type)
+ ? type.struct_def->bytesize
+ : (IsArray(type)
+ ? InlineSize(type.VectorType()) * type.fixed_length
+ : SizeOf(type.base_type));
+}
+
+inline size_t InlineAlignment(const Type &type) {
+ if (IsStruct(type)) {
+ return type.struct_def->minalign;
+ } else if (IsArray(type)) {
+ return IsStruct(type.VectorType()) ? type.struct_def->minalign
+ : SizeOf(type.element);
+ } else {
+ return SizeOf(type.base_type);
+ }
+}
+inline bool operator==(const EnumVal &lhs, const EnumVal &rhs) {
+ return lhs.value == rhs.value;
+}
+inline bool operator!=(const EnumVal &lhs, const EnumVal &rhs) {
+ return !(lhs == rhs);
+}
+
inline bool EqualByName(const Type &a, const Type &b) {
return a.base_type == b.base_type && a.element == b.element &&
(a.struct_def == b.struct_def ||
@@ -524,18 +524,18 @@ inline bool EqualByName(const Type &a, const Type &b) {
}
struct RPCCall : public Definition {
- Offset<reflection::RPCCall> Serialize(FlatBufferBuilder *builder,
- const Parser &parser) const;
-
- bool Deserialize(Parser &parser, const reflection::RPCCall *call);
+ Offset<reflection::RPCCall> Serialize(FlatBufferBuilder *builder,
+ const Parser &parser) const;
+ bool Deserialize(Parser &parser, const reflection::RPCCall *call);
+
StructDef *request, *response;
};
struct ServiceDef : public Definition {
- Offset<reflection::Service> Serialize(FlatBufferBuilder *builder,
- const Parser &parser) const;
- bool Deserialize(Parser &parser, const reflection::Service *service);
+ Offset<reflection::Service> Serialize(FlatBufferBuilder *builder,
+ const Parser &parser) const;
+ bool Deserialize(Parser &parser, const reflection::Service *service);
SymbolTable<RPCCall> calls;
};
@@ -543,8 +543,8 @@ struct ServiceDef : public Definition {
// Container of options that may apply to any of the source/text generators.
struct IDLOptions {
bool gen_jvmstatic;
- // Use flexbuffers instead for binary and text generation
- bool use_flexbuffers;
+ // Use flexbuffers instead for binary and text generation
+ bool use_flexbuffers;
bool strict_json;
bool output_default_scalars_in_json;
int indent_step;
@@ -563,11 +563,11 @@ struct IDLOptions {
bool gen_compare;
std::string cpp_object_api_pointer_type;
std::string cpp_object_api_string_type;
- bool cpp_object_api_string_flexible_constructor;
+ bool cpp_object_api_string_flexible_constructor;
bool cpp_direct_copy;
bool gen_nullable;
- bool java_checkerframework;
- bool gen_generated;
+ bool java_checkerframework;
+ bool gen_generated;
std::string object_prefix;
std::string object_suffix;
bool union_value_namespacing;
@@ -577,21 +577,21 @@ struct IDLOptions {
bool keep_include_path;
bool binary_schema_comments;
bool binary_schema_builtins;
- bool binary_schema_gen_embed;
+ bool binary_schema_gen_embed;
std::string go_import;
std::string go_namespace;
bool protobuf_ascii_alike;
bool size_prefixed;
std::string root_type;
bool force_defaults;
- bool java_primitive_has_method;
- bool cs_gen_json_serializer;
- std::vector<std::string> cpp_includes;
- std::string cpp_std;
+ bool java_primitive_has_method;
+ bool cs_gen_json_serializer;
+ std::vector<std::string> cpp_includes;
+ std::string cpp_std;
bool cpp_static_reflection;
- std::string proto_namespace_suffix;
- std::string filename_suffix;
- std::string filename_extension;
+ std::string proto_namespace_suffix;
+ std::string filename_suffix;
+ std::string filename_extension;
bool no_warnings;
// Possible options for the more general generator below.
@@ -610,9 +610,9 @@ struct IDLOptions {
kLua = 1 << 12,
kLobster = 1 << 13,
kRust = 1 << 14,
- kKotlin = 1 << 15,
- kSwift = 1 << 16,
- kCppYandexMapsIter = 1 << 17,
+ kKotlin = 1 << 15,
+ kSwift = 1 << 16,
+ kCppYandexMapsIter = 1 << 17,
kMAX
};
@@ -629,18 +629,18 @@ struct IDLOptions {
// for code generation.
unsigned long lang_to_generate;
- // If set (default behavior), empty string fields will be set to nullptr to
- // make the flatbuffer more compact.
- bool set_empty_strings_to_null;
-
- // If set (default behavior), empty vector fields will be set to nullptr to
- // make the flatbuffer more compact.
- bool set_empty_vectors_to_null;
+ // If set (default behavior), empty string fields will be set to nullptr to
+ // make the flatbuffer more compact.
+ bool set_empty_strings_to_null;
+ // If set (default behavior), empty vector fields will be set to nullptr to
+ // make the flatbuffer more compact.
+ bool set_empty_vectors_to_null;
+
IDLOptions()
: gen_jvmstatic(false),
use_flexbuffers(false),
- strict_json(false),
+ strict_json(false),
output_default_scalars_in_json(false),
indent_step(2),
output_enum_identifiers(true),
@@ -657,11 +657,11 @@ struct IDLOptions {
generate_object_based_api(false),
gen_compare(false),
cpp_object_api_pointer_type("std::unique_ptr"),
- cpp_object_api_string_flexible_constructor(false),
+ cpp_object_api_string_flexible_constructor(false),
cpp_direct_copy(true),
gen_nullable(false),
- java_checkerframework(false),
- gen_generated(false),
+ java_checkerframework(false),
+ gen_generated(false),
object_suffix("T"),
union_value_namespacing(true),
allow_non_utf8(false),
@@ -669,32 +669,32 @@ struct IDLOptions {
keep_include_path(false),
binary_schema_comments(false),
binary_schema_builtins(false),
- binary_schema_gen_embed(false),
+ binary_schema_gen_embed(false),
protobuf_ascii_alike(false),
size_prefixed(false),
force_defaults(false),
- java_primitive_has_method(false),
- cs_gen_json_serializer(false),
+ java_primitive_has_method(false),
+ cs_gen_json_serializer(false),
cpp_static_reflection(false),
filename_suffix("_generated"),
- filename_extension(),
+ filename_extension(),
no_warnings(false),
lang(IDLOptions::kJava),
mini_reflect(IDLOptions::kNone),
require_explicit_ids(false),
lang_to_generate(0),
- set_empty_strings_to_null(true),
- set_empty_vectors_to_null(true) {}
+ set_empty_strings_to_null(true),
+ set_empty_vectors_to_null(true) {}
};
// This encapsulates where the parser is in the current source file.
struct ParserState {
ParserState()
- : cursor_(nullptr),
- line_start_(nullptr),
- line_(0),
- token_(-1),
- attr_is_trivial_ascii_string_(true) {}
+ : cursor_(nullptr),
+ line_start_(nullptr),
+ line_(0),
+ token_(-1),
+ attr_is_trivial_ascii_string_(true) {}
protected:
void ResetState(const char *source) {
@@ -718,10 +718,10 @@ struct ParserState {
int line_; // the current line being parsed
int token_;
- // Flag: text in attribute_ is true ASCII string without escape
- // sequences. Only printable ASCII (without [\t\r\n]).
- // Used for number-in-string (and base64 string in future).
- bool attr_is_trivial_ascii_string_;
+ // Flag: text in attribute_ is true ASCII string without escape
+ // sequences. Only printable ASCII (without [\t\r\n]).
+ // Used for number-in-string (and base64 string in future).
+ bool attr_is_trivial_ascii_string_;
std::string attribute_;
std::vector<std::string> doc_comment_;
};
@@ -777,7 +777,7 @@ class Parser : public ParserState {
explicit Parser(const IDLOptions &options = IDLOptions())
: current_namespace_(nullptr),
empty_namespace_(nullptr),
- flex_builder_(256, flexbuffers::BUILDER_FLAG_SHARE_ALL),
+ flex_builder_(256, flexbuffers::BUILDER_FLAG_SHARE_ALL),
root_struct_def_(nullptr),
opts(options),
uses_flexbuffers_(false),
@@ -785,7 +785,7 @@ class Parser : public ParserState {
source_(nullptr),
anonymous_counter_(0),
parse_depth_counter_(0) {
- if (opts.force_defaults) { builder_.ForceDefaults(true); }
+ if (opts.force_defaults) { builder_.ForceDefaults(true); }
// Start out with the empty namespace being current.
empty_namespace_ = new Namespace();
namespaces_.push_back(empty_namespace_);
@@ -793,7 +793,7 @@ class Parser : public ParserState {
known_attributes_["deprecated"] = true;
known_attributes_["required"] = true;
known_attributes_["key"] = true;
- known_attributes_["shared"] = true;
+ known_attributes_["shared"] = true;
known_attributes_["hash"] = true;
known_attributes_["id"] = true;
known_attributes_["force_align"] = true;
@@ -807,7 +807,7 @@ class Parser : public ParserState {
known_attributes_["cpp_ptr_type"] = true;
known_attributes_["cpp_ptr_type_get"] = true;
known_attributes_["cpp_str_type"] = true;
- known_attributes_["cpp_str_flex_ctor"] = true;
+ known_attributes_["cpp_str_flex_ctor"] = true;
known_attributes_["native_inline"] = true;
known_attributes_["native_custom_alloc"] = true;
known_attributes_["native_type"] = true;
@@ -854,15 +854,15 @@ class Parser : public ParserState {
// See reflection/reflection.fbs
void Serialize();
- // Deserialize a schema buffer
- bool Deserialize(const uint8_t *buf, const size_t size);
-
- // Fills internal structure as if the schema passed had been loaded by parsing
- // with Parse except that included filenames will not be populated.
- bool Deserialize(const reflection::Schema *schema);
-
- Type *DeserializeType(const reflection::Type *type);
-
+ // Deserialize a schema buffer
+ bool Deserialize(const uint8_t *buf, const size_t size);
+
+ // Fills internal structure as if the schema passed had been loaded by parsing
+ // with Parse except that included filenames will not be populated.
+ bool Deserialize(const reflection::Schema *schema);
+
+ Type *DeserializeType(const reflection::Type *type);
+
// Checks that the schema represented by this parser is a safe evolution
// of the schema provided. Returns non-empty error on any problems.
std::string ConformTo(const Parser &base);
@@ -875,10 +875,10 @@ class Parser : public ParserState {
StructDef *LookupStruct(const std::string &id) const;
StructDef *LookupStructThruParentNamespaces(const std::string &id) const;
- std::string UnqualifiedName(const std::string &fullQualifiedName);
-
- FLATBUFFERS_CHECKED_ERROR Error(const std::string &msg);
-
+ std::string UnqualifiedName(const std::string &fullQualifiedName);
+
+ FLATBUFFERS_CHECKED_ERROR Error(const std::string &msg);
+
// @brief Verify that any of 'opts.lang_to_generate' supports Optional scalars
// in a schema.
// @param opts Options used to parce a schema and generate code.
@@ -909,37 +909,37 @@ class Parser : public ParserState {
FLATBUFFERS_CHECKED_ERROR ParseComma();
FLATBUFFERS_CHECKED_ERROR ParseAnyValue(Value &val, FieldDef *field,
size_t parent_fieldn,
- const StructDef *parent_struct_def,
- uoffset_t count,
- bool inside_vector = false);
- template<typename F>
+ const StructDef *parent_struct_def,
+ uoffset_t count,
+ bool inside_vector = false);
+ template<typename F>
FLATBUFFERS_CHECKED_ERROR ParseTableDelimiters(size_t &fieldn,
const StructDef *struct_def,
- F body);
+ F body);
FLATBUFFERS_CHECKED_ERROR ParseTable(const StructDef &struct_def,
std::string *value, uoffset_t *ovalue);
void SerializeStruct(const StructDef &struct_def, const Value &val);
- void SerializeStruct(FlatBufferBuilder &builder, const StructDef &struct_def,
- const Value &val);
- template<typename F>
- FLATBUFFERS_CHECKED_ERROR ParseVectorDelimiters(uoffset_t &count, F body);
- FLATBUFFERS_CHECKED_ERROR ParseVector(const Type &type, uoffset_t *ovalue,
- FieldDef *field, size_t fieldn);
- FLATBUFFERS_CHECKED_ERROR ParseArray(Value &array);
- FLATBUFFERS_CHECKED_ERROR ParseNestedFlatbuffer(
- Value &val, FieldDef *field, size_t fieldn,
- const StructDef *parent_struct_def);
+ void SerializeStruct(FlatBufferBuilder &builder, const StructDef &struct_def,
+ const Value &val);
+ template<typename F>
+ FLATBUFFERS_CHECKED_ERROR ParseVectorDelimiters(uoffset_t &count, F body);
+ FLATBUFFERS_CHECKED_ERROR ParseVector(const Type &type, uoffset_t *ovalue,
+ FieldDef *field, size_t fieldn);
+ FLATBUFFERS_CHECKED_ERROR ParseArray(Value &array);
+ FLATBUFFERS_CHECKED_ERROR ParseNestedFlatbuffer(
+ Value &val, FieldDef *field, size_t fieldn,
+ const StructDef *parent_struct_def);
FLATBUFFERS_CHECKED_ERROR ParseMetaData(SymbolTable<Value> *attributes);
- FLATBUFFERS_CHECKED_ERROR TryTypedValue(const std::string *name, int dtoken,
- bool check, Value &e, BaseType req,
- bool *destmatch);
- FLATBUFFERS_CHECKED_ERROR ParseHash(Value &e, FieldDef *field);
+ FLATBUFFERS_CHECKED_ERROR TryTypedValue(const std::string *name, int dtoken,
+ bool check, Value &e, BaseType req,
+ bool *destmatch);
+ FLATBUFFERS_CHECKED_ERROR ParseHash(Value &e, FieldDef *field);
FLATBUFFERS_CHECKED_ERROR TokenError();
- FLATBUFFERS_CHECKED_ERROR ParseSingleValue(const std::string *name, Value &e,
- bool check_now);
+ FLATBUFFERS_CHECKED_ERROR ParseSingleValue(const std::string *name, Value &e,
+ bool check_now);
FLATBUFFERS_CHECKED_ERROR ParseFunction(const std::string *name, Value &e);
- FLATBUFFERS_CHECKED_ERROR ParseEnumFromString(const Type &type,
- std::string *result);
+ FLATBUFFERS_CHECKED_ERROR ParseEnumFromString(const Type &type,
+ std::string *result);
StructDef *LookupCreateStruct(const std::string &name,
bool create_if_new = true,
bool definition = false);
@@ -947,7 +947,7 @@ class Parser : public ParserState {
FLATBUFFERS_CHECKED_ERROR ParseNamespace();
FLATBUFFERS_CHECKED_ERROR StartStruct(const std::string &name,
StructDef **dest);
- FLATBUFFERS_CHECKED_ERROR StartEnum(const std::string &name, bool is_union,
+ FLATBUFFERS_CHECKED_ERROR StartEnum(const std::string &name, bool is_union,
EnumDef **dest);
FLATBUFFERS_CHECKED_ERROR ParseDecl();
FLATBUFFERS_CHECKED_ERROR ParseService();
@@ -965,27 +965,27 @@ class Parser : public ParserState {
FLATBUFFERS_CHECKED_ERROR StartParseFile(const char *source,
const char *source_filename);
FLATBUFFERS_CHECKED_ERROR ParseRoot(const char *_source,
- const char **include_paths,
- const char *source_filename);
- FLATBUFFERS_CHECKED_ERROR DoParse(const char *_source,
+ const char **include_paths,
+ const char *source_filename);
+ FLATBUFFERS_CHECKED_ERROR DoParse(const char *_source,
const char **include_paths,
- const char *source_filename,
- const char *include_filename);
+ const char *source_filename,
+ const char *include_filename);
FLATBUFFERS_CHECKED_ERROR DoParseJson();
- FLATBUFFERS_CHECKED_ERROR CheckClash(std::vector<FieldDef *> &fields,
+ FLATBUFFERS_CHECKED_ERROR CheckClash(std::vector<FieldDef *> &fields,
StructDef *struct_def,
- const char *suffix, BaseType baseType);
+ const char *suffix, BaseType baseType);
FLATBUFFERS_CHECKED_ERROR ParseAlignAttribute(
const std::string &align_constant, size_t min_align, size_t *align);
- bool SupportsAdvancedUnionFeatures() const;
- bool SupportsAdvancedArrayFeatures() const;
+ bool SupportsAdvancedUnionFeatures() const;
+ bool SupportsAdvancedArrayFeatures() const;
bool SupportsOptionalScalars() const;
bool SupportsDefaultVectorsAndStrings() const;
Namespace *UniqueNamespace(Namespace *ns);
FLATBUFFERS_CHECKED_ERROR RecurseError();
- template<typename F> CheckedError Recurse(F f);
+ template<typename F> CheckedError Recurse(F f);
public:
SymbolTable<Type> types_;
@@ -995,11 +995,11 @@ class Parser : public ParserState {
std::vector<Namespace *> namespaces_;
Namespace *current_namespace_;
Namespace *empty_namespace_;
- std::string error_; // User readable error_ if Parse() == false
+ std::string error_; // User readable error_ if Parse() == false
FlatBufferBuilder builder_; // any data contained in the file
- flexbuffers::Builder flex_builder_;
- flexbuffers::Reference flex_root_;
+ flexbuffers::Builder flex_builder_;
+ flexbuffers::Reference flex_root_;
StructDef *root_struct_def_;
std::string file_identifier_;
std::string file_extension_;
@@ -1030,8 +1030,8 @@ class Parser : public ParserState {
extern std::string MakeCamel(const std::string &in, bool first = true);
-extern std::string MakeScreamingCamel(const std::string &in);
-
+extern std::string MakeScreamingCamel(const std::string &in);
+
// Generate text (JSON) from a given FlatBuffer, and a given Parser
// object that has been populated with the corresponding schema.
// If ident_step is 0, no indentation will be generated. Additionally,
@@ -1040,12 +1040,12 @@ extern std::string MakeScreamingCamel(const std::string &in);
// strict_json adds "quotes" around field names if true.
// If the flatbuffer cannot be encoded in JSON (e.g., it contains non-UTF-8
// byte arrays in String values), returns false.
-extern bool GenerateTextFromTable(const Parser &parser, const void *table,
- const std::string &tablename,
- std::string *text);
-extern bool GenerateText(const Parser &parser, const void *flatbuffer,
+extern bool GenerateTextFromTable(const Parser &parser, const void *table,
+ const std::string &tablename,
+ std::string *text);
+extern bool GenerateText(const Parser &parser, const void *flatbuffer,
std::string *text);
-extern bool GenerateTextFile(const Parser &parser, const std::string &path,
+extern bool GenerateTextFile(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate Json schema to string
@@ -1054,81 +1054,81 @@ extern bool GenerateJsonSchema(const Parser &parser, std::string *json);
// Generate binary files from a given FlatBuffer, and a given Parser
// object that has been populated with the corresponding schema.
-// See code_generators.cpp.
-extern bool GenerateBinary(const Parser &parser, const std::string &path,
+// See code_generators.cpp.
+extern bool GenerateBinary(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate a C++ header from the definitions in the Parser object.
// See idl_gen_cpp.
-extern bool GenerateCPP(const Parser &parser, const std::string &path,
+extern bool GenerateCPP(const Parser &parser, const std::string &path,
const std::string &file_name);
-// Generate C# files from the definitions in the Parser object.
-// See idl_gen_csharp.cpp.
-extern bool GenerateCSharp(const Parser &parser, const std::string &path,
- const std::string &file_name);
-
-extern bool GenerateDart(const Parser &parser, const std::string &path,
+// Generate C# files from the definitions in the Parser object.
+// See idl_gen_csharp.cpp.
+extern bool GenerateCSharp(const Parser &parser, const std::string &path,
+ const std::string &file_name);
+
+extern bool GenerateDart(const Parser &parser, const std::string &path,
const std::string &file_name);
-// Generate Java files from the definitions in the Parser object.
-// See idl_gen_java.cpp.
-extern bool GenerateJava(const Parser &parser, const std::string &path,
- const std::string &file_name);
+// Generate Java files from the definitions in the Parser object.
+// See idl_gen_java.cpp.
+extern bool GenerateJava(const Parser &parser, const std::string &path,
+ const std::string &file_name);
-// Generate JavaScript or TypeScript code from the definitions in the Parser
-// object. See idl_gen_js.
+// Generate JavaScript or TypeScript code from the definitions in the Parser
+// object. See idl_gen_js.
extern bool GenerateTS(const Parser &parser, const std::string &path,
const std::string &file_name);
-
+
// Generate Go files from the definitions in the Parser object.
// See idl_gen_go.cpp.
-extern bool GenerateGo(const Parser &parser, const std::string &path,
+extern bool GenerateGo(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate Php code from the definitions in the Parser object.
// See idl_gen_php.
-extern bool GeneratePhp(const Parser &parser, const std::string &path,
+extern bool GeneratePhp(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate Python files from the definitions in the Parser object.
// See idl_gen_python.cpp.
-extern bool GeneratePython(const Parser &parser, const std::string &path,
+extern bool GeneratePython(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate Lobster files from the definitions in the Parser object.
// See idl_gen_lobster.cpp.
-extern bool GenerateLobster(const Parser &parser, const std::string &path,
+extern bool GenerateLobster(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate Lua files from the definitions in the Parser object.
// See idl_gen_lua.cpp.
-extern bool GenerateLua(const Parser &parser, const std::string &path,
- const std::string &file_name);
+extern bool GenerateLua(const Parser &parser, const std::string &path,
+ const std::string &file_name);
// Generate Rust files from the definitions in the Parser object.
// See idl_gen_rust.cpp.
-extern bool GenerateRust(const Parser &parser, const std::string &path,
+extern bool GenerateRust(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate Json schema file
// See idl_gen_json_schema.cpp.
-extern bool GenerateJsonSchema(const Parser &parser, const std::string &path,
- const std::string &file_name);
-
-extern bool GenerateKotlin(const Parser &parser, const std::string &path,
+extern bool GenerateJsonSchema(const Parser &parser, const std::string &path,
+ const std::string &file_name);
+
+extern bool GenerateKotlin(const Parser &parser, const std::string &path,
const std::string &file_name);
-// Generate Swift classes.
-// See idl_gen_swift.cpp
-extern bool GenerateSwift(const Parser &parser, const std::string &path,
- const std::string &file_name);
+// Generate Swift classes.
+// See idl_gen_swift.cpp
+extern bool GenerateSwift(const Parser &parser, const std::string &path,
+ const std::string &file_name);
// Generate a schema file from the internal representation, useful after
// parsing a .proto schema.
extern std::string GenerateFBS(const Parser &parser,
const std::string &file_name);
-extern bool GenerateFBS(const Parser &parser, const std::string &path,
+extern bool GenerateFBS(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate a C++ header for reading with templated file iterator from
@@ -1147,60 +1147,60 @@ extern std::string TSMakeRule(const Parser &parser, const std::string &path,
// Generate a make rule for the generated C++ header.
// See idl_gen_cpp.cpp.
-extern std::string CPPMakeRule(const Parser &parser, const std::string &path,
+extern std::string CPPMakeRule(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate a make rule for the generated Dart code
// see idl_gen_dart.cpp
-extern std::string DartMakeRule(const Parser &parser, const std::string &path,
+extern std::string DartMakeRule(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate a make rule for the generated Rust code.
// See idl_gen_rust.cpp.
-extern std::string RustMakeRule(const Parser &parser, const std::string &path,
+extern std::string RustMakeRule(const Parser &parser, const std::string &path,
const std::string &file_name);
-// Generate a make rule for generated Java or C# files.
-// See code_generators.cpp.
-extern std::string JavaCSharpMakeRule(const Parser &parser,
- const std::string &path,
- const std::string &file_name);
+// Generate a make rule for generated Java or C# files.
+// See code_generators.cpp.
+extern std::string JavaCSharpMakeRule(const Parser &parser,
+ const std::string &path,
+ const std::string &file_name);
// Generate a make rule for the generated text (JSON) files.
// See idl_gen_text.cpp.
-extern std::string TextMakeRule(const Parser &parser, const std::string &path,
+extern std::string TextMakeRule(const Parser &parser, const std::string &path,
const std::string &file_names);
// Generate a make rule for the generated binary files.
-// See code_generators.cpp.
-extern std::string BinaryMakeRule(const Parser &parser, const std::string &path,
+// See code_generators.cpp.
+extern std::string BinaryMakeRule(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate GRPC Cpp interfaces.
// See idl_gen_grpc.cpp.
-bool GenerateCppGRPC(const Parser &parser, const std::string &path,
+bool GenerateCppGRPC(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate GRPC Go interfaces.
// See idl_gen_grpc.cpp.
-bool GenerateGoGRPC(const Parser &parser, const std::string &path,
+bool GenerateGoGRPC(const Parser &parser, const std::string &path,
const std::string &file_name);
// Generate GRPC Java classes.
// See idl_gen_grpc.cpp
-bool GenerateJavaGRPC(const Parser &parser, const std::string &path,
+bool GenerateJavaGRPC(const Parser &parser, const std::string &path,
const std::string &file_name);
-// Generate GRPC Python interfaces.
-// See idl_gen_grpc.cpp.
-bool GeneratePythonGRPC(const Parser &parser, const std::string &path,
- const std::string &file_name);
-
-// Generate GRPC Swift interfaces.
-// See idl_gen_grpc.cpp.
-extern bool GenerateSwiftGRPC(const Parser &parser, const std::string &path,
- const std::string &file_name);
-
+// Generate GRPC Python interfaces.
+// See idl_gen_grpc.cpp.
+bool GeneratePythonGRPC(const Parser &parser, const std::string &path,
+ const std::string &file_name);
+
+// Generate GRPC Swift interfaces.
+// See idl_gen_grpc.cpp.
+extern bool GenerateSwiftGRPC(const Parser &parser, const std::string &path,
+ const std::string &file_name);
+
extern bool GenerateTSGRPC(const Parser &parser, const std::string &path,
const std::string &file_name);
} // namespace flatbuffers
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/minireflect.h b/contrib/libs/flatbuffers/include/flatbuffers/minireflect.h
index d95dd24b7e..380200889c 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/minireflect.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/minireflect.h
@@ -17,8 +17,8 @@
#ifndef FLATBUFFERS_MINIREFLECT_H_
#define FLATBUFFERS_MINIREFLECT_H_
-#include "flatbuffers.h"
-#include "util.h"
+#include "flatbuffers.h"
+#include "util.h"
namespace flatbuffers {
@@ -88,28 +88,28 @@ inline size_t InlineSize(ElementaryType type, const TypeTable *type_table) {
switch (type_table->st) {
case ST_TABLE:
case ST_UNION: return 4;
- case ST_STRUCT:
- return static_cast<size_t>(type_table->values[type_table->num_elems]);
+ case ST_STRUCT:
+ return static_cast<size_t>(type_table->values[type_table->num_elems]);
default: FLATBUFFERS_ASSERT(false); return 1;
}
default: FLATBUFFERS_ASSERT(false); return 1;
}
}
-inline int64_t LookupEnum(int64_t enum_val, const int64_t *values,
+inline int64_t LookupEnum(int64_t enum_val, const int64_t *values,
size_t num_values) {
if (!values) return enum_val;
for (size_t i = 0; i < num_values; i++) {
- if (enum_val == values[i]) return static_cast<int64_t>(i);
+ if (enum_val == values[i]) return static_cast<int64_t>(i);
}
return -1; // Unknown enum value.
}
template<typename T> const char *EnumName(T tval, const TypeTable *type_table) {
if (!type_table || !type_table->names) return nullptr;
- auto i = LookupEnum(static_cast<int64_t>(tval), type_table->values,
+ auto i = LookupEnum(static_cast<int64_t>(tval), type_table->values,
type_table->num_elems);
- if (i >= 0 && i < static_cast<int64_t>(type_table->num_elems)) {
+ if (i >= 0 && i < static_cast<int64_t>(type_table->num_elems)) {
return type_table->names[i];
}
return nullptr;
@@ -123,58 +123,58 @@ inline void IterateValue(ElementaryType type, const uint8_t *val,
soffset_t vector_index, IterationVisitor *visitor) {
switch (type) {
case ET_UTYPE: {
- auto tval = ReadScalar<uint8_t>(val);
+ auto tval = ReadScalar<uint8_t>(val);
visitor->UType(tval, EnumName(tval, type_table));
break;
}
case ET_BOOL: {
- visitor->Bool(ReadScalar<uint8_t>(val) != 0);
+ visitor->Bool(ReadScalar<uint8_t>(val) != 0);
break;
}
case ET_CHAR: {
- auto tval = ReadScalar<int8_t>(val);
+ auto tval = ReadScalar<int8_t>(val);
visitor->Char(tval, EnumName(tval, type_table));
break;
}
case ET_UCHAR: {
- auto tval = ReadScalar<uint8_t>(val);
+ auto tval = ReadScalar<uint8_t>(val);
visitor->UChar(tval, EnumName(tval, type_table));
break;
}
case ET_SHORT: {
- auto tval = ReadScalar<int16_t>(val);
+ auto tval = ReadScalar<int16_t>(val);
visitor->Short(tval, EnumName(tval, type_table));
break;
}
case ET_USHORT: {
- auto tval = ReadScalar<uint16_t>(val);
+ auto tval = ReadScalar<uint16_t>(val);
visitor->UShort(tval, EnumName(tval, type_table));
break;
}
case ET_INT: {
- auto tval = ReadScalar<int32_t>(val);
+ auto tval = ReadScalar<int32_t>(val);
visitor->Int(tval, EnumName(tval, type_table));
break;
}
case ET_UINT: {
- auto tval = ReadScalar<uint32_t>(val);
+ auto tval = ReadScalar<uint32_t>(val);
visitor->UInt(tval, EnumName(tval, type_table));
break;
}
case ET_LONG: {
- visitor->Long(ReadScalar<int64_t>(val));
+ visitor->Long(ReadScalar<int64_t>(val));
break;
}
case ET_ULONG: {
- visitor->ULong(ReadScalar<uint64_t>(val));
+ visitor->ULong(ReadScalar<uint64_t>(val));
break;
}
case ET_FLOAT: {
- visitor->Float(ReadScalar<float>(val));
+ visitor->Float(ReadScalar<float>(val));
break;
}
case ET_DOUBLE: {
- visitor->Double(ReadScalar<double>(val));
+ visitor->Double(ReadScalar<double>(val));
break;
}
case ET_STRING: {
@@ -299,20 +299,20 @@ struct ToStringVisitor : public IterationVisitor {
bool q;
std::string in;
size_t indent_level;
- bool vector_delimited;
- ToStringVisitor(std::string delimiter, bool quotes, std::string indent,
- bool vdelimited = true)
- : d(delimiter),
- q(quotes),
- in(indent),
- indent_level(0),
- vector_delimited(vdelimited) {}
+ bool vector_delimited;
+ ToStringVisitor(std::string delimiter, bool quotes, std::string indent,
+ bool vdelimited = true)
+ : d(delimiter),
+ q(quotes),
+ in(indent),
+ indent_level(0),
+ vector_delimited(vdelimited) {}
ToStringVisitor(std::string delimiter)
- : d(delimiter),
- q(false),
- in(""),
- indent_level(0),
- vector_delimited(true) {}
+ : d(delimiter),
+ q(false),
+ in(""),
+ indent_level(0),
+ vector_delimited(true) {}
void append_indent() {
for (size_t i = 0; i < indent_level; i++) { s += in; }
@@ -372,44 +372,44 @@ struct ToStringVisitor : public IterationVisitor {
void Unknown(const uint8_t *) { s += "(?)"; }
void StartVector() {
s += "[";
- if (vector_delimited) {
- s += d;
- indent_level++;
- append_indent();
- } else {
- s += " ";
- }
+ if (vector_delimited) {
+ s += d;
+ indent_level++;
+ append_indent();
+ } else {
+ s += " ";
+ }
}
void EndVector() {
- if (vector_delimited) {
- s += d;
- indent_level--;
- append_indent();
- } else {
- s += " ";
- }
+ if (vector_delimited) {
+ s += d;
+ indent_level--;
+ append_indent();
+ } else {
+ s += " ";
+ }
s += "]";
}
void Element(size_t i, ElementaryType /*type*/,
const TypeTable * /*type_table*/, const uint8_t * /*val*/) {
if (i) {
s += ",";
- if (vector_delimited) {
- s += d;
- append_indent();
- } else {
- s += " ";
- }
+ if (vector_delimited) {
+ s += d;
+ append_indent();
+ } else {
+ s += " ";
+ }
}
}
};
inline std::string FlatBufferToString(const uint8_t *buffer,
const TypeTable *type_table,
- bool multi_line = false,
- bool vector_delimited = true) {
- ToStringVisitor tostring_visitor(multi_line ? "\n" : " ", false, "",
- vector_delimited);
+ bool multi_line = false,
+ bool vector_delimited = true) {
+ ToStringVisitor tostring_visitor(multi_line ? "\n" : " ", false, "",
+ vector_delimited);
IterateFlatBuffer(buffer, type_table, &tostring_visitor);
return tostring_visitor.s;
}
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/reflection.h b/contrib/libs/flatbuffers/include/flatbuffers/reflection.h
index d268a3ffea..3835a642af 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/reflection.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/reflection.h
@@ -22,7 +22,7 @@
// Should normally not be a problem since it can be generated by the
// previous version of flatc whenever this code needs to change.
// See reflection/generate_code.sh
-#include "reflection_generated.h"
+#include "reflection_generated.h"
// Helper functionality for reflection.
@@ -253,7 +253,7 @@ inline std::string GetAnyVectorElemS(const VectorOfAny *vec,
template<typename T>
T *GetAnyVectorElemPointer(const VectorOfAny *vec, size_t i) {
auto elem_ptr = vec->Data() + sizeof(uoffset_t) * i;
- return reinterpret_cast<T *>(elem_ptr + ReadScalar<uoffset_t>(elem_ptr));
+ return reinterpret_cast<T *>(elem_ptr + ReadScalar<uoffset_t>(elem_ptr));
}
// Get the inline-address of a vector element. Useful for Structs (pass Struct
@@ -264,19 +264,19 @@ T *GetAnyVectorElemPointer(const VectorOfAny *vec, size_t i) {
template<typename T>
T *GetAnyVectorElemAddressOf(const VectorOfAny *vec, size_t i,
size_t elem_size) {
- return reinterpret_cast<T *>(vec->Data() + elem_size * i);
+ return reinterpret_cast<T *>(vec->Data() + elem_size * i);
}
// Similarly, for elements of tables.
template<typename T>
T *GetAnyFieldAddressOf(const Table &table, const reflection::Field &field) {
- return reinterpret_cast<T *>(table.GetAddressOf(field.offset()));
+ return reinterpret_cast<T *>(table.GetAddressOf(field.offset()));
}
// Similarly, for elements of structs.
template<typename T>
T *GetAnyFieldAddressOf(const Struct &st, const reflection::Field &field) {
- return reinterpret_cast<T *>(st.GetAddressOf(field.offset()));
+ return reinterpret_cast<T *>(st.GetAddressOf(field.offset()));
}
// ------------------------- SETTERS -------------------------
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/reflection_generated.h b/contrib/libs/flatbuffers/include/flatbuffers/reflection_generated.h
index 93dc4b88b7..578b34c55a 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/reflection_generated.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/reflection_generated.h
@@ -4,36 +4,36 @@
#ifndef FLATBUFFERS_GENERATED_REFLECTION_REFLECTION_H_
#define FLATBUFFERS_GENERATED_REFLECTION_REFLECTION_H_
-#include "flatbuffers.h"
+#include "flatbuffers.h"
namespace reflection {
struct Type;
-struct TypeBuilder;
+struct TypeBuilder;
struct KeyValue;
-struct KeyValueBuilder;
+struct KeyValueBuilder;
struct EnumVal;
-struct EnumValBuilder;
+struct EnumValBuilder;
struct Enum;
-struct EnumBuilder;
+struct EnumBuilder;
struct Field;
-struct FieldBuilder;
+struct FieldBuilder;
struct Object;
-struct ObjectBuilder;
+struct ObjectBuilder;
struct RPCCall;
-struct RPCCallBuilder;
+struct RPCCallBuilder;
struct Service;
-struct ServiceBuilder;
+struct ServiceBuilder;
struct Schema;
-struct SchemaBuilder;
+struct SchemaBuilder;
enum BaseType {
None = 0,
@@ -52,7 +52,7 @@ enum BaseType {
String = 13,
Vector = 14,
Obj = 15,
- Union = 16,
+ Union = 16,
Array = 17,
MaxBaseType = 18
};
@@ -75,7 +75,7 @@ inline const BaseType (&EnumValuesBaseType())[19] {
String,
Vector,
Obj,
- Union,
+ Union,
Array,
MaxBaseType
};
@@ -101,7 +101,7 @@ inline const char * const *EnumNamesBaseType() {
"Vector",
"Obj",
"Union",
- "Array",
+ "Array",
"MaxBaseType",
nullptr
};
@@ -110,7 +110,7 @@ inline const char * const *EnumNamesBaseType() {
inline const char *EnumNameBaseType(BaseType e) {
if (flatbuffers::IsOutRange(e, None, MaxBaseType)) return "";
- const size_t index = static_cast<size_t>(e);
+ const size_t index = static_cast<size_t>(e);
return EnumNamesBaseType()[index];
}
@@ -153,51 +153,51 @@ inline const char *EnumNameAdvancedFeatures(AdvancedFeatures e) {
}
struct Type FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
- typedef TypeBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ typedef TypeBuilder Builder;
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_BASE_TYPE = 4,
VT_ELEMENT = 6,
- VT_INDEX = 8,
- VT_FIXED_LENGTH = 10
+ VT_INDEX = 8,
+ VT_FIXED_LENGTH = 10
};
- reflection::BaseType base_type() const {
- return static_cast<reflection::BaseType>(GetField<int8_t>(VT_BASE_TYPE, 0));
+ reflection::BaseType base_type() const {
+ return static_cast<reflection::BaseType>(GetField<int8_t>(VT_BASE_TYPE, 0));
}
- reflection::BaseType element() const {
- return static_cast<reflection::BaseType>(GetField<int8_t>(VT_ELEMENT, 0));
+ reflection::BaseType element() const {
+ return static_cast<reflection::BaseType>(GetField<int8_t>(VT_ELEMENT, 0));
}
int32_t index() const {
return GetField<int32_t>(VT_INDEX, -1);
}
- uint16_t fixed_length() const {
- return GetField<uint16_t>(VT_FIXED_LENGTH, 0);
- }
+ uint16_t fixed_length() const {
+ return GetField<uint16_t>(VT_FIXED_LENGTH, 0);
+ }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<int8_t>(verifier, VT_BASE_TYPE) &&
VerifyField<int8_t>(verifier, VT_ELEMENT) &&
VerifyField<int32_t>(verifier, VT_INDEX) &&
- VerifyField<uint16_t>(verifier, VT_FIXED_LENGTH) &&
+ VerifyField<uint16_t>(verifier, VT_FIXED_LENGTH) &&
verifier.EndTable();
}
};
struct TypeBuilder {
- typedef Type Table;
+ typedef Type Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
- void add_base_type(reflection::BaseType base_type) {
+ void add_base_type(reflection::BaseType base_type) {
fbb_.AddElement<int8_t>(Type::VT_BASE_TYPE, static_cast<int8_t>(base_type), 0);
}
- void add_element(reflection::BaseType element) {
+ void add_element(reflection::BaseType element) {
fbb_.AddElement<int8_t>(Type::VT_ELEMENT, static_cast<int8_t>(element), 0);
}
void add_index(int32_t index) {
fbb_.AddElement<int32_t>(Type::VT_INDEX, index, -1);
}
- void add_fixed_length(uint16_t fixed_length) {
- fbb_.AddElement<uint16_t>(Type::VT_FIXED_LENGTH, fixed_length, 0);
- }
+ void add_fixed_length(uint16_t fixed_length) {
+ fbb_.AddElement<uint16_t>(Type::VT_FIXED_LENGTH, fixed_length, 0);
+ }
explicit TypeBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
@@ -211,21 +211,21 @@ struct TypeBuilder {
inline flatbuffers::Offset<Type> CreateType(
flatbuffers::FlatBufferBuilder &_fbb,
- reflection::BaseType base_type = reflection::None,
- reflection::BaseType element = reflection::None,
- int32_t index = -1,
- uint16_t fixed_length = 0) {
+ reflection::BaseType base_type = reflection::None,
+ reflection::BaseType element = reflection::None,
+ int32_t index = -1,
+ uint16_t fixed_length = 0) {
TypeBuilder builder_(_fbb);
builder_.add_index(index);
- builder_.add_fixed_length(fixed_length);
+ builder_.add_fixed_length(fixed_length);
builder_.add_element(element);
builder_.add_base_type(base_type);
return builder_.Finish();
}
struct KeyValue FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
- typedef KeyValueBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ typedef KeyValueBuilder Builder;
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_KEY = 4,
VT_VALUE = 6
};
@@ -252,7 +252,7 @@ struct KeyValue FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
};
struct KeyValueBuilder {
- typedef KeyValue Table;
+ typedef KeyValue Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_key(flatbuffers::Offset<flatbuffers::String> key) {
@@ -287,17 +287,17 @@ inline flatbuffers::Offset<KeyValue> CreateKeyValueDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *key = nullptr,
const char *value = nullptr) {
- auto key__ = key ? _fbb.CreateString(key) : 0;
- auto value__ = value ? _fbb.CreateString(value) : 0;
+ auto key__ = key ? _fbb.CreateString(key) : 0;
+ auto value__ = value ? _fbb.CreateString(value) : 0;
return reflection::CreateKeyValue(
_fbb,
- key__,
- value__);
+ key__,
+ value__);
}
struct EnumVal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
- typedef EnumValBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ typedef EnumValBuilder Builder;
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_NAME = 4,
VT_VALUE = 6,
VT_OBJECT = 8,
@@ -316,11 +316,11 @@ struct EnumVal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
int KeyCompareWithValue(int64_t val) const {
return static_cast<int>(value() > val) - static_cast<int>(value() < val);
}
- const reflection::Object *object() const {
- return GetPointer<const reflection::Object *>(VT_OBJECT);
+ const reflection::Object *object() const {
+ return GetPointer<const reflection::Object *>(VT_OBJECT);
}
- const reflection::Type *union_type() const {
- return GetPointer<const reflection::Type *>(VT_UNION_TYPE);
+ const reflection::Type *union_type() const {
+ return GetPointer<const reflection::Type *>(VT_UNION_TYPE);
}
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *documentation() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_DOCUMENTATION);
@@ -342,7 +342,7 @@ struct EnumVal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
};
struct EnumValBuilder {
- typedef EnumVal Table;
+ typedef EnumVal Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
@@ -351,10 +351,10 @@ struct EnumValBuilder {
void add_value(int64_t value) {
fbb_.AddElement<int64_t>(EnumVal::VT_VALUE, value, 0);
}
- void add_object(flatbuffers::Offset<reflection::Object> object) {
+ void add_object(flatbuffers::Offset<reflection::Object> object) {
fbb_.AddOffset(EnumVal::VT_OBJECT, object);
}
- void add_union_type(flatbuffers::Offset<reflection::Type> union_type) {
+ void add_union_type(flatbuffers::Offset<reflection::Type> union_type) {
fbb_.AddOffset(EnumVal::VT_UNION_TYPE, union_type);
}
void add_documentation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation) {
@@ -376,8 +376,8 @@ inline flatbuffers::Offset<EnumVal> CreateEnumVal(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> name = 0,
int64_t value = 0,
- flatbuffers::Offset<reflection::Object> object = 0,
- flatbuffers::Offset<reflection::Type> union_type = 0,
+ flatbuffers::Offset<reflection::Object> object = 0,
+ flatbuffers::Offset<reflection::Type> union_type = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation = 0) {
EnumValBuilder builder_(_fbb);
builder_.add_value(value);
@@ -392,23 +392,23 @@ inline flatbuffers::Offset<EnumVal> CreateEnumValDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *name = nullptr,
int64_t value = 0,
- flatbuffers::Offset<reflection::Object> object = 0,
- flatbuffers::Offset<reflection::Type> union_type = 0,
+ flatbuffers::Offset<reflection::Object> object = 0,
+ flatbuffers::Offset<reflection::Type> union_type = 0,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *documentation = nullptr) {
- auto name__ = name ? _fbb.CreateString(name) : 0;
- auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
+ auto name__ = name ? _fbb.CreateString(name) : 0;
+ auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
return reflection::CreateEnumVal(
_fbb,
- name__,
+ name__,
value,
object,
union_type,
- documentation__);
+ documentation__);
}
struct Enum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
- typedef EnumBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ typedef EnumBuilder Builder;
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_NAME = 4,
VT_VALUES = 6,
VT_IS_UNION = 8,
@@ -425,17 +425,17 @@ struct Enum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
int KeyCompareWithValue(const char *val) const {
return strcmp(name()->c_str(), val);
}
- const flatbuffers::Vector<flatbuffers::Offset<reflection::EnumVal>> *values() const {
- return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::EnumVal>> *>(VT_VALUES);
+ const flatbuffers::Vector<flatbuffers::Offset<reflection::EnumVal>> *values() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::EnumVal>> *>(VT_VALUES);
}
bool is_union() const {
return GetField<uint8_t>(VT_IS_UNION, 0) != 0;
}
- const reflection::Type *underlying_type() const {
- return GetPointer<const reflection::Type *>(VT_UNDERLYING_TYPE);
+ const reflection::Type *underlying_type() const {
+ return GetPointer<const reflection::Type *>(VT_UNDERLYING_TYPE);
}
- const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *attributes() const {
- return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *>(VT_ATTRIBUTES);
+ const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *attributes() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *>(VT_ATTRIBUTES);
}
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *documentation() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_DOCUMENTATION);
@@ -461,22 +461,22 @@ struct Enum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
};
struct EnumBuilder {
- typedef Enum Table;
+ typedef Enum Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
fbb_.AddOffset(Enum::VT_NAME, name);
}
- void add_values(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::EnumVal>>> values) {
+ void add_values(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::EnumVal>>> values) {
fbb_.AddOffset(Enum::VT_VALUES, values);
}
void add_is_union(bool is_union) {
fbb_.AddElement<uint8_t>(Enum::VT_IS_UNION, static_cast<uint8_t>(is_union), 0);
}
- void add_underlying_type(flatbuffers::Offset<reflection::Type> underlying_type) {
+ void add_underlying_type(flatbuffers::Offset<reflection::Type> underlying_type) {
fbb_.AddOffset(Enum::VT_UNDERLYING_TYPE, underlying_type);
}
- void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes) {
+ void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes) {
fbb_.AddOffset(Enum::VT_ATTRIBUTES, attributes);
}
void add_documentation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation) {
@@ -499,10 +499,10 @@ struct EnumBuilder {
inline flatbuffers::Offset<Enum> CreateEnum(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> name = 0,
- flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::EnumVal>>> values = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::EnumVal>>> values = 0,
bool is_union = false,
- flatbuffers::Offset<reflection::Type> underlying_type = 0,
- flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes = 0,
+ flatbuffers::Offset<reflection::Type> underlying_type = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation = 0) {
EnumBuilder builder_(_fbb);
builder_.add_documentation(documentation);
@@ -517,28 +517,28 @@ inline flatbuffers::Offset<Enum> CreateEnum(
inline flatbuffers::Offset<Enum> CreateEnumDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *name = nullptr,
- std::vector<flatbuffers::Offset<reflection::EnumVal>> *values = nullptr,
+ std::vector<flatbuffers::Offset<reflection::EnumVal>> *values = nullptr,
bool is_union = false,
- flatbuffers::Offset<reflection::Type> underlying_type = 0,
- std::vector<flatbuffers::Offset<reflection::KeyValue>> *attributes = nullptr,
+ flatbuffers::Offset<reflection::Type> underlying_type = 0,
+ std::vector<flatbuffers::Offset<reflection::KeyValue>> *attributes = nullptr,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *documentation = nullptr) {
- auto name__ = name ? _fbb.CreateString(name) : 0;
- auto values__ = values ? _fbb.CreateVectorOfSortedTables<reflection::EnumVal>(values) : 0;
- auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables<reflection::KeyValue>(attributes) : 0;
- auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
+ auto name__ = name ? _fbb.CreateString(name) : 0;
+ auto values__ = values ? _fbb.CreateVectorOfSortedTables<reflection::EnumVal>(values) : 0;
+ auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables<reflection::KeyValue>(attributes) : 0;
+ auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
return reflection::CreateEnum(
_fbb,
- name__,
- values__,
+ name__,
+ values__,
is_union,
underlying_type,
- attributes__,
- documentation__);
+ attributes__,
+ documentation__);
}
struct Field FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
- typedef FieldBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ typedef FieldBuilder Builder;
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_NAME = 4,
VT_TYPE = 6,
VT_ID = 8,
@@ -561,8 +561,8 @@ struct Field FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
int KeyCompareWithValue(const char *val) const {
return strcmp(name()->c_str(), val);
}
- const reflection::Type *type() const {
- return GetPointer<const reflection::Type *>(VT_TYPE);
+ const reflection::Type *type() const {
+ return GetPointer<const reflection::Type *>(VT_TYPE);
}
uint16_t id() const {
return GetField<uint16_t>(VT_ID, 0);
@@ -585,8 +585,8 @@ struct Field FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool key() const {
return GetField<uint8_t>(VT_KEY, 0) != 0;
}
- const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *attributes() const {
- return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *>(VT_ATTRIBUTES);
+ const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *attributes() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *>(VT_ATTRIBUTES);
}
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *documentation() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_DOCUMENTATION);
@@ -619,13 +619,13 @@ struct Field FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
};
struct FieldBuilder {
- typedef Field Table;
+ typedef Field Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
fbb_.AddOffset(Field::VT_NAME, name);
}
- void add_type(flatbuffers::Offset<reflection::Type> type) {
+ void add_type(flatbuffers::Offset<reflection::Type> type) {
fbb_.AddOffset(Field::VT_TYPE, type);
}
void add_id(uint16_t id) {
@@ -649,7 +649,7 @@ struct FieldBuilder {
void add_key(bool key) {
fbb_.AddElement<uint8_t>(Field::VT_KEY, static_cast<uint8_t>(key), 0);
}
- void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes) {
+ void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes) {
fbb_.AddOffset(Field::VT_ATTRIBUTES, attributes);
}
void add_documentation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation) {
@@ -674,7 +674,7 @@ struct FieldBuilder {
inline flatbuffers::Offset<Field> CreateField(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> name = 0,
- flatbuffers::Offset<reflection::Type> type = 0,
+ flatbuffers::Offset<reflection::Type> type = 0,
uint16_t id = 0,
uint16_t offset = 0,
int64_t default_integer = 0,
@@ -682,7 +682,7 @@ inline flatbuffers::Offset<Field> CreateField(
bool deprecated = false,
bool required = false,
bool key = false,
- flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation = 0,
bool optional = false) {
FieldBuilder builder_(_fbb);
@@ -704,7 +704,7 @@ inline flatbuffers::Offset<Field> CreateField(
inline flatbuffers::Offset<Field> CreateFieldDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *name = nullptr,
- flatbuffers::Offset<reflection::Type> type = 0,
+ flatbuffers::Offset<reflection::Type> type = 0,
uint16_t id = 0,
uint16_t offset = 0,
int64_t default_integer = 0,
@@ -712,15 +712,15 @@ inline flatbuffers::Offset<Field> CreateFieldDirect(
bool deprecated = false,
bool required = false,
bool key = false,
- std::vector<flatbuffers::Offset<reflection::KeyValue>> *attributes = nullptr,
+ std::vector<flatbuffers::Offset<reflection::KeyValue>> *attributes = nullptr,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *documentation = nullptr,
bool optional = false) {
- auto name__ = name ? _fbb.CreateString(name) : 0;
- auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables<reflection::KeyValue>(attributes) : 0;
- auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
+ auto name__ = name ? _fbb.CreateString(name) : 0;
+ auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables<reflection::KeyValue>(attributes) : 0;
+ auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
return reflection::CreateField(
_fbb,
- name__,
+ name__,
type,
id,
offset,
@@ -729,14 +729,14 @@ inline flatbuffers::Offset<Field> CreateFieldDirect(
deprecated,
required,
key,
- attributes__,
+ attributes__,
documentation__,
optional);
}
struct Object FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
- typedef ObjectBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ typedef ObjectBuilder Builder;
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_NAME = 4,
VT_FIELDS = 6,
VT_IS_STRUCT = 8,
@@ -754,8 +754,8 @@ struct Object FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
int KeyCompareWithValue(const char *val) const {
return strcmp(name()->c_str(), val);
}
- const flatbuffers::Vector<flatbuffers::Offset<reflection::Field>> *fields() const {
- return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::Field>> *>(VT_FIELDS);
+ const flatbuffers::Vector<flatbuffers::Offset<reflection::Field>> *fields() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::Field>> *>(VT_FIELDS);
}
bool is_struct() const {
return GetField<uint8_t>(VT_IS_STRUCT, 0) != 0;
@@ -766,8 +766,8 @@ struct Object FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
int32_t bytesize() const {
return GetField<int32_t>(VT_BYTESIZE, 0);
}
- const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *attributes() const {
- return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *>(VT_ATTRIBUTES);
+ const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *attributes() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *>(VT_ATTRIBUTES);
}
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *documentation() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_DOCUMENTATION);
@@ -793,13 +793,13 @@ struct Object FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
};
struct ObjectBuilder {
- typedef Object Table;
+ typedef Object Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
fbb_.AddOffset(Object::VT_NAME, name);
}
- void add_fields(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Field>>> fields) {
+ void add_fields(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Field>>> fields) {
fbb_.AddOffset(Object::VT_FIELDS, fields);
}
void add_is_struct(bool is_struct) {
@@ -811,7 +811,7 @@ struct ObjectBuilder {
void add_bytesize(int32_t bytesize) {
fbb_.AddElement<int32_t>(Object::VT_BYTESIZE, bytesize, 0);
}
- void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes) {
+ void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes) {
fbb_.AddOffset(Object::VT_ATTRIBUTES, attributes);
}
void add_documentation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation) {
@@ -833,11 +833,11 @@ struct ObjectBuilder {
inline flatbuffers::Offset<Object> CreateObject(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> name = 0,
- flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Field>>> fields = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Field>>> fields = 0,
bool is_struct = false,
int32_t minalign = 0,
int32_t bytesize = 0,
- flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation = 0) {
ObjectBuilder builder_(_fbb);
builder_.add_documentation(documentation);
@@ -853,30 +853,30 @@ inline flatbuffers::Offset<Object> CreateObject(
inline flatbuffers::Offset<Object> CreateObjectDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *name = nullptr,
- std::vector<flatbuffers::Offset<reflection::Field>> *fields = nullptr,
+ std::vector<flatbuffers::Offset<reflection::Field>> *fields = nullptr,
bool is_struct = false,
int32_t minalign = 0,
int32_t bytesize = 0,
- std::vector<flatbuffers::Offset<reflection::KeyValue>> *attributes = nullptr,
+ std::vector<flatbuffers::Offset<reflection::KeyValue>> *attributes = nullptr,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *documentation = nullptr) {
- auto name__ = name ? _fbb.CreateString(name) : 0;
- auto fields__ = fields ? _fbb.CreateVectorOfSortedTables<reflection::Field>(fields) : 0;
- auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables<reflection::KeyValue>(attributes) : 0;
- auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
+ auto name__ = name ? _fbb.CreateString(name) : 0;
+ auto fields__ = fields ? _fbb.CreateVectorOfSortedTables<reflection::Field>(fields) : 0;
+ auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables<reflection::KeyValue>(attributes) : 0;
+ auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
return reflection::CreateObject(
_fbb,
- name__,
- fields__,
+ name__,
+ fields__,
is_struct,
minalign,
bytesize,
- attributes__,
- documentation__);
+ attributes__,
+ documentation__);
}
struct RPCCall FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
- typedef RPCCallBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ typedef RPCCallBuilder Builder;
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_NAME = 4,
VT_REQUEST = 6,
VT_RESPONSE = 8,
@@ -892,14 +892,14 @@ struct RPCCall FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
int KeyCompareWithValue(const char *val) const {
return strcmp(name()->c_str(), val);
}
- const reflection::Object *request() const {
- return GetPointer<const reflection::Object *>(VT_REQUEST);
+ const reflection::Object *request() const {
+ return GetPointer<const reflection::Object *>(VT_REQUEST);
}
- const reflection::Object *response() const {
- return GetPointer<const reflection::Object *>(VT_RESPONSE);
+ const reflection::Object *response() const {
+ return GetPointer<const reflection::Object *>(VT_RESPONSE);
}
- const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *attributes() const {
- return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *>(VT_ATTRIBUTES);
+ const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *attributes() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *>(VT_ATTRIBUTES);
}
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *documentation() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_DOCUMENTATION);
@@ -923,19 +923,19 @@ struct RPCCall FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
};
struct RPCCallBuilder {
- typedef RPCCall Table;
+ typedef RPCCall Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
fbb_.AddOffset(RPCCall::VT_NAME, name);
}
- void add_request(flatbuffers::Offset<reflection::Object> request) {
+ void add_request(flatbuffers::Offset<reflection::Object> request) {
fbb_.AddOffset(RPCCall::VT_REQUEST, request);
}
- void add_response(flatbuffers::Offset<reflection::Object> response) {
+ void add_response(flatbuffers::Offset<reflection::Object> response) {
fbb_.AddOffset(RPCCall::VT_RESPONSE, response);
}
- void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes) {
+ void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes) {
fbb_.AddOffset(RPCCall::VT_ATTRIBUTES, attributes);
}
void add_documentation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation) {
@@ -958,9 +958,9 @@ struct RPCCallBuilder {
inline flatbuffers::Offset<RPCCall> CreateRPCCall(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> name = 0,
- flatbuffers::Offset<reflection::Object> request = 0,
- flatbuffers::Offset<reflection::Object> response = 0,
- flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes = 0,
+ flatbuffers::Offset<reflection::Object> request = 0,
+ flatbuffers::Offset<reflection::Object> response = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation = 0) {
RPCCallBuilder builder_(_fbb);
builder_.add_documentation(documentation);
@@ -974,25 +974,25 @@ inline flatbuffers::Offset<RPCCall> CreateRPCCall(
inline flatbuffers::Offset<RPCCall> CreateRPCCallDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *name = nullptr,
- flatbuffers::Offset<reflection::Object> request = 0,
- flatbuffers::Offset<reflection::Object> response = 0,
- std::vector<flatbuffers::Offset<reflection::KeyValue>> *attributes = nullptr,
+ flatbuffers::Offset<reflection::Object> request = 0,
+ flatbuffers::Offset<reflection::Object> response = 0,
+ std::vector<flatbuffers::Offset<reflection::KeyValue>> *attributes = nullptr,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *documentation = nullptr) {
- auto name__ = name ? _fbb.CreateString(name) : 0;
- auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables<reflection::KeyValue>(attributes) : 0;
- auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
+ auto name__ = name ? _fbb.CreateString(name) : 0;
+ auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables<reflection::KeyValue>(attributes) : 0;
+ auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
return reflection::CreateRPCCall(
_fbb,
- name__,
+ name__,
request,
response,
- attributes__,
- documentation__);
+ attributes__,
+ documentation__);
}
struct Service FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
- typedef ServiceBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ typedef ServiceBuilder Builder;
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_NAME = 4,
VT_CALLS = 6,
VT_ATTRIBUTES = 8,
@@ -1007,11 +1007,11 @@ struct Service FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
int KeyCompareWithValue(const char *val) const {
return strcmp(name()->c_str(), val);
}
- const flatbuffers::Vector<flatbuffers::Offset<reflection::RPCCall>> *calls() const {
- return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::RPCCall>> *>(VT_CALLS);
+ const flatbuffers::Vector<flatbuffers::Offset<reflection::RPCCall>> *calls() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::RPCCall>> *>(VT_CALLS);
}
- const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *attributes() const {
- return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *>(VT_ATTRIBUTES);
+ const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *attributes() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *>(VT_ATTRIBUTES);
}
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *documentation() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_DOCUMENTATION);
@@ -1034,16 +1034,16 @@ struct Service FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
};
struct ServiceBuilder {
- typedef Service Table;
+ typedef Service Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
fbb_.AddOffset(Service::VT_NAME, name);
}
- void add_calls(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::RPCCall>>> calls) {
+ void add_calls(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::RPCCall>>> calls) {
fbb_.AddOffset(Service::VT_CALLS, calls);
}
- void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes) {
+ void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes) {
fbb_.AddOffset(Service::VT_ATTRIBUTES, attributes);
}
void add_documentation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation) {
@@ -1064,8 +1064,8 @@ struct ServiceBuilder {
inline flatbuffers::Offset<Service> CreateService(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> name = 0,
- flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::RPCCall>>> calls = 0,
- flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::RPCCall>>> calls = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation = 0) {
ServiceBuilder builder_(_fbb);
builder_.add_documentation(documentation);
@@ -1078,24 +1078,24 @@ inline flatbuffers::Offset<Service> CreateService(
inline flatbuffers::Offset<Service> CreateServiceDirect(
flatbuffers::FlatBufferBuilder &_fbb,
const char *name = nullptr,
- std::vector<flatbuffers::Offset<reflection::RPCCall>> *calls = nullptr,
- std::vector<flatbuffers::Offset<reflection::KeyValue>> *attributes = nullptr,
+ std::vector<flatbuffers::Offset<reflection::RPCCall>> *calls = nullptr,
+ std::vector<flatbuffers::Offset<reflection::KeyValue>> *attributes = nullptr,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *documentation = nullptr) {
- auto name__ = name ? _fbb.CreateString(name) : 0;
- auto calls__ = calls ? _fbb.CreateVectorOfSortedTables<reflection::RPCCall>(calls) : 0;
- auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables<reflection::KeyValue>(attributes) : 0;
- auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
+ auto name__ = name ? _fbb.CreateString(name) : 0;
+ auto calls__ = calls ? _fbb.CreateVectorOfSortedTables<reflection::RPCCall>(calls) : 0;
+ auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables<reflection::KeyValue>(attributes) : 0;
+ auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
return reflection::CreateService(
_fbb,
- name__,
- calls__,
- attributes__,
- documentation__);
+ name__,
+ calls__,
+ attributes__,
+ documentation__);
}
struct Schema FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
- typedef SchemaBuilder Builder;
- enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ typedef SchemaBuilder Builder;
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_OBJECTS = 4,
VT_ENUMS = 6,
VT_FILE_IDENT = 8,
@@ -1104,11 +1104,11 @@ struct Schema FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VT_SERVICES = 14,
VT_ADVANCED_FEATURES = 16
};
- const flatbuffers::Vector<flatbuffers::Offset<reflection::Object>> *objects() const {
- return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::Object>> *>(VT_OBJECTS);
+ const flatbuffers::Vector<flatbuffers::Offset<reflection::Object>> *objects() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::Object>> *>(VT_OBJECTS);
}
- const flatbuffers::Vector<flatbuffers::Offset<reflection::Enum>> *enums() const {
- return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::Enum>> *>(VT_ENUMS);
+ const flatbuffers::Vector<flatbuffers::Offset<reflection::Enum>> *enums() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::Enum>> *>(VT_ENUMS);
}
const flatbuffers::String *file_ident() const {
return GetPointer<const flatbuffers::String *>(VT_FILE_IDENT);
@@ -1116,11 +1116,11 @@ struct Schema FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::String *file_ext() const {
return GetPointer<const flatbuffers::String *>(VT_FILE_EXT);
}
- const reflection::Object *root_table() const {
- return GetPointer<const reflection::Object *>(VT_ROOT_TABLE);
+ const reflection::Object *root_table() const {
+ return GetPointer<const reflection::Object *>(VT_ROOT_TABLE);
}
- const flatbuffers::Vector<flatbuffers::Offset<reflection::Service>> *services() const {
- return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::Service>> *>(VT_SERVICES);
+ const flatbuffers::Vector<flatbuffers::Offset<reflection::Service>> *services() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::Service>> *>(VT_SERVICES);
}
reflection::AdvancedFeatures advanced_features() const {
return static_cast<reflection::AdvancedFeatures>(GetField<uint64_t>(VT_ADVANCED_FEATURES, 0));
@@ -1148,13 +1148,13 @@ struct Schema FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
};
struct SchemaBuilder {
- typedef Schema Table;
+ typedef Schema Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
- void add_objects(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Object>>> objects) {
+ void add_objects(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Object>>> objects) {
fbb_.AddOffset(Schema::VT_OBJECTS, objects);
}
- void add_enums(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Enum>>> enums) {
+ void add_enums(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Enum>>> enums) {
fbb_.AddOffset(Schema::VT_ENUMS, enums);
}
void add_file_ident(flatbuffers::Offset<flatbuffers::String> file_ident) {
@@ -1163,10 +1163,10 @@ struct SchemaBuilder {
void add_file_ext(flatbuffers::Offset<flatbuffers::String> file_ext) {
fbb_.AddOffset(Schema::VT_FILE_EXT, file_ext);
}
- void add_root_table(flatbuffers::Offset<reflection::Object> root_table) {
+ void add_root_table(flatbuffers::Offset<reflection::Object> root_table) {
fbb_.AddOffset(Schema::VT_ROOT_TABLE, root_table);
}
- void add_services(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Service>>> services) {
+ void add_services(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Service>>> services) {
fbb_.AddOffset(Schema::VT_SERVICES, services);
}
void add_advanced_features(reflection::AdvancedFeatures advanced_features) {
@@ -1187,11 +1187,11 @@ struct SchemaBuilder {
inline flatbuffers::Offset<Schema> CreateSchema(
flatbuffers::FlatBufferBuilder &_fbb,
- flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Object>>> objects = 0,
- flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Enum>>> enums = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Object>>> objects = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Enum>>> enums = 0,
flatbuffers::Offset<flatbuffers::String> file_ident = 0,
flatbuffers::Offset<flatbuffers::String> file_ext = 0,
- flatbuffers::Offset<reflection::Object> root_table = 0,
+ flatbuffers::Offset<reflection::Object> root_table = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::Service>>> services = 0,
reflection::AdvancedFeatures advanced_features = static_cast<reflection::AdvancedFeatures>(0)) {
SchemaBuilder builder_(_fbb);
@@ -1207,24 +1207,24 @@ inline flatbuffers::Offset<Schema> CreateSchema(
inline flatbuffers::Offset<Schema> CreateSchemaDirect(
flatbuffers::FlatBufferBuilder &_fbb,
- std::vector<flatbuffers::Offset<reflection::Object>> *objects = nullptr,
- std::vector<flatbuffers::Offset<reflection::Enum>> *enums = nullptr,
+ std::vector<flatbuffers::Offset<reflection::Object>> *objects = nullptr,
+ std::vector<flatbuffers::Offset<reflection::Enum>> *enums = nullptr,
const char *file_ident = nullptr,
const char *file_ext = nullptr,
- flatbuffers::Offset<reflection::Object> root_table = 0,
+ flatbuffers::Offset<reflection::Object> root_table = 0,
std::vector<flatbuffers::Offset<reflection::Service>> *services = nullptr,
reflection::AdvancedFeatures advanced_features = static_cast<reflection::AdvancedFeatures>(0)) {
- auto objects__ = objects ? _fbb.CreateVectorOfSortedTables<reflection::Object>(objects) : 0;
- auto enums__ = enums ? _fbb.CreateVectorOfSortedTables<reflection::Enum>(enums) : 0;
- auto file_ident__ = file_ident ? _fbb.CreateString(file_ident) : 0;
- auto file_ext__ = file_ext ? _fbb.CreateString(file_ext) : 0;
- auto services__ = services ? _fbb.CreateVectorOfSortedTables<reflection::Service>(services) : 0;
+ auto objects__ = objects ? _fbb.CreateVectorOfSortedTables<reflection::Object>(objects) : 0;
+ auto enums__ = enums ? _fbb.CreateVectorOfSortedTables<reflection::Enum>(enums) : 0;
+ auto file_ident__ = file_ident ? _fbb.CreateString(file_ident) : 0;
+ auto file_ext__ = file_ext ? _fbb.CreateString(file_ext) : 0;
+ auto services__ = services ? _fbb.CreateVectorOfSortedTables<reflection::Service>(services) : 0;
return reflection::CreateSchema(
_fbb,
- objects__,
- enums__,
- file_ident__,
- file_ext__,
+ objects__,
+ enums__,
+ file_ident__,
+ file_ext__,
root_table,
services__,
advanced_features);
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/registry.h b/contrib/libs/flatbuffers/include/flatbuffers/registry.h
index 30a0016dcb..f7555f5a0b 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/registry.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/registry.h
@@ -17,7 +17,7 @@
#ifndef FLATBUFFERS_REGISTRY_H_
#define FLATBUFFERS_REGISTRY_H_
-#include "idl.h"
+#include "idl.h"
namespace flatbuffers {
@@ -72,7 +72,7 @@ class Registry {
return DetachedBuffer();
}
// We have a valid FlatBuffer. Detach it from the builder and return.
- return parser.builder_.Release();
+ return parser.builder_.Release();
}
// Modify any parsing / output options used by the other functions.
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/stl_emulation.h b/contrib/libs/flatbuffers/include/flatbuffers/stl_emulation.h
index e8e1e59487..c53eb60c14 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/stl_emulation.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/stl_emulation.h
@@ -108,33 +108,33 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
#endif // defined(FLATBUFFERS_TEMPLATES_ALIASES)
#else
template <typename T> class numeric_limits :
- public std::numeric_limits<T> {
- public:
- // Android NDK fix.
- static T lowest() {
- return std::numeric_limits<T>::min();
- }
- };
-
- template <> class numeric_limits<float> :
- public std::numeric_limits<float> {
- public:
- static float lowest() { return -FLT_MAX; }
- };
-
- template <> class numeric_limits<double> :
- public std::numeric_limits<double> {
- public:
- static double lowest() { return -DBL_MAX; }
- };
-
+ public std::numeric_limits<T> {
+ public:
+ // Android NDK fix.
+ static T lowest() {
+ return std::numeric_limits<T>::min();
+ }
+ };
+
+ template <> class numeric_limits<float> :
+ public std::numeric_limits<float> {
+ public:
+ static float lowest() { return -FLT_MAX; }
+ };
+
+ template <> class numeric_limits<double> :
+ public std::numeric_limits<double> {
+ public:
+ static double lowest() { return -DBL_MAX; }
+ };
+
template <> class numeric_limits<unsigned long long> {
public:
static unsigned long long min() { return 0ULL; }
static unsigned long long max() { return ~0ULL; }
- static unsigned long long lowest() {
- return numeric_limits<unsigned long long>::min();
- }
+ static unsigned long long lowest() {
+ return numeric_limits<unsigned long long>::min();
+ }
};
template <> class numeric_limits<long long> {
@@ -146,9 +146,9 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
return static_cast<long long>(
(1ULL << ((sizeof(long long) << 3) - 1)) - 1);
}
- static long long lowest() {
- return numeric_limits<long long>::min();
- }
+ static long long lowest() {
+ return numeric_limits<long long>::min();
+ }
};
#endif // FLATBUFFERS_CPP98_STL
@@ -158,12 +158,12 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
template <typename T, typename U> using is_same = std::is_same<T,U>;
template <typename T> using is_floating_point = std::is_floating_point<T>;
template <typename T> using is_unsigned = std::is_unsigned<T>;
- template <typename T> using is_enum = std::is_enum<T>;
- template <typename T> using make_unsigned = std::make_unsigned<T>;
- template<bool B, class T, class F>
- using conditional = std::conditional<B, T, F>;
- template<class T, T v>
- using integral_constant = std::integral_constant<T, v>;
+ template <typename T> using is_enum = std::is_enum<T>;
+ template <typename T> using make_unsigned = std::make_unsigned<T>;
+ template<bool B, class T, class F>
+ using conditional = std::conditional<B, T, F>;
+ template<class T, T v>
+ using integral_constant = std::integral_constant<T, v>;
template <bool B>
using bool_constant = integral_constant<bool, B>;
#else
@@ -173,22 +173,22 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
template <typename T> using is_floating_point =
std::tr1::is_floating_point<T>;
template <typename T> using is_unsigned = std::tr1::is_unsigned<T>;
- template <typename T> using is_enum = std::tr1::is_enum<T>;
- // Android NDK doesn't have std::make_unsigned or std::tr1::make_unsigned.
- template<typename T> struct make_unsigned {
- static_assert(is_unsigned<T>::value, "Specialization not implemented!");
- using type = T;
- };
- template<> struct make_unsigned<char> { using type = unsigned char; };
- template<> struct make_unsigned<short> { using type = unsigned short; };
- template<> struct make_unsigned<int> { using type = unsigned int; };
- template<> struct make_unsigned<long> { using type = unsigned long; };
- template<>
- struct make_unsigned<long long> { using type = unsigned long long; };
- template<bool B, class T, class F>
- using conditional = std::tr1::conditional<B, T, F>;
- template<class T, T v>
- using integral_constant = std::tr1::integral_constant<T, v>;
+ template <typename T> using is_enum = std::tr1::is_enum<T>;
+ // Android NDK doesn't have std::make_unsigned or std::tr1::make_unsigned.
+ template<typename T> struct make_unsigned {
+ static_assert(is_unsigned<T>::value, "Specialization not implemented!");
+ using type = T;
+ };
+ template<> struct make_unsigned<char> { using type = unsigned char; };
+ template<> struct make_unsigned<short> { using type = unsigned short; };
+ template<> struct make_unsigned<int> { using type = unsigned int; };
+ template<> struct make_unsigned<long> { using type = unsigned long; };
+ template<>
+ struct make_unsigned<long long> { using type = unsigned long long; };
+ template<bool B, class T, class F>
+ using conditional = std::tr1::conditional<B, T, F>;
+ template<class T, T v>
+ using integral_constant = std::tr1::integral_constant<T, v>;
template <bool B>
using bool_constant = integral_constant<bool, B>;
#endif // !FLATBUFFERS_CPP98_STL
@@ -199,12 +199,12 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
template <typename T> struct is_floating_point :
public std::is_floating_point<T> {};
template <typename T> struct is_unsigned : public std::is_unsigned<T> {};
- template <typename T> struct is_enum : public std::is_enum<T> {};
- template <typename T> struct make_unsigned : public std::make_unsigned<T> {};
- template<bool B, class T, class F>
- struct conditional : public std::conditional<B, T, F> {};
- template<class T, T v>
- struct integral_constant : public std::integral_constant<T, v> {};
+ template <typename T> struct is_enum : public std::is_enum<T> {};
+ template <typename T> struct make_unsigned : public std::make_unsigned<T> {};
+ template<bool B, class T, class F>
+ struct conditional : public std::conditional<B, T, F> {};
+ template<class T, T v>
+ struct integral_constant : public std::integral_constant<T, v> {};
template <bool B>
struct bool_constant : public integral_constant<bool, B> {};
#endif // defined(FLATBUFFERS_TEMPLATES_ALIASES)
@@ -309,23 +309,23 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
template <class T> bool operator==(const unique_ptr<T>& x, intptr_t y) {
return reinterpret_cast<intptr_t>(x.get()) == y;
}
-
- template <class T> bool operator!=(const unique_ptr<T>& x, decltype(nullptr)) {
- return !!x;
- }
-
- template <class T> bool operator!=(decltype(nullptr), const unique_ptr<T>& x) {
- return !!x;
- }
-
- template <class T> bool operator==(const unique_ptr<T>& x, decltype(nullptr)) {
- return !x;
- }
-
- template <class T> bool operator==(decltype(nullptr), const unique_ptr<T>& x) {
- return !x;
- }
-
+
+ template <class T> bool operator!=(const unique_ptr<T>& x, decltype(nullptr)) {
+ return !!x;
+ }
+
+ template <class T> bool operator!=(decltype(nullptr), const unique_ptr<T>& x) {
+ return !!x;
+ }
+
+ template <class T> bool operator==(const unique_ptr<T>& x, decltype(nullptr)) {
+ return !x;
+ }
+
+ template <class T> bool operator==(decltype(nullptr), const unique_ptr<T>& x) {
+ return !x;
+ }
+
#endif // !FLATBUFFERS_CPP98_STL
#ifdef FLATBUFFERS_USE_STD_OPTIONAL
diff --git a/contrib/libs/flatbuffers/include/flatbuffers/util.h b/contrib/libs/flatbuffers/include/flatbuffers/util.h
index 4493c561c2..86f2057654 100644
--- a/contrib/libs/flatbuffers/include/flatbuffers/util.h
+++ b/contrib/libs/flatbuffers/include/flatbuffers/util.h
@@ -17,65 +17,65 @@
#ifndef FLATBUFFERS_UTIL_H_
#define FLATBUFFERS_UTIL_H_
-#include <errno.h>
-
-#include "base.h"
+#include <errno.h>
+
+#include "base.h"
#include "stl_emulation.h"
-
+
#ifndef FLATBUFFERS_PREFER_PRINTF
# include <sstream>
-#else // FLATBUFFERS_PREFER_PRINTF
+#else // FLATBUFFERS_PREFER_PRINTF
# include <float.h>
# include <stdio.h>
-#endif // FLATBUFFERS_PREFER_PRINTF
-
-#include <iomanip>
+#endif // FLATBUFFERS_PREFER_PRINTF
+
+#include <iomanip>
#include <string>
namespace flatbuffers {
-// @locale-independent functions for ASCII characters set.
-
-// Fast checking that character lies in closed range: [a <= x <= b]
-// using one compare (conditional branch) operator.
-inline bool check_ascii_range(char x, char a, char b) {
- FLATBUFFERS_ASSERT(a <= b);
- // (Hacker's Delight): `a <= x <= b` <=> `(x-a) <={u} (b-a)`.
- // The x, a, b will be promoted to int and subtracted without overflow.
- return static_cast<unsigned int>(x - a) <= static_cast<unsigned int>(b - a);
-}
-
-// Case-insensitive isalpha
-inline bool is_alpha(char c) {
- // ASCII only: alpha to upper case => reset bit 0x20 (~0x20 = 0xDF).
- return check_ascii_range(c & 0xDF, 'a' & 0xDF, 'z' & 0xDF);
-}
-
+// @locale-independent functions for ASCII characters set.
+
+// Fast checking that character lies in closed range: [a <= x <= b]
+// using one compare (conditional branch) operator.
+inline bool check_ascii_range(char x, char a, char b) {
+ FLATBUFFERS_ASSERT(a <= b);
+ // (Hacker's Delight): `a <= x <= b` <=> `(x-a) <={u} (b-a)`.
+ // The x, a, b will be promoted to int and subtracted without overflow.
+ return static_cast<unsigned int>(x - a) <= static_cast<unsigned int>(b - a);
+}
+
+// Case-insensitive isalpha
+inline bool is_alpha(char c) {
+ // ASCII only: alpha to upper case => reset bit 0x20 (~0x20 = 0xDF).
+ return check_ascii_range(c & 0xDF, 'a' & 0xDF, 'z' & 0xDF);
+}
+
// Check for uppercase alpha
inline bool is_alpha_upper(char c) { return check_ascii_range(c, 'A', 'Z'); }
-// Check (case-insensitive) that `c` is equal to alpha.
-inline bool is_alpha_char(char c, char alpha) {
- FLATBUFFERS_ASSERT(is_alpha(alpha));
- // ASCII only: alpha to upper case => reset bit 0x20 (~0x20 = 0xDF).
- return ((c & 0xDF) == (alpha & 0xDF));
-}
-
-// https://en.cppreference.com/w/cpp/string/byte/isxdigit
-// isdigit and isxdigit are the only standard narrow character classification
-// functions that are not affected by the currently installed C locale. although
-// some implementations (e.g. Microsoft in 1252 codepage) may classify
-// additional single-byte characters as digits.
-inline bool is_digit(char c) { return check_ascii_range(c, '0', '9'); }
-
-inline bool is_xdigit(char c) {
- // Replace by look-up table.
- return is_digit(c) || check_ascii_range(c & 0xDF, 'a' & 0xDF, 'f' & 0xDF);
-}
-
-// Case-insensitive isalnum
-inline bool is_alnum(char c) { return is_alpha(c) || is_digit(c); }
-
+// Check (case-insensitive) that `c` is equal to alpha.
+inline bool is_alpha_char(char c, char alpha) {
+ FLATBUFFERS_ASSERT(is_alpha(alpha));
+ // ASCII only: alpha to upper case => reset bit 0x20 (~0x20 = 0xDF).
+ return ((c & 0xDF) == (alpha & 0xDF));
+}
+
+// https://en.cppreference.com/w/cpp/string/byte/isxdigit
+// isdigit and isxdigit are the only standard narrow character classification
+// functions that are not affected by the currently installed C locale. although
+// some implementations (e.g. Microsoft in 1252 codepage) may classify
+// additional single-byte characters as digits.
+inline bool is_digit(char c) { return check_ascii_range(c, '0', '9'); }
+
+inline bool is_xdigit(char c) {
+ // Replace by look-up table.
+ return is_digit(c) || check_ascii_range(c & 0xDF, 'a' & 0xDF, 'f' & 0xDF);
+}
+
+// Case-insensitive isalnum
+inline bool is_alnum(char c) { return is_alpha(c) || is_digit(c); }
+
inline char CharToUpper(char c) {
return static_cast<char>(::toupper(static_cast<unsigned char>(c)));
}
@@ -84,8 +84,8 @@ inline char CharToLower(char c) {
return static_cast<char>(::tolower(static_cast<unsigned char>(c)));
}
-// @end-locale-independent functions for ASCII character set
-
+// @end-locale-independent functions for ASCII character set
+
#ifdef FLATBUFFERS_PREFER_PRINTF
template<typename T> size_t IntToDigitCount(T t) {
size_t digit_count = 0;
@@ -109,22 +109,22 @@ template<typename T> size_t NumToStringWidth(T t, int precision = 0) {
return string_width;
}
-template<typename T>
-std::string NumToStringImplWrapper(T t, const char *fmt, int precision = 0) {
+template<typename T>
+std::string NumToStringImplWrapper(T t, const char *fmt, int precision = 0) {
size_t string_width = NumToStringWidth(t, precision);
std::string s(string_width, 0x00);
// Allow snprintf to use std::string trailing null to detect buffer overflow
- snprintf(const_cast<char *>(s.data()), (s.size() + 1), fmt, string_width, t);
+ snprintf(const_cast<char *>(s.data()), (s.size() + 1), fmt, string_width, t);
return s;
}
-#endif // FLATBUFFERS_PREFER_PRINTF
+#endif // FLATBUFFERS_PREFER_PRINTF
// Convert an integer or floating point value to a string.
// In contrast to std::stringstream, "char" values are
// converted to a string of digits, and we don't use scientific notation.
template<typename T> std::string NumToString(T t) {
// clang-format off
-
+
#ifndef FLATBUFFERS_PREFER_PRINTF
std::stringstream ss;
ss << t;
@@ -142,9 +142,9 @@ template<> inline std::string NumToString<signed char>(signed char t) {
template<> inline std::string NumToString<unsigned char>(unsigned char t) {
return NumToString(static_cast<int>(t));
}
-template<> inline std::string NumToString<char>(char t) {
- return NumToString(static_cast<int>(t));
-}
+template<> inline std::string NumToString<char>(char t) {
+ return NumToString(static_cast<int>(t));
+}
#if defined(FLATBUFFERS_CPP98_STL)
template<> inline std::string NumToString<long long>(long long t) {
char buf[21]; // (log((1 << 63) - 1) / log(10)) + 2
@@ -163,7 +163,7 @@ inline std::string NumToString<unsigned long long>(unsigned long long t) {
// Special versions for floats/doubles.
template<typename T> std::string FloatToString(T t, int precision) {
// clang-format off
-
+
#ifndef FLATBUFFERS_PREFER_PRINTF
// to_string() prints different numbers of digits for floats depending on
// platform and isn't available on Android, so we use stringstream
@@ -199,9 +199,9 @@ template<> inline std::string NumToString<float>(float t) {
// The returned string length is always xdigits long, prefixed by 0 digits.
// For example, IntToStringHex(0x23, 8) returns the string "00000023".
inline std::string IntToStringHex(int i, int xdigits) {
- FLATBUFFERS_ASSERT(i >= 0);
+ FLATBUFFERS_ASSERT(i >= 0);
// clang-format off
-
+
#ifndef FLATBUFFERS_PREFER_PRINTF
std::stringstream ss;
ss << std::setw(xdigits) << std::setfill('0') << std::hex << std::uppercase
@@ -213,198 +213,198 @@ inline std::string IntToStringHex(int i, int xdigits) {
// clang-format on
}
-// clang-format off
-// Use locale independent functions {strtod_l, strtof_l, strtoll_l, strtoull_l}.
-#if defined(FLATBUFFERS_LOCALE_INDEPENDENT) && (FLATBUFFERS_LOCALE_INDEPENDENT > 0)
- class ClassicLocale {
- #ifdef _MSC_VER
- typedef _locale_t locale_type;
- #else
- typedef locale_t locale_type; // POSIX.1-2008 locale_t type
- #endif
- ClassicLocale();
- ~ClassicLocale();
- locale_type locale_;
- static ClassicLocale instance_;
- public:
- static locale_type Get() { return instance_.locale_; }
- };
-
+// clang-format off
+// Use locale independent functions {strtod_l, strtof_l, strtoll_l, strtoull_l}.
+#if defined(FLATBUFFERS_LOCALE_INDEPENDENT) && (FLATBUFFERS_LOCALE_INDEPENDENT > 0)
+ class ClassicLocale {
+ #ifdef _MSC_VER
+ typedef _locale_t locale_type;
+ #else
+ typedef locale_t locale_type; // POSIX.1-2008 locale_t type
+ #endif
+ ClassicLocale();
+ ~ClassicLocale();
+ locale_type locale_;
+ static ClassicLocale instance_;
+ public:
+ static locale_type Get() { return instance_.locale_; }
+ };
+
#ifdef _MSC_VER
- #define __strtoull_impl(s, pe, b) _strtoui64_l(s, pe, b, ClassicLocale::Get())
- #define __strtoll_impl(s, pe, b) _strtoi64_l(s, pe, b, ClassicLocale::Get())
- #define __strtod_impl(s, pe) _strtod_l(s, pe, ClassicLocale::Get())
- #define __strtof_impl(s, pe) _strtof_l(s, pe, ClassicLocale::Get())
+ #define __strtoull_impl(s, pe, b) _strtoui64_l(s, pe, b, ClassicLocale::Get())
+ #define __strtoll_impl(s, pe, b) _strtoi64_l(s, pe, b, ClassicLocale::Get())
+ #define __strtod_impl(s, pe) _strtod_l(s, pe, ClassicLocale::Get())
+ #define __strtof_impl(s, pe) _strtof_l(s, pe, ClassicLocale::Get())
#else
- #define __strtoull_impl(s, pe, b) strtoull_l(s, pe, b, ClassicLocale::Get())
- #define __strtoll_impl(s, pe, b) strtoll_l(s, pe, b, ClassicLocale::Get())
- #define __strtod_impl(s, pe) strtod_l(s, pe, ClassicLocale::Get())
- #define __strtof_impl(s, pe) strtof_l(s, pe, ClassicLocale::Get())
+ #define __strtoull_impl(s, pe, b) strtoull_l(s, pe, b, ClassicLocale::Get())
+ #define __strtoll_impl(s, pe, b) strtoll_l(s, pe, b, ClassicLocale::Get())
+ #define __strtod_impl(s, pe) strtod_l(s, pe, ClassicLocale::Get())
+ #define __strtof_impl(s, pe) strtof_l(s, pe, ClassicLocale::Get())
#endif
-#else
- #define __strtod_impl(s, pe) strtod(s, pe)
- #define __strtof_impl(s, pe) static_cast<float>(strtod(s, pe))
+#else
+ #define __strtod_impl(s, pe) strtod(s, pe)
+ #define __strtof_impl(s, pe) static_cast<float>(strtod(s, pe))
#ifdef _MSC_VER
- #define __strtoull_impl(s, pe, b) _strtoui64(s, pe, b)
- #define __strtoll_impl(s, pe, b) _strtoi64(s, pe, b)
+ #define __strtoull_impl(s, pe, b) _strtoui64(s, pe, b)
+ #define __strtoll_impl(s, pe, b) _strtoi64(s, pe, b)
#else
- #define __strtoull_impl(s, pe, b) strtoull(s, pe, b)
- #define __strtoll_impl(s, pe, b) strtoll(s, pe, b)
+ #define __strtoull_impl(s, pe, b) strtoull(s, pe, b)
+ #define __strtoll_impl(s, pe, b) strtoll(s, pe, b)
#endif
-#endif
-
-inline void strtoval_impl(int64_t *val, const char *str, char **endptr,
- int base) {
- *val = __strtoll_impl(str, endptr, base);
-}
-
-inline void strtoval_impl(uint64_t *val, const char *str, char **endptr,
- int base) {
- *val = __strtoull_impl(str, endptr, base);
-}
-
-inline void strtoval_impl(double *val, const char *str, char **endptr) {
- *val = __strtod_impl(str, endptr);
-}
-
-// UBSAN: double to float is safe if numeric_limits<float>::is_iec559 is true.
-__supress_ubsan__("float-cast-overflow")
-inline void strtoval_impl(float *val, const char *str, char **endptr) {
- *val = __strtof_impl(str, endptr);
-}
-#undef __strtoull_impl
-#undef __strtoll_impl
-#undef __strtod_impl
-#undef __strtof_impl
-// clang-format on
-
-// Adaptor for strtoull()/strtoll().
-// Flatbuffers accepts numbers with any count of leading zeros (-009 is -9),
-// while strtoll with base=0 interprets first leading zero as octal prefix.
-// In future, it is possible to add prefixed 0b0101.
-// 1) Checks errno code for overflow condition (out of range).
-// 2) If base <= 0, function try to detect base of number by prefix.
-//
-// Return value (like strtoull and strtoll, but reject partial result):
-// - If successful, an integer value corresponding to the str is returned.
-// - If full string conversion can't be performed, 0 is returned.
-// - If the converted value falls out of range of corresponding return type, a
-// range error occurs. In this case value MAX(T)/MIN(T) is returned.
-template<typename T>
-inline bool StringToIntegerImpl(T *val, const char *const str,
- const int base = 0,
- const bool check_errno = true) {
- // T is int64_t or uint64_T
- FLATBUFFERS_ASSERT(str);
- if (base <= 0) {
- auto s = str;
- while (*s && !is_digit(*s)) s++;
- if (s[0] == '0' && is_alpha_char(s[1], 'X'))
- return StringToIntegerImpl(val, str, 16, check_errno);
- // if a prefix not match, try base=10
- return StringToIntegerImpl(val, str, 10, check_errno);
- } else {
- if (check_errno) errno = 0; // clear thread-local errno
- auto endptr = str;
- strtoval_impl(val, str, const_cast<char **>(&endptr), base);
- if ((*endptr != '\0') || (endptr == str)) {
- *val = 0; // erase partial result
- return false; // invalid string
- }
- // errno is out-of-range, return MAX/MIN
- if (check_errno && errno) return false;
- return true;
- }
-}
-
-template<typename T>
-inline bool StringToFloatImpl(T *val, const char *const str) {
- // Type T must be either float or double.
- FLATBUFFERS_ASSERT(str && val);
- auto end = str;
- strtoval_impl(val, str, const_cast<char **>(&end));
- auto done = (end != str) && (*end == '\0');
- if (!done) *val = 0; // erase partial result
- return done;
-}
-
-// Convert a string to an instance of T.
-// Return value (matched with StringToInteger64Impl and strtod):
-// - If successful, a numeric value corresponding to the str is returned.
-// - If full string conversion can't be performed, 0 is returned.
-// - If the converted value falls out of range of corresponding return type, a
-// range error occurs. In this case value MAX(T)/MIN(T) is returned.
-template<typename T> inline bool StringToNumber(const char *s, T *val) {
+#endif
+
+inline void strtoval_impl(int64_t *val, const char *str, char **endptr,
+ int base) {
+ *val = __strtoll_impl(str, endptr, base);
+}
+
+inline void strtoval_impl(uint64_t *val, const char *str, char **endptr,
+ int base) {
+ *val = __strtoull_impl(str, endptr, base);
+}
+
+inline void strtoval_impl(double *val, const char *str, char **endptr) {
+ *val = __strtod_impl(str, endptr);
+}
+
+// UBSAN: double to float is safe if numeric_limits<float>::is_iec559 is true.
+__supress_ubsan__("float-cast-overflow")
+inline void strtoval_impl(float *val, const char *str, char **endptr) {
+ *val = __strtof_impl(str, endptr);
+}
+#undef __strtoull_impl
+#undef __strtoll_impl
+#undef __strtod_impl
+#undef __strtof_impl
+// clang-format on
+
+// Adaptor for strtoull()/strtoll().
+// Flatbuffers accepts numbers with any count of leading zeros (-009 is -9),
+// while strtoll with base=0 interprets first leading zero as octal prefix.
+// In future, it is possible to add prefixed 0b0101.
+// 1) Checks errno code for overflow condition (out of range).
+// 2) If base <= 0, function try to detect base of number by prefix.
+//
+// Return value (like strtoull and strtoll, but reject partial result):
+// - If successful, an integer value corresponding to the str is returned.
+// - If full string conversion can't be performed, 0 is returned.
+// - If the converted value falls out of range of corresponding return type, a
+// range error occurs. In this case value MAX(T)/MIN(T) is returned.
+template<typename T>
+inline bool StringToIntegerImpl(T *val, const char *const str,
+ const int base = 0,
+ const bool check_errno = true) {
+ // T is int64_t or uint64_T
+ FLATBUFFERS_ASSERT(str);
+ if (base <= 0) {
+ auto s = str;
+ while (*s && !is_digit(*s)) s++;
+ if (s[0] == '0' && is_alpha_char(s[1], 'X'))
+ return StringToIntegerImpl(val, str, 16, check_errno);
+ // if a prefix not match, try base=10
+ return StringToIntegerImpl(val, str, 10, check_errno);
+ } else {
+ if (check_errno) errno = 0; // clear thread-local errno
+ auto endptr = str;
+ strtoval_impl(val, str, const_cast<char **>(&endptr), base);
+ if ((*endptr != '\0') || (endptr == str)) {
+ *val = 0; // erase partial result
+ return false; // invalid string
+ }
+ // errno is out-of-range, return MAX/MIN
+ if (check_errno && errno) return false;
+ return true;
+ }
+}
+
+template<typename T>
+inline bool StringToFloatImpl(T *val, const char *const str) {
+ // Type T must be either float or double.
+ FLATBUFFERS_ASSERT(str && val);
+ auto end = str;
+ strtoval_impl(val, str, const_cast<char **>(&end));
+ auto done = (end != str) && (*end == '\0');
+ if (!done) *val = 0; // erase partial result
+ return done;
+}
+
+// Convert a string to an instance of T.
+// Return value (matched with StringToInteger64Impl and strtod):
+// - If successful, a numeric value corresponding to the str is returned.
+// - If full string conversion can't be performed, 0 is returned.
+// - If the converted value falls out of range of corresponding return type, a
+// range error occurs. In this case value MAX(T)/MIN(T) is returned.
+template<typename T> inline bool StringToNumber(const char *s, T *val) {
// Assert on `unsigned long` and `signed long` on LP64.
// If it is necessary, it could be solved with flatbuffers::enable_if<B,T>.
static_assert(sizeof(T) < sizeof(int64_t), "unexpected type T");
- FLATBUFFERS_ASSERT(s && val);
- int64_t i64;
- // The errno check isn't needed, will return MAX/MIN on overflow.
- if (StringToIntegerImpl(&i64, s, 0, false)) {
- const int64_t max = (flatbuffers::numeric_limits<T>::max)();
- const int64_t min = flatbuffers::numeric_limits<T>::lowest();
- if (i64 > max) {
- *val = static_cast<T>(max);
- return false;
- }
- if (i64 < min) {
- // For unsigned types return max to distinguish from
- // "no conversion can be performed" when 0 is returned.
- *val = static_cast<T>(flatbuffers::is_unsigned<T>::value ? max : min);
- return false;
- }
- *val = static_cast<T>(i64);
- return true;
- }
- *val = 0;
- return false;
-}
-
-template<> inline bool StringToNumber<int64_t>(const char *str, int64_t *val) {
- return StringToIntegerImpl(val, str);
-}
-
-template<>
-inline bool StringToNumber<uint64_t>(const char *str, uint64_t *val) {
- if (!StringToIntegerImpl(val, str)) return false;
- // The strtoull accepts negative numbers:
- // If the minus sign was part of the input sequence, the numeric value
- // calculated from the sequence of digits is negated as if by unary minus
- // in the result type, which applies unsigned integer wraparound rules.
- // Fix this behaviour (except -0).
- if (*val) {
- auto s = str;
- while (*s && !is_digit(*s)) s++;
- s = (s > str) ? (s - 1) : s; // step back to one symbol
- if (*s == '-') {
- // For unsigned types return the max to distinguish from
- // "no conversion can be performed".
- *val = (flatbuffers::numeric_limits<uint64_t>::max)();
- return false;
- }
- }
- return true;
-}
-
-template<> inline bool StringToNumber(const char *s, float *val) {
- return StringToFloatImpl(val, s);
-}
-
-template<> inline bool StringToNumber(const char *s, double *val) {
- return StringToFloatImpl(val, s);
-}
-
-inline int64_t StringToInt(const char *s, int base = 10) {
- int64_t val;
- return StringToIntegerImpl(&val, s, base) ? val : 0;
-}
-
-inline uint64_t StringToUInt(const char *s, int base = 10) {
- uint64_t val;
- return StringToIntegerImpl(&val, s, base) ? val : 0;
-}
-
+ FLATBUFFERS_ASSERT(s && val);
+ int64_t i64;
+ // The errno check isn't needed, will return MAX/MIN on overflow.
+ if (StringToIntegerImpl(&i64, s, 0, false)) {
+ const int64_t max = (flatbuffers::numeric_limits<T>::max)();
+ const int64_t min = flatbuffers::numeric_limits<T>::lowest();
+ if (i64 > max) {
+ *val = static_cast<T>(max);
+ return false;
+ }
+ if (i64 < min) {
+ // For unsigned types return max to distinguish from
+ // "no conversion can be performed" when 0 is returned.
+ *val = static_cast<T>(flatbuffers::is_unsigned<T>::value ? max : min);
+ return false;
+ }
+ *val = static_cast<T>(i64);
+ return true;
+ }
+ *val = 0;
+ return false;
+}
+
+template<> inline bool StringToNumber<int64_t>(const char *str, int64_t *val) {
+ return StringToIntegerImpl(val, str);
+}
+
+template<>
+inline bool StringToNumber<uint64_t>(const char *str, uint64_t *val) {
+ if (!StringToIntegerImpl(val, str)) return false;
+ // The strtoull accepts negative numbers:
+ // If the minus sign was part of the input sequence, the numeric value
+ // calculated from the sequence of digits is negated as if by unary minus
+ // in the result type, which applies unsigned integer wraparound rules.
+ // Fix this behaviour (except -0).
+ if (*val) {
+ auto s = str;
+ while (*s && !is_digit(*s)) s++;
+ s = (s > str) ? (s - 1) : s; // step back to one symbol
+ if (*s == '-') {
+ // For unsigned types return the max to distinguish from
+ // "no conversion can be performed".
+ *val = (flatbuffers::numeric_limits<uint64_t>::max)();
+ return false;
+ }
+ }
+ return true;
+}
+
+template<> inline bool StringToNumber(const char *s, float *val) {
+ return StringToFloatImpl(val, s);
+}
+
+template<> inline bool StringToNumber(const char *s, double *val) {
+ return StringToFloatImpl(val, s);
+}
+
+inline int64_t StringToInt(const char *s, int base = 10) {
+ int64_t val;
+ return StringToIntegerImpl(&val, s, base) ? val : 0;
+}
+
+inline uint64_t StringToUInt(const char *s, int base = 10) {
+ uint64_t val;
+ return StringToIntegerImpl(&val, s, base) ? val : 0;
+}
+
typedef bool (*LoadFileFunction)(const char *filename, bool binary,
std::string *dest);
typedef bool (*FileExistsFunction)(const char *filename);
@@ -431,7 +431,7 @@ bool LoadFile(const char *name, bool binary, std::string *buf);
// If "binary" is false data is written using ifstream's
// text mode, otherwise data is written with no
// transcoding.
-bool SaveFile(const char *name, const char *buf, size_t len, bool binary);
+bool SaveFile(const char *name, const char *buf, size_t len, bool binary);
// Save data "buf" into file "name" returning true if
// successful, false otherwise. If "binary" is false
@@ -447,35 +447,35 @@ inline bool SaveFile(const char *name, const std::string &buf, bool binary) {
// Windows ('/' or '\\') separators are used.
// Any new separators inserted are always posix.
-FLATBUFFERS_CONSTEXPR char kPathSeparator = '/';
+FLATBUFFERS_CONSTEXPR char kPathSeparator = '/';
// Returns the path with the extension, if any, removed.
-std::string StripExtension(const std::string &filepath);
+std::string StripExtension(const std::string &filepath);
// Returns the extension, if any.
-std::string GetExtension(const std::string &filepath);
+std::string GetExtension(const std::string &filepath);
// Return the last component of the path, after the last separator.
-std::string StripPath(const std::string &filepath);
+std::string StripPath(const std::string &filepath);
// Strip the last component of the path + separator.
-std::string StripFileName(const std::string &filepath);
+std::string StripFileName(const std::string &filepath);
// Concatenates a path with a filename, regardless of whether the path
// ends in a separator or not.
-std::string ConCatPathFileName(const std::string &path,
- const std::string &filename);
+std::string ConCatPathFileName(const std::string &path,
+ const std::string &filename);
// Replaces any '\\' separators with '/'
-std::string PosixPath(const char *path);
+std::string PosixPath(const char *path);
// This function ensure a directory exists, by recursively
// creating dirs for any parts of the path that don't exist yet.
-void EnsureDirExists(const std::string &filepath);
+void EnsureDirExists(const std::string &filepath);
// Obtains the absolute path from any other path.
// Returns the input path if the absolute path couldn't be resolved.
-std::string AbsolutePath(const std::string &filepath);
+std::string AbsolutePath(const std::string &filepath);
// To and from UTF-8 unicode conversion functions
@@ -519,8 +519,8 @@ inline int FromUTF8(const char **in) {
break;
}
}
- if ((static_cast<unsigned char>(**in) << len) & 0x80)
- return -1; // Bit after leading 1's must be 0.
+ if ((static_cast<unsigned char>(**in) << len) & 0x80)
+ return -1; // Bit after leading 1's must be 0.
if (!len) return *(*in)++;
// UTF-8 encoded values with a length are between 2 and 4 bytes.
if (len < 2 || len > 4) { return -1; }
@@ -579,7 +579,7 @@ inline std::string WordWrap(const std::string in, size_t max_length,
return wrapped;
}
-#endif // !FLATBUFFERS_PREFER_PRINTF
+#endif // !FLATBUFFERS_PREFER_PRINTF
inline bool EscapeString(const char *s, size_t length, std::string *_text,
bool allow_non_utf8, bool natural_utf8) {
@@ -651,48 +651,48 @@ inline bool EscapeString(const char *s, size_t length, std::string *_text,
return true;
}
-inline std::string BufferToHexText(const void *buffer, size_t buffer_size,
- size_t max_length,
- const std::string &wrapped_line_prefix,
- const std::string &wrapped_line_suffix) {
- std::string text = wrapped_line_prefix;
- size_t start_offset = 0;
- const char *s = reinterpret_cast<const char *>(buffer);
- for (size_t i = 0; s && i < buffer_size; i++) {
- // Last iteration or do we have more?
- bool have_more = i + 1 < buffer_size;
- text += "0x";
- text += IntToStringHex(static_cast<uint8_t>(s[i]), 2);
- if (have_more) { text += ','; }
- // If we have more to process and we reached max_length
- if (have_more &&
- text.size() + wrapped_line_suffix.size() >= start_offset + max_length) {
- text += wrapped_line_suffix;
- text += '\n';
- start_offset = text.size();
- text += wrapped_line_prefix;
- }
- }
- text += wrapped_line_suffix;
- return text;
-}
-
-// Remove paired quotes in a string: "text"|'text' -> text.
-std::string RemoveStringQuotes(const std::string &s);
-
-// Change th global C-locale to locale with name <locale_name>.
-// Returns an actual locale name in <_value>, useful if locale_name is "" or
-// null.
-bool SetGlobalTestLocale(const char *locale_name,
- std::string *_value = nullptr);
-
-// Read (or test) a value of environment variable.
-bool ReadEnvironmentVariable(const char *var_name,
- std::string *_value = nullptr);
-
-// MSVC specific: Send all assert reports to STDOUT to prevent CI hangs.
-void SetupDefaultCRTReportMode();
-
+inline std::string BufferToHexText(const void *buffer, size_t buffer_size,
+ size_t max_length,
+ const std::string &wrapped_line_prefix,
+ const std::string &wrapped_line_suffix) {
+ std::string text = wrapped_line_prefix;
+ size_t start_offset = 0;
+ const char *s = reinterpret_cast<const char *>(buffer);
+ for (size_t i = 0; s && i < buffer_size; i++) {
+ // Last iteration or do we have more?
+ bool have_more = i + 1 < buffer_size;
+ text += "0x";
+ text += IntToStringHex(static_cast<uint8_t>(s[i]), 2);
+ if (have_more) { text += ','; }
+ // If we have more to process and we reached max_length
+ if (have_more &&
+ text.size() + wrapped_line_suffix.size() >= start_offset + max_length) {
+ text += wrapped_line_suffix;
+ text += '\n';
+ start_offset = text.size();
+ text += wrapped_line_prefix;
+ }
+ }
+ text += wrapped_line_suffix;
+ return text;
+}
+
+// Remove paired quotes in a string: "text"|'text' -> text.
+std::string RemoveStringQuotes(const std::string &s);
+
+// Change th global C-locale to locale with name <locale_name>.
+// Returns an actual locale name in <_value>, useful if locale_name is "" or
+// null.
+bool SetGlobalTestLocale(const char *locale_name,
+ std::string *_value = nullptr);
+
+// Read (or test) a value of environment variable.
+bool ReadEnvironmentVariable(const char *var_name,
+ std::string *_value = nullptr);
+
+// MSVC specific: Send all assert reports to STDOUT to prevent CI hangs.
+void SetupDefaultCRTReportMode();
+
} // namespace flatbuffers
#endif // FLATBUFFERS_UTIL_H_
diff --git a/contrib/libs/flatbuffers/ya.make b/contrib/libs/flatbuffers/ya.make
index 4af01ae72c..4928393fcb 100644
--- a/contrib/libs/flatbuffers/ya.make
+++ b/contrib/libs/flatbuffers/ya.make
@@ -9,9 +9,9 @@ OWNER(
)
VERSION(2.0.0)
-
-ORIGINAL_SOURCE(https://github.com/google/flatbuffers/archive/v2.0.0.tar.gz)
-
+
+ORIGINAL_SOURCE(https://github.com/google/flatbuffers/archive/v2.0.0.tar.gz)
+
LICENSE(
Apache-2.0 AND
BSD-3-Clause
@@ -23,24 +23,24 @@ ADDINCL(
contrib/libs/flatbuffers/include
)
-NO_COMPILER_WARNINGS()
-
-NO_UTIL()
+NO_COMPILER_WARNINGS()
+NO_UTIL()
+
CFLAGS(
-DFLATBUFFERS_LOCALE_INDEPENDENT=1
)
-
+
SRCS(
- src/idl_gen_text.cpp
- src/idl_parser.cpp
- src/reflection.cpp
- src/util.cpp
+ src/idl_gen_text.cpp
+ src/idl_parser.cpp
+ src/reflection.cpp
+ src/util.cpp
)
END()
-
-RECURSE(
- flatc
- samples
-)
+
+RECURSE(
+ flatc
+ samples
+)